]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoCONTRIBUTORS: add James Robinson (Google CLA)
Brad Fitzpatrick [Fri, 17 Oct 2014 14:39:42 +0000 (16:39 +0200)]
CONTRIBUTORS: add James Robinson (Google CLA)

LGTM=iant
R=golang-codereviews, iant
CC=dvyukov, golang-codereviews, jamesr, nigeltao
https://golang.org/cl/155530043

10 years agoundo CL 159990043 / 421fadcef39a
Russ Cox [Fri, 17 Oct 2014 14:11:03 +0000 (10:11 -0400)]
undo CL 159990043 / 421fadcef39a

Dmitriy believes this broke Windows.
It looks like build.golang.org stopped before that,
but it's worth a shot.

««« original CL description
runtime: make pprof a little nicer

Update #8942

This does not fully address issue 8942 but it does make
the profiles much more useful, until that issue can be
fixed completely.

LGTM=dvyukov
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/159990043
»»»

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/160030043

10 years agospec: define "variable"
Robert Griesemer [Thu, 16 Oct 2014 22:08:49 +0000 (15:08 -0700)]
spec: define "variable"

Fixes #8496.

LGTM=rsc, r, iant
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/148580043

10 years agoreflect: fix struct size calculation to include terminal padding
Damien Neil [Thu, 16 Oct 2014 20:58:32 +0000 (13:58 -0700)]
reflect: fix struct size calculation to include terminal padding

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/160920045

10 years agoCONTRIBUTORS: add Damien Neil
Damien Neil [Thu, 16 Oct 2014 20:55:32 +0000 (13:55 -0700)]
CONTRIBUTORS: add Damien Neil

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/159920044

10 years agosyscall: don't cache environment variables on Plan 9
David du Colombier [Thu, 16 Oct 2014 20:30:14 +0000 (22:30 +0200)]
syscall: don't cache environment variables on Plan 9

Fixes #8849.

LGTM=bradfitz, aram
R=bradfitz, rsc, aram
CC=golang-codereviews
https://golang.org/cl/158970045

10 years agoruntime/pprof: disable new memory test
Russ Cox [Thu, 16 Oct 2014 18:58:11 +0000 (14:58 -0400)]
runtime/pprof: disable new memory test

It cannot run 'go tool pprof'. There is no guarantee that's installed.
It needs to build a temporary pprof binary and run that.
It also needs to skip the test on systems that can't build and
run binaries, namely android and nacl.

See src/cmd/nm/nm_test.go's TestNM for a template.

Update #8867
Status: Accepted

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/153710043

10 years agoruntime: make pprof a little nicer
Russ Cox [Thu, 16 Oct 2014 18:44:55 +0000 (14:44 -0400)]
runtime: make pprof a little nicer

Update #8942

This does not fully address issue 8942 but it does make
the profiles much more useful, until that issue can be
fixed completely.

LGTM=dvyukov
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/159990043

10 years agoruntime: fix memory profiler
Dmitriy Vyukov [Thu, 16 Oct 2014 18:11:26 +0000 (22:11 +0400)]
runtime: fix memory profiler
There are 3 issues:
1. Skip argument of callers is off by 3,
so that all allocations are deep inside of memory profiler.
2. Memory profiling statistics are not updated after runtime.GC.
3. Testing package does not update memory profiling statistics
before capturing the profile.
Also add an end-to-end test.
Fixes #8867.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/148710043

10 years agocmd/gc: elide write barrier for x = x[0:y] and x = append(x, ...)
Russ Cox [Thu, 16 Oct 2014 16:43:17 +0000 (12:43 -0400)]
cmd/gc: elide write barrier for x = x[0:y] and x = append(x, ...)

Both of these forms can avoid writing to the base pointer in x
(in the slice, always, and in the append, most of the time).

For Go 1.5, will need to change the compilation of x = x[0:y]
to avoid writing to the base pointer, so that the elision is safe,
and will need to change the compilation of x = append(x, ...)
to write to the base pointer (through a barrier) only when
growing the underlying array, so that the general elision is safe.

For Go 1.4, elide the write barrier always, a change that should
have equivalent performance characteristics but is much
simpler and therefore safer.

benchmark                       old ns/op   new ns/op   delta
BenchmarkBinaryTree17           3910526122  3918802545  +0.21%
BenchmarkFannkuch11             3747650699  3732600693  -0.40%
BenchmarkFmtFprintfEmpty        106         98.7        -6.89%
BenchmarkFmtFprintfString       280         269         -3.93%
BenchmarkFmtFprintfInt          296         282         -4.73%
BenchmarkFmtFprintfIntInt       467         470         +0.64%
BenchmarkFmtFprintfPrefixedInt  418         398         -4.78%
BenchmarkFmtFprintfFloat        574         535         -6.79%
BenchmarkFmtManyArgs            1768        1818        +2.83%
BenchmarkGobDecode              14916799    14925182    +0.06%
BenchmarkGobEncode              14110076    13358298    -5.33%
BenchmarkGzip                   546609795   542630402   -0.73%
BenchmarkGunzip                 136270657   136496277   +0.17%
BenchmarkHTTPClientServer       126574      125245      -1.05%
BenchmarkJSONEncode             30006238    27862354    -7.14%
BenchmarkJSONDecode             106020889   102664600   -3.17%
BenchmarkMandelbrot200          5793550     5818320     +0.43%
BenchmarkGoParse                5437608     5463962     +0.48%
BenchmarkRegexpMatchEasy0_32    192         179         -6.77%
BenchmarkRegexpMatchEasy0_1K    462         460         -0.43%
BenchmarkRegexpMatchEasy1_32    168         153         -8.93%
BenchmarkRegexpMatchEasy1_1K    1420        1280        -9.86%
BenchmarkRegexpMatchMedium_32   338         286         -15.38%
BenchmarkRegexpMatchMedium_1K   107435      98027       -8.76%
BenchmarkRegexpMatchHard_32     5941        4846        -18.43%
BenchmarkRegexpMatchHard_1K     185965      153830      -17.28%
BenchmarkRevcomp                795497458   798447829   +0.37%
BenchmarkTemplate               132091559   134938425   +2.16%
BenchmarkTimeParse              604         608         +0.66%
BenchmarkTimeFormat             551         548         -0.54%

