1
0
mirror of https://github.com/golang/go synced 2024-10-01 16:28:33 -06:00
Commit Graph

20803 Commits

Author SHA1 Message Date
Russ Cox
3511454e13 cmd/gc: fix 'make' in cmd/gc directory
Right now, go tool 6g -A fails complaining about 'any' type.

TBR=r
CC=golang-codereviews
https://golang.org/cl/156200044
2014-10-14 14:58:25 -04:00
Keith Randall
9dc6764d3c runtime: a few optimizations of scanblock.
Lowers gc pause time by 5-10% on test/bench/garbage

LGTM=rsc, dvyukov
R=rsc, dvyukov
CC=golang-codereviews
https://golang.org/cl/157810043
2014-10-14 09:22:47 -07:00
Adam Langley
64bed3f55f crypto/x509: continue to recognise MaxPathLen of zero as "no value".
In [1] the behaviour of encoding/asn1 with respect to marshaling
optional integers was changed. Previously, a zero valued integer would
be omitted when marshaling. After the change, if a default value was
set then the integer would only be omitted if it was the default value.

This changed the behaviour of crypto/x509 because
Certificate.MaxPathLen has a default value of -1 and thus zero valued
MaxPathLens would no longer be omitted when marshaling. This is
arguably a bug-fix -- a value of zero for MaxPathLen is valid and
meaningful and now could be expressed. However it broke users
(including Docker) who were not setting MaxPathLen at all.

This change again causes a zero-valued MaxPathLen to be omitted and
introduces a ZeroMathPathLen member that indicates that, yes, one
really does want a zero. This is ugly, but we value not breaking users.

[1] https://code.google.com/p/go/source/detail?r=4218b3544610e8d9771b89126553177e32687adf

LGTM=rsc
R=rsc
CC=golang-codereviews, golang-dev
https://golang.org/cl/153420045
2014-10-13 18:35:53 -07:00
Casey Marshall
7371153321 math/big: Fixes issue 8920
(*Rat).SetString checks for denominator.

LGTM=gri
R=golang-codereviews, gri
CC=golang-codereviews
https://golang.org/cl/159760043
2014-10-13 12:41:14 -07:00
Chris Manghane
d83e43ccc6 test: add test for gccgo-specific issue 8079
LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/159850044
2014-10-13 12:33:45 -07:00
David du Colombier
b9fc8d8cbd os: handle 'no parent' error as IsNotExist on Plan 9
This error is returned by lib9p when removing a file
without parent. It should fix TestRemoveAllRace
when running on ramfs.

LGTM=bradfitz, aram
R=rsc, bradfitz, aram
CC=golang-codereviews, mischief
https://golang.org/cl/153410044
2014-10-13 20:39:46 +02:00
Rob Pike
968153d063 net/rpc: fix mutex comment
Fixes #8086.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/153420044
2014-10-13 10:27:51 -07:00
Ian Lance Taylor
3cf9acccae reflect: generated unrolled GC bitmask directly
The code for a generated type is already generating an
unrolled GC bitmask.  Rather than unrolling the the source
type bitmasks and copying them, just generate the required
bitmask directly.  Don't mark it as an unrolled GC program,
since there is no need to do so.

Fixes #8917.

LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/156930044
2014-10-13 10:01:34 -07:00
Ian Lance Taylor
7c74850d76 go1.4: add note about change to bufio.SplitFunc at EOF
CC=golang-codereviews
https://golang.org/cl/159800044
2014-10-12 11:41:55 -07:00
Alex Brainman
d704bb0dc9 cmd/ld: do not assume that only pe section names start with '.'
Our current pe object reader assumes that every symbol starting with
'.' is section. It appeared to be true, until now gcc 4.9.1 generates
some symbols with '.' at the front. Change that logic to check other
symbol fields in addition to checking for '.'. I am not an expert
here, but it seems reasonable to me.

