1
0
mirror of https://github.com/golang/go synced 2024-10-03 14:31:22 -06:00
Commit Graph

5382 Commits

Author SHA1 Message Date
Christopher Wedgwood
74d0302eb9 Remove exp/exception as it's no longer relevant
R=gri, adg
CC=golang-dev, r, rsc
https://golang.org/cl/857048
2010-04-13 10:51:35 +10:00
Rob Pike
c701c38e13 fixes for rpc:
- don't log normal EOF
- fix ServeConn to block as documented

R=rsc, msolo
CC=golang-dev
https://golang.org/cl/886043
2010-04-12 17:14:28 -07:00
Russ Cox
d9254d00f9 gc: zero unnamed return values on entry if func has defer
R=ken2
CC=golang-dev
https://golang.org/cl/891050
2010-04-12 14:28:27 -07:00
Christopher Wedgwood
9149d91888 xml: update documentation to match current coding style
R=rsc, r
CC=golang-dev
https://golang.org/cl/891048
2010-04-12 10:28:50 -07:00
Andrei Vieru
1ab15fac22 fmt format verb %b bug
fmt.Printf("%b", int8(-1)) prints 64 ones instead of 8.
This happens only for signed integers (int8, in16 and int32). I guess it's because of the way the conversion between integer types works. From go spec: "Conversions between integer types. If the value is a signed quantity, it is sign extended to implicit infinite precision ....". And there are several conversions to int64 and uint64 in the fmt package. This pathch solves only half of the problem. On a 32 bit system, an fmt.Printf("%b", int(-1)) should still print 64 ones.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/891049
2010-04-12 10:20:06 -07:00
Rob Pike
8a68b8287b CLA: Andrei Vieru
R=rsc
CC=golang-dev
https://golang.org/cl/890044
2010-04-12 10:11:18 -07:00
Christopher Wedgwood
10f7f80fae json: update documentation to match current coding style
R=rsc
CC=golang-dev
https://golang.org/cl/888045
2010-04-11 22:09:34 -07:00
Russ Cox
c9293f0cc7 gc: compile s == "" as len(s) == 0
R=ken2
CC=golang-dev
https://golang.org/cl/840043
2010-04-11 15:24:44 -07:00
Russ Cox
9475cafa73 gc: distinguish fatal compiler bug from error+exit
R=ken2
CC=golang-dev
https://golang.org/cl/902044
2010-04-11 14:52:06 -07:00
Russ Cox
fe7826858c gc: make sure main.main has correct type
R=ken2
CC=golang-dev
https://golang.org/cl/883049
2010-04-11 14:51:35 -07:00
Evan Shaw
d77010547d debug/elf: Fix doc comments
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/849049
2010-04-11 14:49:44 -07:00
Evan Shaw
fa860653ae exp/eval: Fix example and add target to Makefile
R=rsc
CC=golang-dev
https://golang.org/cl/901042
2010-04-11 12:42:19 -07:00
Christopher Wedgwood
ae729a433f archive/tar: update documentation to match current coding style
R=rsc, r
CC=golang-dev
https://golang.org/cl/903044
2010-04-11 10:29:07 -07:00
Christopher Wedgwood
98a5a20c5e nacl: update documentation to match current coding style
R=rsc, r
CC=golang-dev
https://golang.org/cl/822047
2010-04-11 10:19:32 -07:00
Christopher Wedgwood
3fbe7f4f41 testing: update documentation to match current coding style
R=rsc, r
CC=golang-dev
https://golang.org/cl/823045
2010-04-11 10:18:49 -07:00
Christopher Wedgwood
094732f7eb godoc: change od.Dir -> os.FileInfo in comments
R=gri, r
CC=golang-dev, rsc
https://golang.org/cl/819042
2010-04-11 10:17:45 -07:00
Andrew Gerrand
adb3b863c9 time: fix comment typo
R=r
CC=golang-dev
https://golang.org/cl/811044
2010-04-11 23:33:25 +10:00
David Symonds
ee75ffa286 codereview: Mention that deleting a CL is a use of 'hg change' in its header.
R=rsc
CC=golang-dev
https://golang.org/cl/903043
2010-04-10 01:53:43 -07:00
Michael Hoisie
92ac0cfbb2 strings: add IndexRune, Trim, TrimLeft, TrimRight, and the generic equivalents TrimFunc, TrimLeftFunc, TrimRightFunc
R=rsc, r
CC=golang-dev
https://golang.org/cl/799048
2010-04-09 18:57:03 -07:00
Russ Cox
6363542695 runtime: delete malx, skip_depth argument to malloc
remove internal functions from traces in gopprof instead.