LGTM=r
R=r, dave
CC=golang-codereviews, iant, khr, rlh
https://golang.org/cl/159960043

10 years agocrypto/tls: support TLS_FALLBACK_SCSV as a server.
Adam Langley [Thu, 16 Oct 2014 00:54:04 +0000 (17:54 -0700)]
crypto/tls: support TLS_FALLBACK_SCSV as a server.

A new attack on CBC padding in SSLv3 was released yesterday[1]. Go only
supports SSLv3 as a server, not as a client. An easy fix is to change
the default minimum version to TLS 1.0 but that seems a little much
this late in the 1.4 process as it may break some things.

Thus this patch adds server support for TLS_FALLBACK_SCSV[2] -- a
mechanism for solving the fallback problem overall. Chrome has
implemented this since February and Google has urged others to do so in
light of yesterday's news.

With this change, clients can indicate that they are doing a fallback
connection and Go servers will be able to correctly reject them.

[1] http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
[2] https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/157090043

10 years agocmd/gc: simplify compiled code for explicit zeroing
Russ Cox [Wed, 15 Oct 2014 23:33:15 +0000 (19:33 -0400)]
cmd/gc: simplify compiled code for explicit zeroing

Among other things, *x = T{} does not need a write barrier.
The changes here avoid an unnecessary copy even when
no pointers are involved, so it may have larger effects.

In 6g and 8g, avoid manually repeated STOSQ in favor of
writing explicit MOVs, under the theory that the MOVs
should have fewer dependencies and pipeline better.

Benchmarks compare best of 5 on a 2012 MacBook Pro Core i5
with TurboBoost disabled. Most improvements can be explained
by the changes in this CL.

The effect in Revcomp is real but harder to explain: none of
the instructions in the inner loop changed. I suspect loop
alignment but really have no idea.

benchmark                       old         new         delta
BenchmarkBinaryTree17           3809027371  3819907076  +0.29%
BenchmarkFannkuch11             3607547556  3686983012  +2.20%
BenchmarkFmtFprintfEmpty        118         103         -12.71%
BenchmarkFmtFprintfString       289         277         -4.15%
BenchmarkFmtFprintfInt          304         290         -4.61%
BenchmarkFmtFprintfIntInt       507         458         -9.66%
BenchmarkFmtFprintfPrefixedInt  425         408         -4.00%
BenchmarkFmtFprintfFloat        555         555         +0.00%
BenchmarkFmtManyArgs            1835        1733        -5.56%
BenchmarkGobDecode              14738209    14639331    -0.67%
BenchmarkGobEncode              14239039    13703571    -3.76%
BenchmarkGzip                   538211054   538701315   +0.09%
BenchmarkGunzip                 135430877   134818459   -0.45%
BenchmarkHTTPClientServer       116488      116618      +0.11%
BenchmarkJSONEncode             28923406    29294334    +1.28%
BenchmarkJSONDecode             105779820   104289543   -1.41%
BenchmarkMandelbrot200          5791758     5771964     -0.34%
BenchmarkGoParse                5376642     5310943     -1.22%
BenchmarkRegexpMatchEasy0_32    195         190         -2.56%
BenchmarkRegexpMatchEasy0_1K    477         455         -4.61%
BenchmarkRegexpMatchEasy1_32    170         165         -2.94%
BenchmarkRegexpMatchEasy1_1K    1410        1394        -1.13%
BenchmarkRegexpMatchMedium_32   336         329         -2.08%
BenchmarkRegexpMatchMedium_1K   108979      106328      -2.43%
BenchmarkRegexpMatchHard_32     5854        5821        -0.56%
BenchmarkRegexpMatchHard_1K     185089      182838      -1.22%
BenchmarkRevcomp                834920364   780202624   -6.55%
BenchmarkTemplate               137046937   129728756   -5.34%
BenchmarkTimeParse              600         594         -1.00%
BenchmarkTimeFormat             559         539         -3.58%

LGTM=r
R=r
CC=golang-codereviews, iant, khr, rlh
https://golang.org/cl/157910047

10 years agounicode/utf8: fix docs for DecodeRune(empty) and friends.
Nigel Tao [Wed, 15 Oct 2014 22:13:50 +0000 (09:13 +1100)]
unicode/utf8: fix docs for DecodeRune(empty) and friends.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/157080043

10 years agocmd/go: add '_go_' suffix to go files compiled by gccgo to avoid naming conflicts
Chris Manghane [Wed, 15 Oct 2014 20:13:37 +0000 (13:13 -0700)]
cmd/go: add '_go_' suffix to go files compiled by gccgo to avoid naming conflicts

Fixes #8828.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/154410043

10 years agocmd/gc: do not copy via temporary for writebarrierfat{2,3,4}
Russ Cox [Wed, 15 Oct 2014 18:33:52 +0000 (14:33 -0400)]
cmd/gc: do not copy via temporary for writebarrierfat{2,3,4}