Added test, but it is only good, if tested with gcc 4.9.1. Otherwise
the test PASSes regardless.

Fixes #8811.
Fixes #8856.

LGTM=jfrederich, iant, stephen.gutekanst
R=golang-codereviews, jfrederich, stephen.gutekanst, iant
CC=alex.brainman, golang-codereviews
https://golang.org/cl/152410043
2014-10-11 22:01:04 +11:00
Alex Brainman
d0ee959ab7 cmd/ld: correct pe section names if longer then 8 chars
gcc 4.9.1 generates pe sections with names longer then 8 charters.

From IMAGE_SECTION_HEADER definition:

Name
An 8-byte, null-padded UTF-8 string. There is no terminating null character
if the string is exactly eight characters long. For longer names, this
member contains a forward slash (/) followed by an ASCII representation
of a decimal number that is an offset into the string table.

Our current pe object file reader does not read string table when section
names starts with /. Do that, so (issue 8811 example)

c:\go\path\src\isssue8811>go build
# isssue8811
isssue8811/glfw(.text): isssue8811/glfw(/76): not defined
isssue8811/glfw(.text): undefined: isssue8811/glfw(/76)

becomes

c:\go\path\src\isssue8811>go build
# isssue8811
isssue8811/glfw(.text): isssue8811/glfw(.rdata$.refptr._glfwInitialized): not defined
isssue8811/glfw(.text): undefined: isssue8811/glfw(.rdata$.refptr._glfwInitialized)

Small progress to

Update #8811