R=r
CC=golang-dev
https://golang.org/cl/855046
2010-04-09 15:30:40 -07:00
Russ Cox
08852ffe80 freebsd: fix build, maybe
R=r
CC=golang-dev
https://golang.org/cl/909041
2010-04-09 14:37:53 -07:00
Charles L. Dorian
3c3e68ba32 math: use ** for exponentiation in comments
R=rsc
CC=golang-dev
https://golang.org/cl/908041
2010-04-09 14:37:33 -07:00
Charles L. Dorian
9b1d6332e8 cmath: use ** for exponentiation in comments
R=rsc
CC=golang-dev
https://golang.org/cl/831045
2010-04-09 14:37:26 -07:00
Ian Lance Taylor
a4f8d36ba5 Run initcgo for all amd64 targets, not just GNU/Linux.
This is required to make cgo export work on Darwin.  Note that
this corrects the stack alignment when calling initcgo to that
required by gcc on amd64.

R=rsc
CC=golang-dev
https://golang.org/cl/907041
2010-04-09 14:15:15 -07:00
Ian Lance Taylor
f833a8d392 A test case for cgo //export.
R=rsc
CC=golang-dev
https://golang.org/cl/881043
2010-04-09 13:31:26 -07:00
Ian Lance Taylor
12e7ce95c6 Add //export to cgo.
The new //export comment marks a Go function as callable from
C.  The syntax is "//export NAME" where NAME is the name of
the function as seen from C.  If such a comment is seen, cgo
will generate two new files: _cgo_export.h and _cgo_export.c.
The _cgo_export.h file provides declarations which C code may
use to call Go functions.  The _cgo_export.c file contains
wrappers, and is to be compiled with gcc.

The changes to Make.pkg support using this from a Go Makefile,
though it could probably be more convenient.

R=rsc
CC=golang-dev
https://golang.org/cl/853042
2010-04-09 13:31:05 -07:00
Ian Lance Taylor
2e20386fc7 Library support for cgo export.
These functions are used to call from a C function back to a
Go function.  This only includes 386 support.

R=rsc
CC=golang-dev
https://golang.org/cl/834045
2010-04-09 13:30:35 -07:00
Ian Lance Taylor
2d0ff3f1a6 Support cgo export on amd64.
R=rsc
CC=golang-dev
https://golang.org/cl/857045
2010-04-09 13:30:11 -07:00
Rob Pike
bc2d977d67 Update roadmap: delete many accomplishments
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/854045
2010-04-09 13:22:05 -07:00
Rob Pike
3ddeef8153 rename os.Dir to os.FileInfo
R=rsc
CC=golang-dev
https://golang.org/cl/902042
2010-04-09 11:36:40 -07:00
Alex Brainman
a17544f283 fix bug in os_test.go checkMode
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/872043
2010-04-08 21:16:05 -07:00
Russ Cox
c60d048594 runtime: fix build (panic) for FreeBSD
R=adg
CC=golang-dev
https://golang.org/cl/867046
2010-04-08 21:13:42 -07:00
Russ Cox
5963dbac08 runtime: turn divide by zero, nil dereference into panics
tested on linux/amd64, linux/386, linux/arm, darwin/amd64, darwin/386.
freebsd untested; will finish in a separate CL.

for now all the panics are errorStrings.
richer structures can be added as necessary
once the mechanism is shaked out.

R=r
CC=golang-dev
https://golang.org/cl/906041
2010-04-08 18:15:30 -07:00
Russ Cox
72157c300b runtime: fix bad status throw
when garbage collector sees recovering goroutine