The general writebarrierfat needs a temporary for src,
because we need to pass the address of the temporary
to the writebarrierfat routine. But the new fixed-size
ones pass the value directly and don't need to introduce
the temporary.

Magnifies some of the effect of the custom write barrier change.

Comparing best of 5 with TurboBoost turned off,
on a 2012 Retina MacBook Pro Core i5.
Still not completely confident in these numbers,
but the fmt, regexp, and revcomp improvements seem real.

benchmark                      old ns/op  new ns/op  delta
BenchmarkBinaryTree17          3942965521 3929654940 -0.34%
BenchmarkFannkuch11            3707543350 3699566011 -0.22%
BenchmarkFmtFprintfEmpty       119        119        +0.00%
BenchmarkFmtFprintfString      295        296        +0.34%
BenchmarkFmtFprintfInt         313        314        +0.32%
BenchmarkFmtFprintfIntInt      517        484        -6.38%
BenchmarkFmtFprintfPrefixedInt 439        429        -2.28%
BenchmarkFmtFprintfFloat       571        569        -0.35%
BenchmarkFmtManyArgs           1899       1820       -4.16%
BenchmarkGobDecode             15507208   15325649   -1.17%
BenchmarkGobEncode             14811710   14715434   -0.65%
BenchmarkGzip                  561144467  549624323  -2.05%
BenchmarkGunzip                137377667  137691087  +0.23%
BenchmarkHTTPClientServer      126632     124717     -1.51%
BenchmarkJSONEncode            29944112   29526629   -1.39%
BenchmarkJSONDecode            108954913  107339551  -1.48%
BenchmarkMandelbrot200         5828755    5821659    -0.12%
BenchmarkGoParse               5577437    5521895    -1.00%
BenchmarkRegexpMatchEasy0_32   198        193        -2.53%
BenchmarkRegexpMatchEasy0_1K   486        469        -3.50%
BenchmarkRegexpMatchEasy1_32   175        167        -4.57%
BenchmarkRegexpMatchEasy1_1K   1450       1419       -2.14%
BenchmarkRegexpMatchMedium_32  344        338        -1.74%
BenchmarkRegexpMatchMedium_1K  112088     109855     -1.99%
BenchmarkRegexpMatchHard_32    6078       6003       -1.23%
BenchmarkRegexpMatchHard_1K    191166     187499     -1.92%
BenchmarkRevcomp               854870445  799012851  -6.53%
BenchmarkTemplate              141572691  141508105  -0.05%
BenchmarkTimeParse             604        603        -0.17%
BenchmarkTimeFormat            579        560        -3.28%

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/155450043

10 years agoreflect: shorten value to 3 words
Russ Cox [Wed, 15 Oct 2014 18:24:18 +0000 (14:24 -0400)]
reflect: shorten value to 3 words

scalar is no longer needed, now that
interfaces always hold pointers.

Comparing best of 5 with TurboBoost turned off,
on a 2012 Retina MacBook Pro Core i5.
Still not completely confident in these numbers,
but the gob and template improvements seem real.

benchmark                       old ns/op   new ns/op   delta
BenchmarkBinaryTree17           3819892491  3803008185  -0.44%
BenchmarkFannkuch11             3623876405  3611776426  -0.33%
BenchmarkFmtFprintfEmpty        119         118         -0.84%
BenchmarkFmtFprintfString       294         292         -0.68%
BenchmarkFmtFprintfInt          310         304         -1.94%
BenchmarkFmtFprintfIntInt       513         507         -1.17%
BenchmarkFmtFprintfPrefixedInt  427         426         -0.23%
BenchmarkFmtFprintfFloat        562         554         -1.42%
BenchmarkFmtManyArgs            1873        1832        -2.19%
BenchmarkGobDecode              15824504    14746565    -6.81%
BenchmarkGobEncode              14347378    14208743    -0.97%
BenchmarkGzip                   537229271   537973492   +0.14%
BenchmarkGunzip                 134996775   135406149   +0.30%
BenchmarkHTTPClientServer       119065      116937      -1.79%
BenchmarkJSONEncode             29134359    28928099    -0.71%
BenchmarkJSONDecode             106867289   105770161   -1.03%
BenchmarkMandelbrot200          5798475     5791433     -0.12%
BenchmarkGoParse                5299169     5379201     +1.51%
BenchmarkRegexpMatchEasy0_32    195         195         +0.00%
BenchmarkRegexpMatchEasy0_1K    477         477         +0.00%
BenchmarkRegexpMatchEasy1_32    170         170         +0.00%
BenchmarkRegexpMatchEasy1_1K    1412        1397        -1.06%
BenchmarkRegexpMatchMedium_32   336         337         +0.30%
BenchmarkRegexpMatchMedium_1K   109025      108977      -0.04%
BenchmarkRegexpMatchHard_32     5854        5856        +0.03%
BenchmarkRegexpMatchHard_1K     184914      184748      -0.09%
BenchmarkRevcomp                829233526   836598734   +0.89%
BenchmarkTemplate               142055312   137016166   -3.55%
BenchmarkTimeParse              598         597         -0.17%
BenchmarkTimeFormat             564         568         +0.71%

Fixes #7425.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant, khr
https://golang.org/cl/158890043

10 years agoreflect: add fast path for FieldByIndex with len(index) = 1
Russ Cox [Wed, 15 Oct 2014 17:33:00 +0000 (13:33 -0400)]
reflect: add fast path for FieldByIndex with len(index) = 1

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/152640043