LGTM=iant, jfrederich
R=golang-codereviews, iant, jfrederich
CC=golang-codereviews
https://golang.org/cl/154210044
2014-10-11 21:34:10 +11:00
Shenghou Ma
8fe5ef4052 cmd/ld: fix off-by-one error when emitting symbol names
I diffed the output of `nm -n gofmt' before and after this change,
and verified that all changes are correct and all corrupted symbol
names are fixed.

Fixes #8906.

LGTM=iant, cookieo9
R=golang-codereviews, iant, cookieo9
CC=golang-codereviews
https://golang.org/cl/159750043
2014-10-10 20:30:24 -04:00
Alex Brainman
c689abd56c net: link skipped TestReadFromUDP to the issue
LGTM=minux
R=bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/154220043
2014-10-10 13:12:32 +11:00
Adam Langley
1fd042c9aa encoding/asn1: fix explicitly tagged Times.
https://golang.org/cl/153770043/ tried to fix the case where a
implicitly tagged Time, that happened to have the same tag as
GENERALIZEDTIME, shouldn't be parsed as a GENERALIZEDTIME.

It did so, mistakenly, by testing whether params.tag != nil. But
explicitly tagged values also have a non-nil tag and there the inner
tag actually does encode the type of the value.

This change instead tests whether the tag class is UNIVERSAL before
assuming that the tag contains type information.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/152380044
2014-10-09 17:37:40 -07:00
Alex Brainman
eeb2211a5b net: skip new TestReadFromUDP on nacl and plan9 (fixes build)
TBR=0intro
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/157820043
2014-10-10 09:46:41 +11:00
Ron Hashimoto
3114bd6f97 net: disable SIO_UDP_CONNRESET behavior on windows.
Fixes #5834.

LGTM=alex.brainman
R=golang-codereviews, bradfitz, alex.brainman, mikioh.mikioh, in60jp, iant
CC=golang-codereviews
https://golang.org/cl/149510043
2014-10-10 09:21:32 +11:00
Ian Lance Taylor
7abc8c4acc debug/elf: add comments explaining applyRelocations for amd64/arm64
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/155190043
2014-10-09 14:38:45 -07:00
Dmitriy Vyukov
f1c0899e6f runtime: add comment to mgc0.h
Missed that comment in CL 153990043.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/156010043
2014-10-09 17:05:38 +04:00
Brad Fitzpatrick
e3727df550 C: add Hana Kim (Google CLA)
LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews, iant
https://golang.org/cl/150690043
2014-10-09 15:00:23 +02:00
David du Colombier
9be9861c91 net/rpc: fix build
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/151620043
2014-10-09 11:21:21 +02:00
David du Colombier
e6295210b9 net/rpc: skip TestGobError on Plan 9
LGTM=bradfitz
R=rsc, bradfitz
CC=aram, golang-codereviews
https://golang.org/cl/154140043
2014-10-09 11:12:03 +02:00
Alex Brainman
64736accdb undo CL 145150043 / 8b3d26697b8d
That was complete failure - builders are broken,
but original cl worked fine on my system.
I will need access to builders
to test this change properly.

««« original CL description
runtime: handle all windows exception

Fixes #8006.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/145150043
»»»

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/154180043
2014-10-09 17:24:34 +11:00
Alex Brainman
17a108ba07 runtime: handle all windows exception
Fixes #8006.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/145150043
2014-10-09 16:52:28 +11:00
Alex Brainman
9ca8368444 misc/cgo/test: add Test8517
CL 145890044 did not provide test. Rectify that.

Update #8517

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/148790043
2014-10-09 16:10:51 +11:00
Keith Randall
b02450da02 runtime: zero a few more dead pointers.
In channels, zeroing of gp.waiting is missed on a closed channel panic.
m.morebuf.g is not zeroed.

I don't expect the latter causes any problems, but just in case.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/151610043
2014-10-08 17:22:34 -07:00
Ian Lance Taylor
060b24006a cmd/ld: don't add line number info for the final address of an FDE
This makes dwardump --verify happy.

Update #8846

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/150370043
2014-10-08 16:17:34 -07:00
Michael Hudson-Doyle
14cd40d912 reflect: add direct call tests to TestMakeFuncVariadic
TestMakeFuncVariadic only called the variadic function via Call and
CallSlice, not via a direct function call.

I thought these tests would fail under gccgo tip, but they don't.  Still seems worth having though.

LGTM=iant
R=golang-codereviews, gobot, iant
CC=golang-codereviews
https://golang.org/cl/152060043
2014-10-08 15:58:56 -07:00
Keith Randall
91e8554b8b runtime: delay freeing of shrunk stacks until gc is done.
This change prevents confusion in the garbage collector.
The collector wants to make sure that every pointer it finds
isn't junk.  Its criteria for junk is (among others) points
to a "free" span.

Because the stack shrinker modifies pointers in the heap,
there is a race condition between the GC scanner and the
shrinker.  The GC scanner can see old pointers (pointers to
freed stacks).  In particular this happens with SudoG.elem
pointers.

Normally this is not a problem, as pointers into stack spans
are ok.  But if the freed stack is the last one in its span,
the span is marked as "free" instead of "contains stacks".

This change makes sure that even if the GC scanner sees
an old pointer, the span into which it points is still
marked as "contains stacks", and thus the GC doesn't
complain about it.

This change will make the GC pause a tiny bit slower, as
the stack freeing now happens in serial with the mark pause.
We could delay the freeing until the mutators start back up,
but this is the simplest change for now.

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/158750043
2014-10-08 15:57:20 -07:00
Ian Lance Taylor
6920b2a1f9 reflect: add tests for variadic method calls
These tests fail when using gccgo.  In gccgo using Interface
on the value of a method function is implemented using a
variant of MakeFunc.  That approach did not correctly handle
variadic functions.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/151280043
2014-10-08 15:48:46 -07:00
Ian Lance Taylor
83367781f5 A+C: Ron Hashimoto (individual CLA)
Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/153240043
2014-10-08 07:10:04 -07:00
Dmitriy Vyukov
b8fdaaf028 runtime: faster GC scan
The change contains 3 spot optimizations to scan loop:
1. Don't use byte vars, use uintptr's instead.
This seems to alleviate some codegen issue,
and alone accounts to a half of speedup.
2. Remove bitmap cache. Currently we cache only 1 byte,
so caching is not particularly effective anyway.
Removal of the cache simplifies code and positively affects regalloc.
3. Replace BitsMultiword switch with if and
do debug checks only in Debug mode.
I've benchmarked changes separately and ensured that
each of them provides speedup on top of the previous one.
This change as a whole fixes the unintentional regressions
of scan loop that were introduced during development cycle.
Fixes #8625.
Fixes #8565.

On go.benchmarks/garbage benchmark:
GOMAXPROCS=1
time:		-3.13%
cputime:	-3.22%
gc-pause-one:	-15.71%
gc-pause-total:	-15.71%

GOMAXPROCS=32
time:		-1.96%
cputime:	-4.43%
gc-pause-one:	-6.22%
gc-pause-total:	-6.22%

LGTM=khr, rsc
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://golang.org/cl/153990043
2014-10-08 13:51:12 +04:00
Russ Cox
94bdf13497 runtime: clear Defer.fn before removing from the G.defer list
Should fix the remaining 'invalid heap pointer' build failures.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/152360043
2014-10-08 00:03:50 -04:00
Russ Cox
f950a14bb5 runtime: fix windows/amd64 build
Out of stack space due to new 2-word call in freedefer.
Go back to smaller function calls.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/152340043
2014-10-07 23:39:00 -04:00
Russ Cox
2b1659b57d runtime: change Windows M.thread from void* to uintptr
It appears to be an opaque bit pattern more than a pointer.
The Go garbage collector has discovered that for m0
it is set to 0x4c.

Should fix Windows build.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/149640043
2014-10-07 23:27:25 -04:00
Russ Cox
e6708ee9b1 runtime: clear Defer.panic before removing from G.defer list
Another dangling stack pointer in a cached structure.
Same as SudoG.elem and SudoG.selectdone.

Definitely a fix, and the new test in freedefer makes the
crash reproducible, but probably not a complete fix.
I have seen one dangling pointer in a Defer.panic even
after this fix; I cannot see where it could be coming from.

I think this will fix the solaris build.
I do not think this will fix the occasional failure on the darwin build.

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/155080043
2014-10-07 23:17:31 -04:00
Russ Cox
3492ee5d3a net/rpc: listen on localhost, let kernel pick port
This avoids a pop-up box on OS X and it avoids
a test failure if something is using 5555.
I apologize for not noticing this during the review.

TBR=r
CC=golang-codereviews
https://golang.org/cl/152320044
2014-10-07 23:08:07 -04:00
Andrew Gerrand
f3eece7492 doc: use "keyed" instead of "tagged" in Go 1 compatibility doc
LGTM=bradfitz, r
R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/156730043
2014-10-08 13:23:05 +11:00
Andrew Gerrand
fdc047fbe5 cmd/go: add ImportComment to Package struct
It seems reasonable that people might want to look up the
ImportComment with "go list".

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/143600043
2014-10-08 13:22:31 +11:00
Keith Randall
dcc4a674d8 runtime: zero pointer-looking scalararg values
I have a CL which at every gc looks through data and bss
sections for nonpointer data (according to gc maps) that
looks like a pointer.  These are potential missing roots.

The only thing it finds are begnign, storing stack pointers
into m0.scalararg[1] and never cleaning them up.  Let's
clean them up now so the test CL passes all.bash cleanly.

The test CL can't be checked in because we might store
pointer-looking things in nonpointer data by accident.

LGTM=iant
R=golang-codereviews, iant, khr
CC=golang-codereviews
https://golang.org/cl/153210043
2014-10-07 15:21:00 -07:00
Keith Randall
6ea3746adf runtime: update heap dump format for 1.4
We no longer have full type information in the heap, so
we can't dump that any more.  Instead we dump ptr/noptr
maps so at least we can compute graph connectivity.

In addition, we still dump Iface/Eface types so together
with dwarf type info we might be able to reconstruct
types of most things in the heap.

LGTM=dvyukov
R=golang-codereviews, dvyukov, rsc, khr
CC=golang-codereviews
https://golang.org/cl/155940043
2014-10-07 13:36:16 -07:00
Russ Cox
685204747d runtime: fix _cgo_allocate(0)
Fixes a SWIG bug reported off-list.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/155990043
2014-10-07 16:27:40 -04:00
Robert Griesemer
87f51f1031 math/big: fix doc comments
Fixes #8904.

TBR=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/148650043
2014-10-07 10:56:58 -07:00
Rob Pike
6ee36a9151 net/rpc: add test for issue 7689 (gob error should cause EOF)
Helpfully supplied by tommi.virtanen in issue 8173.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/151370043
2014-10-07 10:52:16 -07:00
Russ Cox
3147d2c4ee cmd/5c, cmd/6c, cmd/8c: make failure to optimize fatal
LGTM=bradfitz, dave, r
R=r, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/152250044
2014-10-07 12:07:40 -04:00
Russ Cox
8b7da4de48 cmd/gc: fix print format
Fixes 386 build.

TBR=r
CC=golang-codereviews
https://golang.org/cl/149620043
2014-10-07 12:03:48 -04:00
Russ Cox
11e53e46a6 runtime: crash if we see an invalid pointer into GC arena
This will help find bugs during the release freeze.
It's not clear it should be kept for the release itself.
That's issue 8861.

The most likely thing that would trigger this is stale
pointers that previously were ignored or caused memory
leaks. These were allowed due to the use of conservative
collection. Now that everything is precise, we should not
see them anymore.

The small number check reinforces what the stack copier
is already doing, catching the storage of integers in pointers.
It caught issue 8864.

The check is disabled if _cgo_allocate is linked into the binary,
which is to say if the binary is using SWIG to allocate untyped
Go memory. In that case, there are invalid pointers and there's
nothing we can do about it.

LGTM=rlh
R=golang-codereviews, dvyukov, rlh
CC=golang-codereviews, iant, khr, r
https://golang.org/cl/148470043
2014-10-07 11:07:18 -04:00
Russ Cox
7b2b8edee6 encoding/json: fix handling of null with ,string fields
Fixes #8587.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, iant, r
https://golang.org/cl/152270044
2014-10-07 11:07:04 -04:00
Russ Cox
18172c42ff runtime: remove type-punning for Type.gc[0], gc[1]
Depending on flags&KindGCProg,
gc[0] and gc[1] are either pointers or inlined bitmap bits.
That's not compatible with a precise garbage collector:
it needs to be always pointers or never pointers.

Change the inlined bitmap case to store a pointer to an
out-of-line bitmap in gc[0]. The out-of-line bitmaps are
dedup'ed, so that for example all pointer types share the
same out-of-line bitmap.

Fixes #8864.

LGTM=r
R=golang-codereviews, dvyukov, r
CC=golang-codereviews, iant, khr, rlh
https://golang.org/cl/155820043
2014-10-07 11:06:51 -04:00
Jens Frederich
f739b77508 net/http: fix authentication info leakage in Referer header (potential security risk)
http.Client calls URL.String() to fill in the Referer header, which may
contain authentication info. This patch removes authentication info from
the Referer header without introducing any API changes.

A new test for net/http is also provided.

This is the polished version of Alberto García Hierro's
https://golang.org/cl/9766046/

It should handle https Referer right.

Fixes #8417

LGTM=bradfitz
R=golang-codereviews, gobot, bradfitz, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/151430043
2014-10-07 07:13:42 -07:00
Brad Fitzpatrick
6e8f7b4f3e doc/go1.4.txt: useless change to tickle builders
Debugging the builders and need a commit to make them run.

R=adg
CC=golang-codereviews
https://golang.org/cl/149600043
2014-10-06 22:22:47 -07:00