Fixes #711.

R=r
CC=golang-dev
https://golang.org/cl/869045
2010-04-08 13:24:53 -07:00
Russ Cox
2f0cae46d8 runtime: work around kernel bug in Snow Leopard signal handling
Could not take a signal on threads other than the main thread.
If you look at the spinning binary with dtrace, you can see a
fault happening over and over:

    $ dtrace -n '
    fbt::user_trap:entry /execname=="boot32" && self->count < 10/
    {
        self->count++;
        printf("%s %x %x %x %x", probefunc, arg1, arg2, arg3, arg4);
        stack();
        tracemem(arg4, 256);
    }'

    dtrace: description 'fbt::user_trap:entry ' matched 1 probe
    CPU     ID                    FUNCTION:NAME
      1  17015                  user_trap:entry user_trap 0 10 79af0a0 79af0a0
                  mach_kernel`lo_alltraps+0x12a

             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
         0: 0e 00 00 00 37 00 00 00 00 00 00 00 1f 00 00 00  ....7...........
        10: 1f 00 00 00 a8 33 00 00 00 00 00 01 00 00 00 00  .....3..........
        20: 98 ba dc fe 07 09 00 00 00 00 00 00 98 ba dc fe  ................
        30: 06 00 00 00 0d 00 00 00 34 00 00 00 9e 1c 00 00  ........4.......
        40: 17 00 00 00 00 02 00 00 ac 30 00 00 1f 00 00 00  .........0......
        50: 00 00 00 00 00 00 00 00 0d 00 00 00 e0 e6 29 00  ..............).
        60: 34 00 00 00 00 00 00 00 9e 1c 00 00 00 00 00 00  4...............
        70: 17 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00  ................
        80: ac 30 00 00 00 00 00 00 1f 00 00 00 00 00 00 00  .0..............
        90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        a0: 48 00 00 00 10 00 00 00 85 00 00 00 a0 f2 29 00  H.............).
        b0: 69 01 00 02 00 00 00 00 e6 93 04 82 ff 7f 00 00  i...............
        c0: 2f 00 00 00 00 00 00 00 06 02 00 00 00 00 00 00  /...............
        d0: 78 ee 42 01 01 00 00 00 1f 00 00 00 00 00 00 00  x.B.............
        e0: 00 ed 9a 07 00 00 00 00 00 00 00 00 00 00 00 00  ................
        f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

    ...

The memory dump shows a 32-bit exception frame:

    x86_saved_state32

    gs = 0x37
    fs = 0
    es = 0x1f
    ds = 0x1f
    edi = 0x33a8
    esi = 0x01000000
    ebp = 0
    cr2 = 0xfedcba98
    ebx = 0x0907
    edx = 0
    ecx = 0xfedcba98
    eax = 0x06
    trapno = 0x0d
    err = 0x34
    eip = 0x1c9e
    cs = 0x17
    efl = 0x0200
    uesp = 0x30ac
    ss = 0x1f

The cr2 of 0xfedcba98 is the address that the new thread read
to cause the fault, but note that the trap is now a GP fault with
error code 0x34, meaning it's moved past the cr2 problem and on
to an invaild segment selector.  The 0x34 is suspiciously similar
to the 0x37 in gs, and sure enough, OS X forces gs to have
that value in the signal handler, and if your thread hasn't set
up that segment (known as USER_CTHREAD), you'll fault on the IRET
into the signal handler and never be able to handle a signal.

The kernel bug is that it forces segment 0x37 without making sure
it is a valid segment.  Leopard also forced 0x37 but had the courtesy
to set it up first.

Since OS X requires us to set up that segment (using the
thread_fast_set_cthread_self system call), we might as well
use it instead of the more complicated i386_set_ldt call to
set up our per-OS thread storage.

Also add some more zeros to bsdthread_register for new arguments
in Snow Leopard (apparently unnecessary, but being careful).

Fixes #510.

R=r
CC=golang-dev
https://golang.org/cl/824046
2010-04-08 13:24:37 -07:00
Charles L. Dorian
9aa8f95ba8 math: atan2 special cases (negative zero)
Added Signbit(), revised Copysign()

R=rsc
CC=golang-dev
https://golang.org/cl/822045
2010-04-08 13:24:04 -07:00
Russ Cox
24c58174b2 runtime: use explicit flag when finalizer goroutine is waiting
Avoids spurious wakeups during other sleeping by that goroutine.
Fixes #711.

R=r
CC=golang-dev
https://golang.org/cl/902041
2010-04-07 20:38:02 -07:00
Rob Pike
00eb56c15b gotest: update URL printed by failure message.
Fixes #677.

R=rsc
CC=golang-dev
https://golang.org/cl/834046
2010-04-07 20:30:55 -07:00
Joe Poirier
d37e87c1b2 gp_spec typo fix: code example in the "Handling panics" section
R=rsc, adg
CC=golang-dev
https://golang.org/cl/881047
2010-04-08 10:25:57 +10:00
Rob Pike
a3db32d2a6 Language FAQ: editing tweaks after iant.
R=iant
CC=golang-dev
https://golang.org/cl/874043
2010-04-07 16:13:14 -07:00
Rob Pike
956926ee31 Language FAQ: update the entry on exceptions.
R=rsc, iant
CC=golang-dev
https://golang.org/cl/824045
2010-04-07 16:03:12 -07:00
Russ Cox
065ebe8bd4 arm: fix build, attempt #2
TBR=kaib
CC=golang-dev
https://golang.org/cl/897041
2010-04-06 18:30:36 -07:00
Russ Cox
c819a0c72f arm: fix build, attempt #1
TBR=kaib
CC=golang-dev
https://golang.org/cl/883046
2010-04-06 17:56:48 -07:00
Ken Thompson
b57afc2f83 another try at clearing
channel recv data.

R=rsc
CC=golang-dev
https://golang.org/cl/896041
2010-04-06 17:33:43 -07:00
Ken Thompson
dec248c665 change channel read to clear
data just read from the channel.
this will make it easier to
recognize when to garbage
collect and finalize.

R=rsc
CC=golang-dev
https://golang.org/cl/882043
2010-04-06 16:58:52 -07:00
Russ Cox
caa149f73d net: use chan bool instead of chan *netFD to avoid cycle
The cycle is *netFD -> cw chanl *netFD in struct ->
same *netFD in channel read buffer.

Because channels are finalized, the cycle makes them
uncollectable.  A better fix is to make channels not
finalized anymore, and that will happen, but this is
an easy, reasonable workaround until then.

Another good fix would be to zero the channel receive
buffer entry after the receive.  That too will happen.

R=r
CC=golang-dev
https://golang.org/cl/875043
2010-04-06 16:50:27 -07:00
Rob Pike
6431b984db flags: better tests.
R=rsc
CC=golang-dev
https://golang.org/cl/864044
2010-04-06 16:46:52 -07:00
Russ Cox
88ce9ce40c runtime: two proc bug fixes
1. Fix bug in GOMAXPROCS when trying to cut number of procs
Race could happen on any system but was
manifesting only on Xen hosted Linux.

2. Fix recover on ARM, where FP != caller SP.

R=r
CC=golang-dev
https://golang.org/cl/880043
2010-04-06 13:48:31 -07:00
Roger Peppe
6c3befc824 Change goyacc to be reentrant.
Instead of calling the package scope Lex function,
Parse now takes an argument which is used to
do the lexing.
I reverted to having the generated switch
code inside Parse rather than a separate function because
the function needs 7 arguments or a context structure,
which seems unnecessary.
I used yyrun(), not the original $A so that
it's possible to run the backquoted code through gofmt.

R=rsc, ken2, ken3
CC=golang-dev
https://golang.org/cl/879041
2010-04-06 13:29:27 -07:00
Kai Backman
29c6c09f71 replace original float instruction with jump to make branches
to float instructions work correctly.

R=rsc
CC=golang-dev
https://golang.org/cl/870044
2010-04-06 22:17:24 +03:00