10 years agoruntime: remove hand-generated ptr bitmaps for reflectcall
Russ Cox [Wed, 15 Oct 2014 17:12:16 +0000 (13:12 -0400)]
runtime: remove hand-generated ptr bitmaps for reflectcall

A Go prototype can be used instead now, and the compiler
will do a better job than we will doing it by hand.
(We got it wrong in amd64p32, causing the current build
breakage.)

The auto-prototype-matching only applies to functions
without an explicit package path, so the TEXT lines for
reflectcall and callXX are s/runtime·/·/.

LGTM=khr
R=khr
CC=golang-codereviews, iant, r
https://golang.org/cl/153600043

10 years agodatabase/sql: add Drivers, returning list of registered drivers
Russ Cox [Wed, 15 Oct 2014 17:10:14 +0000 (13:10 -0400)]
database/sql: add Drivers, returning list of registered drivers

Fixes #7969.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/158950043

10 years agoos/exec: document that Stdin goroutine must finish in Wait
Russ Cox [Wed, 15 Oct 2014 17:09:59 +0000 (13:09 -0400)]
os/exec: document that Stdin goroutine must finish in Wait

Fixes #7990.

LGTM=iant, bradfitz
R=bradfitz, iant, robryk
CC=golang-codereviews
https://golang.org/cl/156220043

10 years agocmd/gc: blank methods are not permitted in interface types
Chris Manghane [Wed, 15 Oct 2014 16:55:13 +0000 (09:55 -0700)]
cmd/gc: blank methods are not permitted in interface types

Fixes #6606.

LGTM=rsc
R=rsc
CC=golang-codereviews, gri
https://golang.org/cl/156210044

10 years agonet/http: don't send implicit gzip Accept-Encoding on Range requests
Brad Fitzpatrick [Wed, 15 Oct 2014 15:51:30 +0000 (17:51 +0200)]
net/http: don't send implicit gzip Accept-Encoding on Range requests

The http package by default adds "Accept-Encoding: gzip" to outgoing
requests, unless it's a bad idea, or the user requested otherwise.
Only when the http package adds its own implicit Accept-Encoding header
does the http package also transparently un-gzip the response.

If the user requested part of a document (e.g. bytes 40 to 50), it appears
that Github/Varnish send:
        range(gzip(content), 40, 50)

And not:
        gzip(range(content, 40, 50))

The RFC 2616 set of replacements (with the purpose of
clarifying ambiguities since 1999) has an RFC about Range
requests (http://tools.ietf.org/html/rfc7233) but does not
mention the interaction with encodings.

Regardless of whether range(gzip(content)) or gzip(range(content)) is
correct, this change prevents the Go package from asking for gzip
in requests if we're also asking for Range, avoiding the issue.
If the user cared, they can do it themselves. But Go transparently
un-gzipping a fragment of gzip is never useful.

Fixes #8923

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/155420044

10 years agonet/http: don't reuse a server connection after any Write errors
Brad Fitzpatrick [Wed, 15 Oct 2014 15:51:12 +0000 (17:51 +0200)]
net/http: don't reuse a server connection after any Write errors

Fixes #8534

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/149340044

10 years agocrypto/x509: correct field name in comment
Ian Lance Taylor [Wed, 15 Oct 2014 13:20:55 +0000 (06:20 -0700)]
crypto/x509: correct field name in comment

Fixes #8936.

LGTM=bradfitz
R=agl, bradfitz
CC=golang-codereviews
https://golang.org/cl/152590043

10 years agoliblink: require DATA lines to be ordered by offset, with no overlap
Russ Cox [Wed, 15 Oct 2014 03:25:12 +0000 (23:25 -0400)]
liblink: require DATA lines to be ordered by offset, with no overlap

The assembler could give a better error, but this one
is good enough for now.

Fixes #8880.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/153610043

10 years agogo/build: Return MultiplePackageError on importing a dir containing multiple packages
Jens Frederich [Wed, 15 Oct 2014 03:24:58 +0000 (23:24 -0400)]
go/build: Return MultiplePackageError on importing a dir containing multiple packages

When the Import function in go/build encounters a directory
without any buildable Go source files, it returns a handy
NoGoError. Now if, instead it encounters multiple Go source files
from multiple packages, it returns a handy MultiplePackageError.

A new test for NoGoError and MultiplePackageError is also provided.

Fixes #8286.

LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://golang.org/cl/155050043

10 years agocmd/gc, runtime: fix race, nacl for writebarrier changes
Russ Cox [Wed, 15 Oct 2014 03:24:32 +0000 (23:24 -0400)]
cmd/gc, runtime: fix race, nacl for writebarrier changes

The racewalk code was not updated for the new write barriers.
Make it more future-proof.

The new write barrier code assumed that +1 pointer would
be aligned properly for any type that might follow, but that's
not true on 32-bit systems where some types are 64-bit aligned.
The only system like that today is nacl/amd64p32.
Insert a dummy pointer so that the ambiguously typed
value is at +2 pointers, which is always max-aligned.

LGTM=r
R=r
CC=golang-codereviews, iant, khr
https://golang.org/cl/158890046

10 years agoencoding/gob: make encoding structs a little faster
Rob Pike [Wed, 15 Oct 2014 03:03:35 +0000 (20:03 -0700)]
encoding/gob: make encoding structs a little faster
FieldByIndex never returns an invalid Value, so the validity
test can be avoided if the field is not indirect.

BenchmarkGobEncode     12768642      12424022      -2.70%
BenchmarkGobEncode     60.11        61.78        1.03x

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/158890045

10 years agocmd/gc: check for initialization cycles in method values
Chris Manghane [Wed, 15 Oct 2014 02:12:10 +0000 (19:12 -0700)]
cmd/gc: check for initialization cycles in method values

Fixes #7960.

LGTM=rsc
R=rsc
CC=golang-codereviews, gri
https://golang.org/cl/159800045

10 years agoruntime: handle all windows exception (second attempt)
Alex Brainman [Wed, 15 Oct 2014 00:11:11 +0000 (11:11 +1100)]
runtime: handle all windows exception (second attempt)

includes undo of 22318cd31d7d and also:
- always use SetUnhandledExceptionFilter on windows-386;
- crash when receive EXCEPTION_BREAKPOINT in exception handler.

Fixes #8006.

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

10 years agomath/big: Allow non-prime modulus for ModInverse
Keith Randall [Tue, 14 Oct 2014 21:09:56 +0000 (14:09 -0700)]
math/big: Allow non-prime modulus for ModInverse

The inverse is defined whenever the element and the
modulus are relatively prime.  The code already handles
this situation, but the spec does not.

Test that it does indeed work.

Fixes #8875

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/155010043

10 years agocmd/gc: add 2-, 3-, 4-word write barrier specializations
Russ Cox [Tue, 14 Oct 2014 20:31:09 +0000 (16:31 -0400)]
cmd/gc: add 2-, 3-, 4-word write barrier specializations

Assignments of 2-, 3-, and 4-word values were handled
by individual MOV instructions (and for scalars still are).
But if there are pointers involved, those assignments now
go through the write barrier routine. Before this CL, they
went to writebarrierfat, which calls memmove.
Memmove is too much overhead for these small
amounts of data.

Instead, call writebarrierfat{2,3,4}, which are specialized
for the specific amount of data being copied.
Today the write barrier does not care which words are
pointers, so size alone is enough to distinguish the cases.
If we keep these distinctions in Go 1.5 we will need to
expand them for all the pointer-vs-scalar possibilities,
so the current 3 functions will become 3+7+15 = 25,
still not a large burden (we deleted more morestack
functions than that when we dropped segmented stacks).

BenchmarkBinaryTree17           3250972583  3123910344  -3.91%
BenchmarkFannkuch11             3067605223  2964737839  -3.35%
BenchmarkFmtFprintfEmpty        101         96.0        -4.95%
BenchmarkFmtFprintfString       267         235         -11.99%
BenchmarkFmtFprintfInt          261         253         -3.07%
BenchmarkFmtFprintfIntInt       444         402         -9.46%
BenchmarkFmtFprintfPrefixedInt  374         346         -7.49%
BenchmarkFmtFprintfFloat        472         449         -4.87%
BenchmarkFmtManyArgs            1537        1476        -3.97%
BenchmarkGobDecode              13986528    12432985    -11.11%
BenchmarkGobEncode              13120323    12537420    -4.44%
BenchmarkGzip                   451925758   437500578   -3.19%
BenchmarkGunzip                 113267612   110053644   -2.84%
BenchmarkHTTPClientServer       103151      77100       -25.26%
BenchmarkJSONEncode             25002733    23435278    -6.27%
BenchmarkJSONDecode             94213717    82568789    -12.36%
BenchmarkMandelbrot200          4804246     4713070     -1.90%
BenchmarkGoParse                4646114     4379456     -5.74%
BenchmarkRegexpMatchEasy0_32    163         158         -3.07%
BenchmarkRegexpMatchEasy0_1K    433         391         -9.70%
BenchmarkRegexpMatchEasy1_32    154         138         -10.39%
BenchmarkRegexpMatchEasy1_1K    1481        1132        -23.57%
BenchmarkRegexpMatchMedium_32   282         270         -4.26%
BenchmarkRegexpMatchMedium_1K   92421       86149       -6.79%
BenchmarkRegexpMatchHard_32     5209        4718        -9.43%
BenchmarkRegexpMatchHard_1K     158141      147921      -6.46%
BenchmarkRevcomp                699818791   642222464   -8.23%
BenchmarkTemplate               132402383   108269713   -18.23%
BenchmarkTimeParse              509         478         -6.09%
BenchmarkTimeFormat             462         456         -1.30%

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/156200043

10 years agocmd/gc: fix 'make' in cmd/gc directory
Russ Cox [Tue, 14 Oct 2014 18:58:25 +0000 (14:58 -0400)]
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

10 years agoruntime: a few optimizations of scanblock.
Keith Randall [Tue, 14 Oct 2014 16:22:47 +0000 (09:22 -0700)]
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

10 years agocrypto/x509: continue to recognise MaxPathLen of zero as "no value".
Adam Langley [Tue, 14 Oct 2014 01:35:53 +0000 (18:35 -0700)]
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

10 years agomath/big: Fixes issue 8920
Casey Marshall [Mon, 13 Oct 2014 19:41:14 +0000 (12:41 -0700)]
math/big: Fixes issue 8920

(*Rat).SetString checks for denominator.

LGTM=gri
R=golang-codereviews, gri
CC=golang-codereviews
https://golang.org/cl/159760043

10 years agotest: add test for gccgo-specific issue 8079
Chris Manghane [Mon, 13 Oct 2014 19:33:45 +0000 (12:33 -0700)]
test: add test for gccgo-specific issue 8079

LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/159850044

10 years agoos: handle 'no parent' error as IsNotExist on Plan 9
David du Colombier [Mon, 13 Oct 2014 18:39:46 +0000 (20:39 +0200)]
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

10 years agonet/rpc: fix mutex comment
Rob Pike [Mon, 13 Oct 2014 17:27:51 +0000 (10:27 -0700)]
net/rpc: fix mutex comment
Fixes #8086.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/153420044

10 years agoreflect: generated unrolled GC bitmask directly
Ian Lance Taylor [Mon, 13 Oct 2014 17:01:34 +0000 (10:01 -0700)]
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

10 years agogo1.4: add note about change to bufio.SplitFunc at EOF
Ian Lance Taylor [Sun, 12 Oct 2014 18:41:55 +0000 (11:41 -0700)]
go1.4: add note about change to bufio.SplitFunc at EOF

CC=golang-codereviews
https://golang.org/cl/159800044

10 years agocmd/ld: do not assume that only pe section names start with '.'
Alex Brainman [Sat, 11 Oct 2014 11:01:04 +0000 (22:01 +1100)]
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

10 years agocmd/ld: correct pe section names if longer then 8 chars
Alex Brainman [Sat, 11 Oct 2014 10:34:10 +0000 (21:34 +1100)]
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

10 years agocmd/ld: fix off-by-one error when emitting symbol names
Shenghou Ma [Sat, 11 Oct 2014 00:30:24 +0000 (20:30 -0400)]
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

10 years agonet: link skipped TestReadFromUDP to the issue
Alex Brainman [Fri, 10 Oct 2014 02:12:32 +0000 (13:12 +1100)]
net: link skipped TestReadFromUDP to the issue

LGTM=minux
R=bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/154220043

10 years agoencoding/asn1: fix explicitly tagged Times.
Adam Langley [Fri, 10 Oct 2014 00:37:40 +0000 (17:37 -0700)]
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

10 years agonet: skip new TestReadFromUDP on nacl and plan9 (fixes build)
Alex Brainman [Thu, 9 Oct 2014 22:46:41 +0000 (09:46 +1100)]
net: skip new TestReadFromUDP on nacl and plan9 (fixes build)

TBR=0intro
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/157820043

10 years agonet: disable SIO_UDP_CONNRESET behavior on windows.
Ron Hashimoto [Thu, 9 Oct 2014 22:21:32 +0000 (09:21 +1100)]
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

10 years agodebug/elf: add comments explaining applyRelocations for amd64/arm64
Ian Lance Taylor [Thu, 9 Oct 2014 21:38:45 +0000 (14:38 -0700)]
debug/elf: add comments explaining applyRelocations for amd64/arm64

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/155190043

10 years agoruntime: add comment to mgc0.h
Dmitriy Vyukov [Thu, 9 Oct 2014 13:05:38 +0000 (17:05 +0400)]
runtime: add comment to mgc0.h
Missed that comment in CL 153990043.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/156010043

10 years agoC: add Hana Kim (Google CLA)
Brad Fitzpatrick [Thu, 9 Oct 2014 13:00:23 +0000 (15:00 +0200)]
C: add Hana Kim (Google CLA)

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews, iant
https://golang.org/cl/150690043

10 years agonet/rpc: fix build
David du Colombier [Thu, 9 Oct 2014 09:21:21 +0000 (11:21 +0200)]
net/rpc: fix build

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/151620043

10 years agonet/rpc: skip TestGobError on Plan 9
David du Colombier [Thu, 9 Oct 2014 09:12:03 +0000 (11:12 +0200)]
net/rpc: skip TestGobError on Plan 9

LGTM=bradfitz
R=rsc, bradfitz
CC=aram, golang-codereviews
https://golang.org/cl/154140043

10 years agoundo CL 145150043 / 8b3d26697b8d
Alex Brainman [Thu, 9 Oct 2014 06:24:34 +0000 (17:24 +1100)]
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

10 years agoruntime: handle all windows exception
Alex Brainman [Thu, 9 Oct 2014 05:52:28 +0000 (16:52 +1100)]
runtime: handle all windows exception

Fixes #8006.

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

10 years agomisc/cgo/test: add Test8517
Alex Brainman [Thu, 9 Oct 2014 05:10:51 +0000 (16:10 +1100)]
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

10 years agoruntime: zero a few more dead pointers.
Keith Randall [Thu, 9 Oct 2014 00:22:34 +0000 (17:22 -0700)]
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

10 years agocmd/ld: don't add line number info for the final address of an FDE
Ian Lance Taylor [Wed, 8 Oct 2014 23:17:34 +0000 (16:17 -0700)]
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

10 years agoreflect: add direct call tests to TestMakeFuncVariadic
Michael Hudson-Doyle [Wed, 8 Oct 2014 22:58:56 +0000 (15:58 -0700)]
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

10 years agoruntime: delay freeing of shrunk stacks until gc is done.
Keith Randall [Wed, 8 Oct 2014 22:57:20 +0000 (15:57 -0700)]
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

10 years agoreflect: add tests for variadic method calls
Ian Lance Taylor [Wed, 8 Oct 2014 22:48:46 +0000 (15:48 -0700)]
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

10 years agoA+C: Ron Hashimoto (individual CLA)
Ian Lance Taylor [Wed, 8 Oct 2014 14:10:04 +0000 (07:10 -0700)]
A+C: Ron Hashimoto (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/153240043

10 years agoruntime: faster GC scan
Dmitriy Vyukov [Wed, 8 Oct 2014 09:51:12 +0000 (13:51 +0400)]
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

10 years agoruntime: clear Defer.fn before removing from the G.defer list
Russ Cox [Wed, 8 Oct 2014 04:03:50 +0000 (00:03 -0400)]
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

10 years agoruntime: fix windows/amd64 build
Russ Cox [Wed, 8 Oct 2014 03:39:00 +0000 (23:39 -0400)]
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

10 years agoruntime: change Windows M.thread from void* to uintptr
Russ Cox [Wed, 8 Oct 2014 03:27:25 +0000 (23:27 -0400)]
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

10 years agoruntime: clear Defer.panic before removing from G.defer list
Russ Cox [Wed, 8 Oct 2014 03:17:31 +0000 (23:17 -0400)]
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

10 years agonet/rpc: listen on localhost, let kernel pick port
Russ Cox [Wed, 8 Oct 2014 03:08:07 +0000 (23:08 -0400)]
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

10 years agodoc: use "keyed" instead of "tagged" in Go 1 compatibility doc
Andrew Gerrand [Wed, 8 Oct 2014 02:23:05 +0000 (13:23 +1100)]
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

10 years agocmd/go: add ImportComment to Package struct
Andrew Gerrand [Wed, 8 Oct 2014 02:22:31 +0000 (13:22 +1100)]
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

10 years agoruntime: zero pointer-looking scalararg values
Keith Randall [Tue, 7 Oct 2014 22:21:00 +0000 (15:21 -0700)]
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

10 years agoruntime: update heap dump format for 1.4
Keith Randall [Tue, 7 Oct 2014 20:36:16 +0000 (13:36 -0700)]
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

10 years agoruntime: fix _cgo_allocate(0)
Russ Cox [Tue, 7 Oct 2014 20:27:40 +0000 (16:27 -0400)]
runtime: fix _cgo_allocate(0)

Fixes a SWIG bug reported off-list.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/155990043

10 years agomath/big: fix doc comments
Robert Griesemer [Tue, 7 Oct 2014 17:56:58 +0000 (10:56 -0700)]
math/big: fix doc comments

Fixes #8904.

TBR=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/148650043

10 years agonet/rpc: add test for issue 7689 (gob error should cause EOF)
Rob Pike [Tue, 7 Oct 2014 17:52:16 +0000 (10:52 -0700)]
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

10 years agocmd/5c, cmd/6c, cmd/8c: make failure to optimize fatal
Russ Cox [Tue, 7 Oct 2014 16:07:40 +0000 (12:07 -0400)]
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

10 years agocmd/gc: fix print format
Russ Cox [Tue, 7 Oct 2014 16:03:48 +0000 (12:03 -0400)]
cmd/gc: fix print format

Fixes 386 build.

TBR=r
CC=golang-codereviews
https://golang.org/cl/149620043

10 years agoruntime: crash if we see an invalid pointer into GC arena
Russ Cox [Tue, 7 Oct 2014 15:07:18 +0000 (11:07 -0400)]
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

10 years agoencoding/json: fix handling of null with ,string fields
Russ Cox [Tue, 7 Oct 2014 15:07:04 +0000 (11:07 -0400)]
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

10 years agoruntime: remove type-punning for Type.gc[0], gc[1]
Russ Cox [Tue, 7 Oct 2014 15:06:51 +0000 (11:06 -0400)]
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

10 years agonet/http: fix authentication info leakage in Referer header (potential security risk)
Jens Frederich [Tue, 7 Oct 2014 14:13:42 +0000 (07:13 -0700)]
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

10 years agodoc/go1.4.txt: useless change to tickle builders
Brad Fitzpatrick [Tue, 7 Oct 2014 05:22:47 +0000 (22:22 -0700)]
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

10 years agocmd/ld: ignore .Linfo_stringNN variables in clang .o files
Russ Cox [Tue, 7 Oct 2014 00:51:05 +0000 (20:51 -0400)]
cmd/ld: ignore .Linfo_stringNN variables in clang .o files

http://build.golang.org/log/c7a91b6eac8f8daa2bd17801be273e58403a15f2

# cmd/pprof
/linux-386-clang-9115aad1dc4a/go/pkg/linux_386/net.a(_all.o): sym#16: ignoring .Linfo_string0 in section 16 (type 0)
/linux-386-clang-9115aad1dc4a/go/pkg/linux_386/net.a(_all.o): sym#17: ignoring .Linfo_string1 in section 16 (type 0)
/linux-386-clang-9115aad1dc4a/go/pkg/linux_386/net.a(_all.o): sym#18: ignoring .Linfo_string2 in section 16 (type 0)
/linux-386-clang-9115aad1dc4a/go/pkg/linux_386/net.a(_all.o): sym#20: ignoring .Linfo_string0 in section 16 (type 0)
/linux-386-clang-9115aad1dc4a/go/pkg/linux_386/net.a(_all.o): sym#21: ignoring .Linfo_string1 in section 16 (type 0)
...

I don't know what these are. Let's ignore them and see if we get any further.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/155030043

10 years agoos, syscall: test Chtimes on directories, fix on Windows
Russ Cox [Mon, 6 Oct 2014 23:22:48 +0000 (19:22 -0400)]
os, syscall: test Chtimes on directories, fix on Windows

Fixes #8090.

LGTM=alex.brainman
R=alex.brainman
CC=golang-codereviews
https://golang.org/cl/154020043

10 years agostrings: use fast path for IndexRune
Brad Fitzpatrick [Mon, 6 Oct 2014 22:10:51 +0000 (15:10 -0700)]
strings: use fast path for IndexRune

Noticed while reviewing https://golang.org/cl/147690043/

I'd never seen anybody use IndexRune before, and
unsurprisingly it doesn't use the other fast paths in the
strings/bytes packages. IndexByte uses assembly.

Also, less code this way.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/147700043

10 years agogo/build: update docs for GOOS.go change
Brad Fitzpatrick [Mon, 6 Oct 2014 22:08:31 +0000 (15:08 -0700)]
go/build: update docs for GOOS.go change

Forgotten in https://golang.org/cl/147690043/

Update #8838

LGTM=r
R=r
CC=golang-codereviews, rsc
https://golang.org/cl/152220045

10 years agodoc/go1.4.txt: GOOS suffixes require underscores to act as build tags
Rob Pike [Mon, 6 Oct 2014 21:58:59 +0000 (14:58 -0700)]
doc/go1.4.txt: GOOS suffixes require underscores to act as build tags

CC=golang-codereviews
https://golang.org/cl/151490043

10 years agogo/build: do not consider "android.go" to be android-specific
Rob Pike [Mon, 6 Oct 2014 21:50:58 +0000 (14:50 -0700)]
go/build: do not consider "android.go" to be android-specific
A file name must have a non-empty underscore-separated
prefix before its suffix matches GOOS. This is what the
documentation already said but is not what the code did.

Fixes #8838.

This needs to be called out in the release notes.
The he single affected file
        code.google.com/p/go.text/collate/tools/colcmp/darwin.go
could use a renaming but works because it has a build tag inside.

LGTM=adg, rsc
R=golang-codereviews, adg, rsc
CC=golang-codereviews
https://golang.org/cl/147690043

10 years agocmd/gc: prohibit short variable declarations containing duplicate symbols
Evan Kroske [Mon, 6 Oct 2014 21:16:39 +0000 (17:16 -0400)]
cmd/gc: prohibit short variable declarations containing duplicate symbols

Fixes #6764.
Fixes #8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046

10 years agoos: recomment MkdirAll
Russ Cox [Mon, 6 Oct 2014 19:49:33 +0000 (15:49 -0400)]
os: recomment MkdirAll

The internal comments are not completely precise about
what is going on, and they are causing confusion.

Fixes #8283.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/151460043

10 years agoos: make Process.Signal 'process finished' error consistent on Unix
Russ Cox [Mon, 6 Oct 2014 19:49:19 +0000 (15:49 -0400)]
os: make Process.Signal 'process finished' error consistent on Unix

While we're here, fix the implementation of Release on both
Unix and Windows: Release is supposed to make Signal an error.

While we're here, make sure we never Signal pid 0.
(Don't try this at home.)

Fixes #7658.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152240043

10 years agonet/url: document result of String
Russ Cox [Mon, 6 Oct 2014 19:49:07 +0000 (15:49 -0400)]
net/url: document result of String

Fixes #8742.

LGTM=bradfitz
R=golang-codereviews
CC=adg, bradfitz, golang-codereviews, iant
https://golang.org/cl/155910043

10 years agoencoding/json: document that embedded interfaces look like non-embedded ones
Russ Cox [Mon, 6 Oct 2014 19:48:17 +0000 (15:48 -0400)]
encoding/json: document that embedded interfaces look like non-embedded ones

Fixes #8386.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/149570043

10 years agoregexp/syntax: regenerate doc.go from re2 syntax
Russ Cox [Mon, 6 Oct 2014 19:32:11 +0000 (15:32 -0400)]
regexp/syntax: regenerate doc.go from re2 syntax

Generated using re2/doc/mksyntaxgo.

Fixes #8505.

LGTM=iant
R=r, iant
CC=golang-codereviews
https://golang.org/cl/155890043

10 years agocmd/go: fix 'go vet' of package with external tests
Russ Cox [Mon, 6 Oct 2014 18:49:22 +0000 (14:49 -0400)]
cmd/go: fix 'go vet' of package with external tests

For example, fixes 'go vet syscall', which has source
files in package syscall_test.

Fixes #8511.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152220044

10 years agoruntime: update docs, code for SetFinalizer
Russ Cox [Mon, 6 Oct 2014 18:18:09 +0000 (14:18 -0400)]
runtime: update docs, code for SetFinalizer

At last minute before 1.3 we relaxed SetFinalizer to avoid
crashes when you pass the result of a global alloc to it.
This avoids the crash but makes SetFinalizer a bit too relaxed.

Document that the finalizer of a global allocation may not run.

Tighten the SetFinalizer check to ignore a global allocation but
not ignore everything else.

Fixes #7656.

LGTM=r, iant
R=golang-codereviews, iant, r
CC=dvyukov, golang-codereviews, khr, rlh
https://golang.org/cl/145930043

10 years agocmd/8l: accept R_386_GOT32 in push instruction
Russ Cox [Mon, 6 Oct 2014 18:17:48 +0000 (14:17 -0400)]
cmd/8l: accept R_386_GOT32 in push instruction

Fixes #8382.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/149540045

10 years agoA+C: Jens Frederich (individual CLA)
Brad Fitzpatrick [Mon, 6 Oct 2014 17:41:24 +0000 (10:41 -0700)]
A+C: Jens Frederich (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/151450043

10 years agonet: disable TestDualStackUDPListener in short mode
Russ Cox [Mon, 6 Oct 2014 17:09:14 +0000 (13:09 -0400)]
net: disable TestDualStackUDPListener in short mode

This test is flaky, just like TestDualStackTCPListener.
That one was disabled. Disable this one too.

Update #5001

LGTM=bradfitz
R=rlh, bradfitz
CC=golang-codereviews
https://golang.org/cl/154950043

10 years agosyscall: another attempt to keep windows syscall pointers live
Alex Brainman [Sun, 5 Oct 2014 02:15:13 +0000 (13:15 +1100)]
syscall: another attempt to keep windows syscall pointers live

This approach was suggested in
https://golang.org/cl/138250043/#msg15.
Unlike current version of mksyscall_windows.go,
new code could be used in go.sys and other external
repos without help from asm.

LGTM=iant
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/143160046