]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
8 years ago[release-branch.go1.5] go1.5 go1.5
Russ Cox [Wed, 19 Aug 2015 04:59:12 +0000 (00:59 -0400)]
[release-branch.go1.5] go1.5

This updates the VERSION file.
The release proper has not happened yet.

Change-Id: I3e33b5f95aede0da8ca1aef0d9c381942873c9a8
Reviewed-on: https://go-review.googlesource.com/13702
Reviewed-by: Rob Pike <r@golang.org>
8 years ago[release-branch.go1.5] release: merge master branch into release-branch.go1.5.
Russ Cox [Wed, 19 Aug 2015 04:37:55 +0000 (00:37 -0400)]
[release-branch.go1.5] release: merge master branch into release-branch.go1.5.

Using merge instead of cherry-picks to simplify initial release.
Minor releases like Go 1.5.1 will have to use cherry-picks.

Fixes #12093.

Change-Id: If00393c58ace0da6f359b387cea9b779b123b920

8 years agodoc: document Go 1.5 on release page
Russ Cox [Wed, 19 Aug 2015 03:55:28 +0000 (23:55 -0400)]
doc: document Go 1.5 on release page

This makes sure the release page in the release will mention the release.

Fixes #12102.

Change-Id: I36befd7dba7ba9e70ae3335e21c8841179ac4eff
Reviewed-on: https://go-review.googlesource.com/13490
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet: respect go vs cgo resolver selection in all lookup routines
Russ Cox [Wed, 19 Aug 2015 02:50:12 +0000 (22:50 -0400)]
net: respect go vs cgo resolver selection in all lookup routines

This is especially important for LookupAddr, which used to be pure Go
(lightweight, one goroutine per call) and without this CL is now
unconditionally cgo (heavy, one thread per call).

Fixes #12190.

Change-Id: I43436a942bc1838b024225893e156f280a1e80cf
Reviewed-on: https://go-review.googlesource.com/13698
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: force LookupAddr results to be rooted DNS paths when using cgo
Russ Cox [Wed, 19 Aug 2015 02:19:58 +0000 (22:19 -0400)]
net: force LookupAddr results to be rooted DNS paths when using cgo

Go 1.4 and before have always returned DNS names with a trailing dot
for reverse lookups, as they do for basically all other routines returning
DNS names. Go 1.4 and before always implemented LookupAddr using
pure Go (not C library calls).

Go 1.5 added the ability to make a C library call to implement LookupAddr.
Unfortunately the C library call returns a DNS name without a trailing dot
(an unrooted name), meaning that if turn off cgo during make.bash then
you still get the rooted name but with cgo on you get an unrooted name.
The unrooted name is inconsistent with the pure Go implementation
and with all previous Go releases, so change it to a rooted name.

Fixes #12189.

Change-Id: I3d6b72277c121fe085ea6af30e5fe8019fc490ad
Reviewed-on: https://go-review.googlesource.com/13697
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet: document GODEBUG=netdns=xxx settings
Russ Cox [Wed, 19 Aug 2015 03:19:41 +0000 (23:19 -0400)]
net: document GODEBUG=netdns=xxx settings

Fixes #12191.

Change-Id: I5c7659ccb0566dad3613041d9e76be87ceacae61
Reviewed-on: https://go-review.googlesource.com/13700
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: fix typos in go1.5.html
Rob Pike [Wed, 19 Aug 2015 03:44:33 +0000 (13:44 +1000)]
doc: fix typos in go1.5.html

Thanks to Nathan Youngman for spotting them.

Change-Id: I1856527af66a5d1965265ec3dcd639d3f6d74bcc
Reviewed-on: https://go-review.googlesource.com/13711
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodoc/go1.5.html: refer to ppc64 as 64-bit PowerPC, not Power 64
Russ Cox [Tue, 18 Aug 2015 01:32:40 +0000 (21:32 -0400)]
doc/go1.5.html: refer to ppc64 as 64-bit PowerPC, not Power 64

Saying "Power 64" was wrong for reasons I don't remember.
(Those reasons are why we stopped using GOARCH=power64.)

Change-Id: Ifaac78d5733bfc780df01b1a66da766af0b17726
Reviewed-on: https://go-review.googlesource.com/13675
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: adjust binary install page supported system list
Russ Cox [Tue, 18 Aug 2015 15:15:15 +0000 (11:15 -0400)]
doc: adjust binary install page supported system list

Make clear that this list is the list of supported systems
for binary distributions, and that other systems may be
able to build the distribution from source, in addition
to using gccgo.

Drop freebsd/arm from the list on this page.
We have never issued a binary distribution for freebsd/arm,
and we're not going to start in Go 1.5, since we don't even
have a working builder for it.

Drop freebsd/386 from the list on the page,
because we are unable to build binary distributions, per adg.

I think the wording here should probably be revised further,
but not now.

Change-Id: Ib43b6b64f5c438bfb9aa4d3daa43393f1e33b71f
Reviewed-on: https://go-review.googlesource.com/13690
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/vet: power64 is now ppc64
Russ Cox [Tue, 18 Aug 2015 13:58:24 +0000 (09:58 -0400)]
cmd/vet: power64 is now ppc64

This was missed when we did the rename months ago
because cmd/vet did not live in the main tree.
Now vet's asmdecl checks will apply to ppc64 assembly too.

Change-Id: I687cba89fef702f29dd118de76a7ca1041c414f6
Reviewed-on: https://go-review.googlesource.com/13677
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: really skip TestNoteReading on linux/ppc64le
Russ Cox [Tue, 18 Aug 2015 15:40:59 +0000 (11:40 -0400)]
cmd/go: really skip TestNoteReading on linux/ppc64le

Change-Id: Iaeba7c55bbb9e11ac30f3b61369aa597acc30190
Reviewed-on: https://go-review.googlesource.com/13691
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: disable TestNoteReading on solaris, linux/ppc64le
Russ Cox [Tue, 18 Aug 2015 14:59:30 +0000 (10:59 -0400)]
cmd/go: disable TestNoteReading on solaris, linux/ppc64le

Update #11184 (linux/ppc64).
Filed #12178 (solaris) for Go 1.6.

Change-Id: I9e3a456aaccb49590ad4e14b53ddfefca5b0801c
Reviewed-on: https://go-review.googlesource.com/13679
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile: fix interaction between GOEXPERIMENT=fieldtrack and race detector
Russ Cox [Tue, 18 Aug 2015 01:38:46 +0000 (21:38 -0400)]
cmd/compile: fix interaction between GOEXPERIMENT=fieldtrack and race detector

Tested by hand.
Only lines of code changing are protected by Fieldtrack_enabled > 0,
which is never true in standard Go distributions.

Fixes #12171.

Change-Id: I963b9997dac10829db8ad4bfc97a7d6bf14b55c6
Reviewed-on: https://go-review.googlesource.com/13676
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: fix vendor-related index out of range panic on bad file tree
Russ Cox [Tue, 18 Aug 2015 01:26:45 +0000 (21:26 -0400)]
cmd/go: fix vendor-related index out of range panic on bad file tree

Fixes #12156.

Change-Id: I2d71163b98bcc770147eb9e78dc551a9d0b5b817
Reviewed-on: https://go-review.googlesource.com/13674
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: fix spurious rebuild of binaries using cgo on OS X
Russ Cox [Tue, 18 Aug 2015 00:47:29 +0000 (20:47 -0400)]
cmd/go: fix spurious rebuild of binaries using cgo on OS X

The text segment starts farther into the binary when using
external linking on the mac. Test and fix.

Fixes #12173.

Change-Id: I1f0c81814bf70cd9decfceac3022784f4608eeef
Reviewed-on: https://go-review.googlesource.com/13672
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/yacc: fix compile error in empty grammar
Russ Cox [Tue, 18 Aug 2015 00:54:05 +0000 (20:54 -0400)]
cmd/yacc: fix compile error in empty grammar

Fixes #12154.

Change-Id: I1e6d1a3479a8a6fc8f53aebd18fb142506110809
Reviewed-on: https://go-review.googlesource.com/13673
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet/http: fix races cloning TLS config
Brad Fitzpatrick [Tue, 11 Aug 2015 20:22:57 +0000 (23:22 +0300)]
net/http: fix races cloning TLS config

Found in a Google program running under the race detector.
No test, but verified that this fixes the race with go run -race of:

package main

import (
        "crypto/tls"
        "fmt"
        "net"
        "net/http"
        "net/http/httptest"
)

func main() {
        for {
                ts := httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {}))
                conf := &tls.Config{} // non-nil
                a, b := net.Pipe()
                go func() {
                        sconn := tls.Server(a, conf)
                        sconn.Handshake()
                }()
                tr := &http.Transport{
                        TLSClientConfig: conf,
                }
                req, _ := http.NewRequest("GET", ts.URL, nil)
                _, err := tr.RoundTrip(req)
                println(fmt.Sprint(err))
                a.Close()
                b.Close()
                ts.Close()
        }
}

Also modified cmd/vet to report the copy-of-mutex bug statically
in CL 13646, and fixed two other instances in the code found by vet.
But vet could not have told us about cloneTLSConfig vs cloneTLSClientConfig.

Confirmed that original report is also fixed by this.

Fixes #12099.

Change-Id: Iba0171549e01852a5ec3438c25a1951c98524dec
Reviewed-on: https://go-review.googlesource.com/13453
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

8 years agodoc: only the Logger.SetOutput method is new in Go 1.5
Ian Lance Taylor [Sun, 16 Aug 2015 19:20:31 +0000 (12:20 -0700)]
doc: only the Logger.SetOutput method is new in Go 1.5

The SetOutput function has been there since Go 1.

Fixes #12162.

Change-Id: I66210374877581e42689f9943532141659a55ca7
Reviewed-on: https://go-review.googlesource.com/13637
Reviewed-by: Rob Pike <r@golang.org>
8 years agosort: Fix typo in Stable() comment
Matt Bostock [Sun, 16 Aug 2015 21:10:45 +0000 (22:10 +0100)]
sort: Fix typo in Stable() comment

Correct 'an' to 'on' in the comment above the Stable() function.

Change-Id: I714e38b2d3a79dfd539d5368967d1c6b519cb948
Reviewed-on: https://go-review.googlesource.com/13662
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile/internal/arm64: remove Reginuse check in clearfat
Dave Cheney [Sat, 15 Aug 2015 05:25:46 +0000 (15:25 +1000)]
cmd/compile/internal/arm64: remove Reginuse check in clearfat

Fixes golang/go#12133

CL 13630 fixed the use of a stale reg[] array in the various arch
backends which was causing the check in clearfat to pass
unconditionally on arm64.

With this check fixed, arm64 now considers REGRT1 to always be in use
as it is part of the reserved register set, see arm64/gsubr.go.

However, ppc64 does not consider REGRT1 and REGRT2 to be part of its
reserved set, so its identical clearfat check passes.

This CL removes the Reginuse check inside clearfat as REGRT1 is
guarenteed always be free on arm64.

Change-Id: I4719150d3c3378fae155b863c474529df18d4c17
Reviewed-on: https://go-review.googlesource.com/13650
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/trace: fix static file reference
Dmitry Vyukov [Wed, 12 Aug 2015 19:26:25 +0000 (21:26 +0200)]
cmd/trace: fix static file reference

Use runtime.GOROOT instead of os.Getenv("GOROOT") to reference
trace-viewer html file. GOROOT env var is not necessary set,
runtime.GOROOT has a default value for such case.

Change-Id: I906a720f6822915bd9575756e6cbf6d622857c2b
Reviewed-on: https://go-review.googlesource.com/13593
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: make "go test" recognize -exec flag again.
Rahul Chaudhry [Thu, 13 Aug 2015 22:39:43 +0000 (15:39 -0700)]
cmd/go: make "go test" recognize -exec flag again.

Fixes #12144.

Change-Id: I112c6517371215c9797db8f1dffca0f3047c39e3
Reviewed-on: https://go-review.googlesource.com/13633
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile: remove stale register use array
Keith Randall [Thu, 13 Aug 2015 19:25:19 +0000 (12:25 -0700)]
cmd/compile: remove stale register use array

The reg[] array in .../gc is where truth lies.  The copy in .../ARCH
is incorrect as it is mostly not updated to reflect regalloc decisions.

This bug was introduced in the rewrite
https://go-review.googlesource.com/#/c/7853/.  The new reg[] array was
introduced in .../gc but not all of the uses were removed in the
.../ARCH directories.

Fixes #12133

Change-Id: I6364fc403cdab92d802d17f2913ba1607734037c
Reviewed-on: https://go-review.googlesource.com/13630
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile/internal/ppc64: disable DUFFZERO
Dave Cheney [Tue, 11 Aug 2015 21:55:01 +0000 (07:55 +1000)]
cmd/compile/internal/ppc64: disable DUFFZERO

Update #12108

If DUFFZERO is used within a tail call method it will overwrite the
link register.

Change-Id: I6abd2fde0f0ad909ccd55eb119b992673a74f0e2
Reviewed-on: https://go-review.googlesource.com/13570
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: run test binaries in original environment
Russ Cox [Tue, 11 Aug 2015 14:35:30 +0000 (10:35 -0400)]
cmd/go: run test binaries in original environment

Fixes #12096.
Followup to CL 12483, which fixed #11709 and #11449.

Change-Id: I9031ea36cc60685f4d6f65c39f770c89b3e3395a
Reviewed-on: https://go-review.googlesource.com/13449
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: fix addition of "math" dependency for arm binaries
Russ Cox [Tue, 11 Aug 2015 14:33:25 +0000 (10:33 -0400)]
cmd/go: fix addition of "math" dependency for arm binaries

p.ImportPath is the directory-derived path (like cmd/go).
p.Name is the actual package name.

Fixes #12089.

Change-Id: Ief76d42a85f811b0dfe2218affb48551527a7d44
Reviewed-on: https://go-review.googlesource.com/13530
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agocmd/link: make -a output not crash
Russ Cox [Tue, 11 Aug 2015 14:59:24 +0000 (10:59 -0400)]
cmd/link: make -a output not crash

Fixes #12107.

Change-Id: I62f1b6ac9fb6f2cfa3472253dc1c6f7b7d2a6faf
Reviewed-on: https://go-review.googlesource.com/13448
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agonet/mail: fix build.
David Symonds [Tue, 11 Aug 2015 06:36:40 +0000 (16:36 +1000)]
net/mail: fix build.

Change-Id: I8f5c72c6c0db015c06d564523bab35d97d934578
Reviewed-on: https://go-review.googlesource.com/13510
Reviewed-by: Michael McGreevy <mcgreevy@golang.org>
Reviewed-by: David Symonds <dsymonds@golang.org>
8 years agonet/mail: avoid panic in (*Address).String for malformed addresses.
David Symonds [Tue, 11 Aug 2015 05:05:12 +0000 (15:05 +1000)]
net/mail: avoid panic in (*Address).String for malformed addresses.

Fixes #12098.

Change-Id: I190586484cd34856dccfafaba60eff0197c7dc20
Reviewed-on: https://go-review.googlesource.com/13500
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/yacc: use %q to print strings in Toknames
Rob Pike [Mon, 10 Aug 2015 05:17:18 +0000 (15:17 +1000)]
cmd/yacc: use %q to print strings in Toknames

Fixes #12086

Belongs in 1.5

There remains a question of why the Statenames table's elements
are not printed. What purpose does that serve?

Change-Id: I83fd57b81d5e5065c3397a66ed457fc0d1c041bd
Reviewed-on: https://go-review.googlesource.com/13462
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agodoc: link to Go 1.5 release notes from "project" page
Andrew Gerrand [Mon, 10 Aug 2015 23:30:20 +0000 (23:30 +0000)]
doc: link to Go 1.5 release notes from "project" page

Update issue #12102.

Change-Id: I9cafb284a848cc053bc7e5479c53ebf889b6d4d9
Reviewed-on: https://go-review.googlesource.com/13480
Reviewed-by: Rob Pike <r@golang.org>
8 years agofmt: don't unread eof scanning %x
Rob Pike [Mon, 10 Aug 2015 03:21:28 +0000 (13:21 +1000)]
fmt: don't unread eof scanning %x

When scanning a hex byte at EOF, the code was ungetting the eof,
which backed up the input and caused double-scanning of a byte.

Delete the call to UnreadRune.

This line appeared in 1.5 for some reason; it was not in 1.4 and
should be removed again for 1.5

Fixes #12090.

Change-Id: Iad1ce8e7db8ec26615c5271310f4b0228cca7d78
Reviewed-on: https://go-review.googlesource.com/13461
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodoc: NaCl requires pepper 41
Dave Cheney [Fri, 7 Aug 2015 00:52:18 +0000 (10:52 +1000)]
doc: NaCl requires pepper 41

Fixes #12062
Updates #11961

The sRPC nameservice was removed in pepper 42. For Go 1.5 stipulate
that NaCl requires pepper 41 only.

Change-Id: Ic88ba342d41f673391efaa96fb581712fa10a0fd
Reviewed-on: https://go-review.googlesource.com/13341
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoruntime: make sure heapBitsBulkBarrier cannot be preempted
Russ Cox [Fri, 7 Aug 2015 17:34:56 +0000 (13:34 -0400)]
runtime: make sure heapBitsBulkBarrier cannot be preempted

Changes the torture test in #12068 from failing about 1/10 times
to not failing in almost 2,000 runs.

This was only happening in -race mode because functions are
bigger in -race mode, so a few of the helpers for heapBitsBulkBarrier
were not being inlined, and they were not marked nosplit,
so (only in -race mode) the write barrier was being preempted by GC,
causing missed pointer updates.

Filed issue #12069 for diagnosis of any other similar errors.

Fixes #12068.

Change-Id: Ic174d9b050ba278b18b08ab0d85a73c33bd5b175
Reviewed-on: https://go-review.googlesource.com/13364
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime: run on GOARM=5 and GOARM=6 uniprocessor freebsd/arm systems
Russ Cox [Fri, 7 Aug 2015 15:48:52 +0000 (11:48 -0400)]
runtime: run on GOARM=5 and GOARM=6 uniprocessor freebsd/arm systems

Also, crash early on non-Linux SMP ARM systems when GOARM < 7;
without the proper synchronization, SMP cannot work.

Linux is okay because we call kernel-provided routines for
synchronization and barriers, and the kernel takes care of
providing the right routines for the current system.
On non-Linux systems we are left to fend for ourselves.

It is possible to use different synchronization on GOARM=6,
but it's too late to do that in the Go 1.5 cycle.
We don't believe there are any non-Linux SMP GOARM=6 systems anyway.

Fixes #12067.

Change-Id: I771a556e47893ed540ec2cd33d23c06720157ea3
Reviewed-on: https://go-review.googlesource.com/13363
Reviewed-by: Austin Clements <austin@google.com>
8 years agocmd/go: replace code.google.com examples in docs with relevant repos
Andrew Gerrand [Fri, 7 Aug 2015 03:40:04 +0000 (13:40 +1000)]
cmd/go: replace code.google.com examples in docs with relevant repos

Change-Id: I625c9df161da2febdca85741c75fc32d4bef420b
Reviewed-on: https://go-review.googlesource.com/13344
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: tweak phrasing in Go 1.5 release notes
Andrew Gerrand [Fri, 7 Aug 2015 04:16:43 +0000 (04:16 +0000)]
doc: tweak phrasing in Go 1.5 release notes

Change-Id: I6bea045bb1cef15e6d9d3b4e6e6b4ae91f7bb941
Reviewed-on: https://go-review.googlesource.com/13345
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: do not call WaitGroup a function
Russ Cox [Thu, 6 Aug 2015 20:05:56 +0000 (16:05 -0400)]
doc: do not call WaitGroup a function

Fixes #12060.

Change-Id: Ie2fd10bedded1a4f4e0daa0c0c77ecd898480767
Reviewed-on: https://go-review.googlesource.com/13324
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: call goexit1 instead of goexit
Austin Clements [Thu, 6 Aug 2015 19:36:50 +0000 (15:36 -0400)]
runtime: call goexit1 instead of goexit

Currently, runtime.Goexit() calls goexit()—the goroutine exit stub—to
terminate the goroutine. This *mostly* works, but can cause a
"leftover stack barriers" panic if the following happens:

1. Goroutine A has a reasonably large stack.

2. The garbage collector scan phase runs and installs stack barriers
   in A's stack. The top-most stack barrier happens to fall at address X.

3. Goroutine A unwinds the stack far enough to be a candidate for
   stack shrinking, but not past X.

4. Goroutine A calls runtime.Goexit(), which calls goexit(), which
   calls goexit1().

5. The garbage collector enters mark termination.

6. Goroutine A is preempted right at the prologue of goexit1() and
   performs a stack shrink, which calls gentraceback.

gentraceback stops as soon as it sees goexit on the stack, which is
only two frames up at this point, even though there may really be many
frames above it. More to the point, the stack barrier at X is above
the goexit frame, so gentraceback never sees that stack barrier. At
the end of gentraceback, it checks that it saw all of the stack
barriers and panics because it didn't see the one at X.

The fix is simple: call goexit1, which actually implements the process
of exiting a goroutine, rather than goexit, the exit stub.

To make sure this doesn't happen again in the future, we also add an
argument to the stub prototype of goexit so you really, really have to
want to call it in order to call it. We were able to reliably
reproduce the above sequence with a fair amount of awful code inserted
at the right places in the runtime, but chose to change the goexit
prototype to ensure this wouldn't happen again rather than pollute the
runtime with ugly testing code.

Change-Id: Ifb6fb53087e09a252baddadc36eebf954468f2a8
Reviewed-on: https://go-review.googlesource.com/13323
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: fix race that dropped GoSysExit events from trace
Russ Cox [Thu, 6 Aug 2015 17:44:37 +0000 (13:44 -0400)]
runtime: fix race that dropped GoSysExit events from trace

This makes TestTraceStressStartStop much less flaky.
Running under stress, it changes the failure rate from
above 1/100 to under 1/50000. That very unlikely
failure happens when an unexpected GoSysExit is
written. Not sure how that happens yet, but it is much
less important.

Fixes #11953.

Change-Id: I034671936334b4f3ab733614ef239aa121d20247
Reviewed-on: https://go-review.googlesource.com/13321
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agodoc: remove duplicate -asmflags mention
Joe Shaw [Thu, 6 Aug 2015 17:05:30 +0000 (13:05 -0400)]
doc: remove duplicate -asmflags mention

Fixes #12053

Change-Id: Icd883b4f1ac944a8ec718c79770a8e3fc6542e3a
Reviewed-on: https://go-review.googlesource.com/13259
Reviewed-by: Russ Cox <rsc@golang.org>
8 years ago[release-branch.go1.5] cmd/newlink: remove from release branch go1.5rc1
Andrew Gerrand [Thu, 6 Aug 2015 03:45:35 +0000 (03:45 +0000)]
[release-branch.go1.5] cmd/newlink: remove from release branch

Change-Id: Iad86bde6f2e0482745a4000ec4e192ade352983b
Reviewed-on: https://go-review.googlesource.com/13292
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[release-branch.go1.5] go1.5rc1
Andrew Gerrand [Thu, 6 Aug 2015 03:30:13 +0000 (03:30 +0000)]
[release-branch.go1.5] go1.5rc1

Change-Id: Ibf98802b45cd22f20f8f3605bb695e9744b7a6b2
Reviewed-on: https://go-review.googlesource.com/13290
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/url: allow all valid host chars in RawPath
Russ Cox [Thu, 6 Aug 2015 02:12:16 +0000 (22:12 -0400)]
net/url: allow all valid host chars in RawPath

The old code was only allowing the chars we choose not to escape.
We sometimes prefer to escape chars that do not strictly need it.
Allowing those to be used in RawPath lets people override that
preference, which is in fact the whole point of RawPath (new in Go 1.5).

While we are here, also allow [ ] in RawPath.
This is not strictly spec-compliant, but it is what modern browers
do and what at least some people expect, and the [ ] do not cause
any ambiguity (the usual reason they would be escaped, as they are
part of the RFC gen-delims class).
The argument for allowing them now instead of waiting until Go 1.6
is that this way RawPath has one fixed meaning at the time it is
introduced, that we should not need to change or expand.

Fixes #5684.

Change-Id: If9c82a18f522d7ee1d10310a22821ada9286ee5c
Reviewed-on: https://go-review.googlesource.com/13258
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agonet/url: do not percent-encode valid host characters
Russ Cox [Thu, 6 Aug 2015 01:45:30 +0000 (21:45 -0400)]
net/url: do not percent-encode valid host characters

The code in question was added as part of allowing zone identifiers
in IPv6 literals like http://[ipv6%zone]:port/foo, in golang.org/cl/2431.

The old condition makes no sense. It refers to §3.2.1, which is the wrong section
of the RFC, it excludes all the sub-delims, which §3.2.2 (the right section)
makes clear are valid, and it allows ':', which is not actually valid,
without an explanation as to why (because we keep :port in the Host field
of the URL struct).

The new condition allows all the sub-delims, as specified in RFC 3986,
plus the additional characters [ ] : seen in IP address literals and :port suffixes,
which we also keep in the Host field.

This allows mysql://a,b,c/path to continue to parse, as it did in Go 1.4 and earlier.

This CL does not break any existing tests, suggesting the over-conservative
behavior was not intended and perhaps not realized.

It is especially important not to over-escape the host field, because
Go does not unescape the host field during parsing: it rejects any
host field containing % characters.

Fixes #12036.

Change-Id: Iccbe4985957b3dc58b6dfb5dcb5b63a51a6feefb
Reviewed-on: https://go-review.googlesource.com/13254
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agodoc/go1.5.html: fix typo
Mikio Hara [Thu, 6 Aug 2015 02:18:27 +0000 (11:18 +0900)]
doc/go1.5.html: fix typo

Change-Id: Ic61fd38e7d2e0821c6adcaa210199a7dae8849a7
Reviewed-on: https://go-review.googlesource.com/13281
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agonet/url: restrict :port checking to [ipv6]:port form
Russ Cox [Thu, 6 Aug 2015 01:22:10 +0000 (21:22 -0400)]
net/url: restrict :port checking to [ipv6]:port form

Go 1.4 and earlier accepted mysql://x@y(z:123)/foo
and I don't see any compelling reason to break that.

The CL during Go 1.5 that broke this syntax was
trying to fix #11208 and was probably too aggressive.
I added a test case for #11208 to make sure that stays
fixed.

Relaxing the check did not re-break #11208 nor did
it cause any existing test to fail. I added a test for the
mysql://x@y(z:123)/foo syntax being preserved.

Fixes #12023.

Change-Id: I659d39f18c85111697732ad24b757169d69284fc
Reviewed-on: https://go-review.googlesource.com/13253
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agoA+C: add Andy Maloney
Andrew Gerrand [Wed, 5 Aug 2015 22:59:05 +0000 (08:59 +1000)]
A+C: add Andy Maloney

Fixes #10639

Change-Id: I0aa3bcbf656e23e6a110041439f6052057074b88
Reviewed-on: https://go-review.googlesource.com/13270
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: fix handling of vendored imports in foo_test.go files
Russ Cox [Wed, 5 Aug 2015 16:09:05 +0000 (12:09 -0400)]
cmd/go: fix handling of vendored imports in foo_test.go files

Fixes #11977.
Fixes #11988.

Change-Id: I9f80006946d3752ee6d644ee51f2decfeaca1ff6
Reviewed-on: https://go-review.googlesource.com/13230
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agospec: clarify semantics of built-in functions 'complex', 'real', and 'imag'
Robert Griesemer [Wed, 29 Jul 2015 22:42:04 +0000 (15:42 -0700)]
spec: clarify semantics of built-in functions 'complex', 'real', and 'imag'

For #11669, #11540, #11945, #11946, #11947.

Change-Id: Ifb0053c498cee9f3473c396f9338d82bd856c110
Reviewed-on: https://go-review.googlesource.com/12860
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocrypto/tls: fix ConnectionState().VerifiedChains for resumed connection
Russ Cox [Wed, 5 Aug 2015 13:53:56 +0000 (09:53 -0400)]
crypto/tls: fix ConnectionState().VerifiedChains for resumed connection

Strengthening VerifyHostname exposed the fact that for resumed
connections, ConnectionState().VerifiedChains was not being saved
and restored during the ClientSessionCache operations.
Do that.

This change just saves the verified chains in the client's session
cache. It does not re-verify the certificates when resuming a
connection.

There are arguments both ways about this: we want fast, light-weight
resumption connections (thus suggesting that we shouldn't verify) but
it could also be a little surprising that, if the verification config
is changed, that would be ignored if the same session cache is used.

On the server side we do re-verify client-auth certificates, but the
situation is a little different there. The client session cache is an
object in memory that's reset each time the process restarts. But the
server's session cache is a conceptual object, held by the clients, so
can persist across server restarts. Thus the chance of a change in
verification config being surprisingly ignored is much higher in the
server case.

Fixes #12024.

Change-Id: I3081029623322ce3d9f4f3819659fdd9a381db16
Reviewed-on: https://go-review.googlesource.com/13164
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
8 years agobuild: clean current tree in clean.bash
Russ Cox [Wed, 5 Aug 2015 17:39:07 +0000 (13:39 -0400)]
build: clean current tree in clean.bash

Otherwise clean.bash cleans $GOROOT, which might be something else entirely.

Fixes #12003.

Change-Id: I2ad5369017dde6db25f0c0514bc27c33d0a8bf54
Reviewed-on: https://go-review.googlesource.com/13251
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agonet/http: close server conn after broken trailers
Jed Denlea [Tue, 4 Aug 2015 01:00:44 +0000 (18:00 -0700)]
net/http: close server conn after broken trailers

Prior to this change, broken trailers would be handled by body.Read, and
an error would be returned to its caller (likely a Handler), but that
error would go completely unnoticed by the rest of the server flow
allowing a broken connection to be reused.  This is a possible request
smuggling vector.

Fixes #12027.

Change-Id: I077eb0b8dff35c5d5534ee5f6386127c9954bd58
Reviewed-on: https://go-review.googlesource.com/13148
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocrypto/tls: update testing certificates.
Adam Langley [Wed, 5 Aug 2015 17:55:41 +0000 (10:55 -0700)]
crypto/tls: update testing certificates.

This change alters the certificate used in many tests so that it's no
longer self-signed. This allows some tests to exercise the standard
certificate verification paths in the future.

Change-Id: I9c3fcd6847eed8269ff3b86d9b6966406bf0642d
Reviewed-on: https://go-review.googlesource.com/13244
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
8 years agogo/build: fix internal/testenv dependency
Russ Cox [Wed, 5 Aug 2015 17:13:33 +0000 (13:13 -0400)]
go/build: fix internal/testenv dependency

Change-Id: Id1e30d70d6891ef12110f8e7832b94eeac9e2fa9
Reviewed-on: https://go-review.googlesource.com/13250
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: don't recheck heap trigger for periodic GC
Austin Clements [Wed, 5 Aug 2015 15:07:47 +0000 (11:07 -0400)]
runtime: don't recheck heap trigger for periodic GC

88e945f introduced a non-speculative double check of the heap trigger
before actually starting a concurrent GC. This was necessary to fix a
race for heap-triggered GC, but broke sysmon-triggered periodic GC,
since the heap check will of course fail for periodically triggered
GC.

Fix this by telling startGC whether or not this GC was triggered by
heap size or a timer and only doing the heap size double check for GCs
triggered by heap size.

Fixes #12026.

Change-Id: I7c3f6ec364545c36d619f2b4b3bf3b758e3bcbd6
Reviewed-on: https://go-review.googlesource.com/13168
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agospec: better organization of arithmetic operator section
Robert Griesemer [Tue, 4 Aug 2015 22:04:39 +0000 (15:04 -0700)]
spec: better organization of arithmetic operator section

First step towards cleaning up the operator section - no language
changes. Specifically:

- Grouped arithmetic operations by types (integer, floating-point,
  string), with corresponding h4 headings.

- Changed Operator precedence title from h3 to h4.

- Moved Integer Overflow section after integer operations and changed
  its title from h3 to h4.

This puts things that belong together closer. No heading id's were
lost (in case of references from outside the spec).

Change-Id: I6b349ba8d86a6ae29b596beb297cc45c81e69399
Reviewed-on: https://go-review.googlesource.com/13143
Reviewed-by: Rob Pike <r@golang.org>
8 years agospec: fix inconsistency of visibility rules for method names
Robert Griesemer [Tue, 4 Aug 2015 18:52:01 +0000 (11:52 -0700)]
spec: fix inconsistency of visibility rules for method names

Inconsistency identified by Anmol Sethi (anmol@aubble.com).

Fixes #10341.

Change-Id: I1a1f5b22aad29b56280f81026feaa37a61b3e0a9
Reviewed-on: https://go-review.googlesource.com/13132
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agospec: clarify that short variable declarations can redeclare parameters
Robert Griesemer [Tue, 4 Aug 2015 18:29:28 +0000 (11:29 -0700)]
spec: clarify that short variable declarations can redeclare parameters

Fixes #9837.

Change-Id: Ia513c7e5db221eee8e3ab0affa6d3688d2099fd9
Reviewed-on: https://go-review.googlesource.com/13130
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agospec: clarify sentence about non-constant shifts
Robert Griesemer [Tue, 4 Aug 2015 17:38:50 +0000 (10:38 -0700)]
spec: clarify sentence about non-constant shifts

Fixes #10514.

Change-Id: Iae95a304d3ebb1ed82567aa234e05dc434db984f
Reviewed-on: https://go-review.googlesource.com/13098
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodoc/go1.5: fix hyperlink for runtime/trace
Russ Cox [Wed, 5 Aug 2015 14:20:02 +0000 (10:20 -0400)]
doc/go1.5: fix hyperlink for runtime/trace

Missed in CL 13074.

Change-Id: Ic0600341abbc423cd8d7b2201bf50e3b0bf398a7
Reviewed-on: https://go-review.googlesource.com/13167
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agogo/build: enable cgo on freebsd/arm
Russ Cox [Wed, 5 Aug 2015 13:12:18 +0000 (09:12 -0400)]
go/build: enable cgo on freebsd/arm

Now that it works we need to turn it back on.

Fixes #10119.

Change-Id: I9c62d3026f7bb62c49a601ad73f33bf655372915
Reviewed-on: https://go-review.googlesource.com/13162
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: skip external tests on freebsd-arm builder
Russ Cox [Wed, 5 Aug 2015 14:19:12 +0000 (10:19 -0400)]
cmd/go: skip external tests on freebsd-arm builder

It is just far too slow.
I have a CL for Go 1.6 that makes many of these into internal tests.
That will improve the coverage.

It does not matter much, because basically none of the go command
tests are architecture dependent, so the other builders will catch
any problems.

Fixes freebsd-arm builder.

Change-Id: I8b2f6ac2cc1e7657019f7731c6662dc43e20bfb5
Reviewed-on: https://go-review.googlesource.com/13166
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agointernal/testenv: add Builder, to report builder name
Russ Cox [Wed, 5 Aug 2015 14:11:59 +0000 (10:11 -0400)]
internal/testenv: add Builder, to report builder name

This works after golang.org/cl/13120 is running on the
coordinator (maybe it already is).

Change-Id: I4053d8e2f32fafd47b927203a6f66d5858e23376
Reviewed-on: https://go-review.googlesource.com/13165
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: mention new DWARF line table decoder in go1.5.html
Austin Clements [Tue, 4 Aug 2015 19:57:07 +0000 (15:57 -0400)]
doc: mention new DWARF line table decoder in go1.5.html

Change-Id: I4e8c20284255e0e17b6fb72475d2d37f49994788
Reviewed-on: https://go-review.googlesource.com/13113
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc/go1.5.html: update references to runtime/trace package
Dmitry Vyukov [Tue, 4 Aug 2015 07:11:06 +0000 (09:11 +0200)]
doc/go1.5.html: update references to runtime/trace package

Tracing functionality was moved from runtime/pprof to runtime/trace.

Change-Id: I694e0f209d043c7ffecb113f1825175bf963dde3
Reviewed-on: https://go-review.googlesource.com/13074
Reviewed-by: Rob Pike <r@golang.org>
8 years agoruntime: align stack pointer during initcgo call on arm
Russ Cox [Wed, 5 Aug 2015 03:44:06 +0000 (23:44 -0400)]
runtime: align stack pointer during initcgo call on arm

This is what is causing freebsd/arm to crash mysteriously when using cgo.
The bug was introduced in golang.org/cl/4030, which moved this code out
of rt0_go and into its own function. The ARM ABI says that calls must
be made with the stack pointer at an 8-byte boundary, but only FreeBSD
seems to crash when this is violated.

Fixes #10119.

Change-Id: Ibdbe76b2c7b80943ab66b8abbb38b47acb70b1e5
Reviewed-on: https://go-review.googlesource.com/13161
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
8 years agodoc: adjust installation instructions dynamically for a given download
Andrew Gerrand [Wed, 5 Aug 2015 01:58:44 +0000 (11:58 +1000)]
doc: adjust installation instructions dynamically for a given download

This change allows the download page to redirect the user to
/doc/install?download=filename so the user can see installation
instructions specific to the file they are downloading.

This change also expands the "Test your Go installation" section
to instruct the user to create a workspace, hopefully leading
to less confusion down the line.

It also changes the front page download link to go directly
to the downloads page, which will in turn take them to the
installation instructions (the original destination).

This is related to this change to the tools repo:
https://golang.org/cl/13180

Change-Id: I658327bdb93ad228fb1846e389b281b15da91b1d
Reviewed-on: https://go-review.googlesource.com/13151
Reviewed-by: Chris Broadfoot <cbro@golang.org>
8 years agodoc: bump minimum requirement to OS X 10.7
Andrew Gerrand [Tue, 4 Aug 2015 23:40:33 +0000 (09:40 +1000)]
doc: bump minimum requirement to OS X 10.7

Fixes #11995

Change-Id: I9e2901d77ebde705f59822e7d4a8163cbacffcd7
Reviewed-on: https://go-review.googlesource.com/13150
Reviewed-by: Rob Pike <r@golang.org>
8 years agoreflect: fix doc string
Robert Griesemer [Tue, 4 Aug 2015 20:44:01 +0000 (13:44 -0700)]
reflect: fix doc string

Fixes #12017.

Change-Id: I3dfcf9d0b62cae02eca1973383f0aad286a6ef4d
Reviewed-on: https://go-review.googlesource.com/13136
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: fix typos in comments
Austin Clements [Mon, 3 Aug 2015 22:09:13 +0000 (18:09 -0400)]
runtime: fix typos in comments

Change-Id: I66f7937b22bb6e05c3f2f0f2a057151020ad9699
Reviewed-on: https://go-review.googlesource.com/13049
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: fix assist utilization computation
Austin Clements [Mon, 3 Aug 2015 22:06:05 +0000 (18:06 -0400)]
runtime: fix assist utilization computation

When commit 510fd13 enabled assists during the scan phase, it failed
to also update the code in the GC controller that computed the assist
CPU utilization and adjusted the trigger based on it. Fix that code so
it uses the start of the scan phase as the wall-clock time when
assists were enabled rather than the start of the mark phase.

Change-Id: I05013734b4448c3e2c730dc7b0b5ee28c86ed8cf
Reviewed-on: https://go-review.googlesource.com/13048
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: revise assist ratio aggressively
Austin Clements [Mon, 3 Aug 2015 21:48:47 +0000 (17:48 -0400)]
runtime: revise assist ratio aggressively

At the start of a GC cycle, the garbage collector computes the assist
ratio based on the total scannable heap size. This was intended to be
conservative; after all, this assumes the entire heap may be reachable
and hence needs to be scanned. But it only assumes that the *current*
entire heap may be reachable. It fails to account for heap allocated
during the GC cycle. If the trigger ratio is very low (near zero), and
most of the heap is reachable when GC starts (which is likely if the
trigger ratio is near zero), then it's possible for the mutator to
create new, reachable heap fast enough that the assists won't keep up
based on the assist ratio computed at the beginning of the cycle. As a
result, the heap can grow beyond the heap goal (by hundreds of megs in
stress tests like in issue #11911).

We already have some vestigial logic for dealing with situations like
this; it just doesn't run often enough. Currently, every 10 ms during
the GC cycle, the GC revises the assist ratio. This was put in before
we switched to a conservative assist ratio (when we really were using
estimates of scannable heap), and it turns out to be exactly what we
need now. However, every 10 ms is far too infrequent for a rapidly
allocating mutator.

This commit reuses this logic, but replaces the 10 ms timer with
revising the assist ratio every time the heap is locked, which
coincides precisely with when the statistics used to compute the
assist ratio are updated.

Fixes #11911.

Change-Id: I377b231ab064946228378fa10422a46d1b50f4c5
Reviewed-on: https://go-review.googlesource.com/13047
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: when gcpacertrace > 0, print information about assist ratio
Austin Clements [Mon, 3 Aug 2015 21:45:44 +0000 (17:45 -0400)]
runtime: when gcpacertrace > 0, print information about assist ratio

This was useful in debugging the mutator assist behavior for #11911,
and it fits with the other gcpacertrace output.

Change-Id: I1e25590bb4098223a160de796578bd11086309c7
Reviewed-on: https://go-review.googlesource.com/13046
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: make sweep proportional to spans bytes allocated
Austin Clements [Mon, 3 Aug 2015 13:46:50 +0000 (09:46 -0400)]
runtime: make sweep proportional to spans bytes allocated

Proportional concurrent sweep is currently based on a ratio of spans
to be swept per bytes of object allocation. However, proportional
sweeping is performed during span allocation, not object allocation,
in order to minimize contention and overhead. Since objects are
allocated from spans after those spans are allocated, the system tends
to operate in debt, which means when the next GC cycle starts, there
is often sweep debt remaining, so GC has to finish the sweep, which
delays the start of the cycle and delays enabling mutator assists.

For example, it's quite likely that many Ps will simultaneously refill
their span caches immediately after a GC cycle (because GC flushes the
span caches), but at this point, there has been very little object
allocation since the end of GC, so very little sweeping is done. The
Ps then allocate objects from these cached spans, which drives up the
bytes of object allocation, but since these allocations are coming
from cached spans, nothing considers whether more sweeping has to
happen. If the sweep ratio is high enough (which can happen if the
next GC trigger is very close to the retained heap size), this can
easily represent a sweep debt of thousands of pages.

Fix this by making proportional sweep proportional to the number of
bytes of spans allocated, rather than the number of bytes of objects
allocated. Prior to allocating a span, both the small object path and
the large object path ensure credit for allocating that span, so the
system operates in the black, rather than in the red.

Combined with the previous commit, this should eliminate all sweeping
from GC start up. On the stress test in issue #11911, this reduces the
time spent sweeping during GC (and delaying start up) by several
orders of magnitude:

                mean    99%ile     max
    pre fix      1 ms    11 ms   144 ms
    post fix   270 ns   735 ns   916 ns

Updates #11911.

Change-Id: I89223712883954c9d6ec2a7a51ecb97172097df3
Reviewed-on: https://go-review.googlesource.com/13044
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: always give concurrent sweep some heap distance
Austin Clements [Mon, 3 Aug 2015 13:25:23 +0000 (09:25 -0400)]
runtime: always give concurrent sweep some heap distance

Currently it's possible for the next_gc heap size trigger computed for
the next GC cycle to be less than the current allocated heap size.
This means the next cycle will start immediately, which means there's
no time to perform the concurrent sweep between GC cycles. This places
responsibility for finishing the sweep on GC itself, which delays GC
start-up and hence delays mutator assist.

Fix this by ensuring that next_gc is always at least a little higher
than the allocated heap size, so we won't trigger the next cycle
instantly.

Updates #11911.

Change-Id: I74f0b887bf187518d5fedffc7989817cbcf30592
Reviewed-on: https://go-review.googlesource.com/13043
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: assist the GC during GC startup and shutdown
Austin Clements [Fri, 31 Jul 2015 18:29:02 +0000 (14:29 -0400)]
runtime: assist the GC during GC startup and shutdown

Currently there are two sensitive periods during which a mutator can
allocate past the heap goal but mutator assists can't be enabled: 1)
at the beginning of GC between when the heap first passes the heap
trigger and sweep termination and 2) at the end of GC between mark
termination and when the background GC goroutine parks. During these
periods there's no back-pressure or safety net, so a rapidly
allocating mutator can allocate past the heap goal. This is
exacerbated if there are many goroutines because the GC coordinator is
scheduled as any other goroutine, so if it gets preempted during one
of these periods, it may stay preempted for a long period (10s or 100s
of milliseconds).

Normally the mutator does scan work to create back-pressure against
allocation, but there is no scan work during these periods. Hence, as
a fall back, if a mutator would assist but can't yet, simply yield the
CPU. This delays the mutator somewhat, but more importantly gives more
CPU time to the GC coordinator for it to complete the transition.

This is obviously a workaround. Issue #11970 suggests a far better but
far more invasive way to fix this.

Updates #11911. (This very nearly fixes the issue, but about once
every 15 minutes I get a GC cycle where the assists are enabled but
don't do enough work.)

Change-Id: I9768b79e3778abd3e06d306596c3bd77f65bf3f1
Reviewed-on: https://go-review.googlesource.com/13026
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: recheck GC trigger before actually starting GC
Austin Clements [Fri, 31 Jul 2015 17:52:17 +0000 (13:52 -0400)]
runtime: recheck GC trigger before actually starting GC

Currently allocation checks the GC trigger speculatively during
allocation and then triggers the GC without rechecking. As a result,
it's possible for G 1 and G 2 to detect the trigger simultaneously,
both enter startGC, G 1 actually starts GC while G 2 gets preempted
until after the whole GC cycle, then G 2 immediately starts another GC
cycle even though the heap is now well under the trigger.

Fix this by re-checking the GC trigger non-speculatively just before
actually kicking off a new GC cycle.

This contributes to #11911 because when this happens, we definitely
don't finish the background sweep before starting the next GC cycle,
which can significantly delay the start of concurrent scan.

Change-Id: I560ab79ba5684ba435084410a9765d28f5745976
Reviewed-on: https://go-review.googlesource.com/13025
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agodoc: link to design doc for GOMAXPROCS change in go1.5.html
Ian Lance Taylor [Mon, 3 Aug 2015 19:35:59 +0000 (12:35 -0700)]
doc: link to design doc for GOMAXPROCS change in go1.5.html

Change-Id: Ifac10621fece766f3a0e8551e98d1f8d7072852f
Reviewed-on: https://go-review.googlesource.com/13068
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/go: fix documentation for exported functions
Ian Lance Taylor [Mon, 3 Aug 2015 19:49:00 +0000 (12:49 -0700)]
cmd/go: fix documentation for exported functions

I accidentally submitted https://golang.org/cl/13080 too early.

Update #11955.

Change-Id: I1a5a6860bb46bc4bc6fd278f8a867d2dd9e411e1
Reviewed-on: https://go-review.googlesource.com/13096
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoarchive/tar: don't treat multiple file system links as a tar hardlink
Vincent Batts [Mon, 3 Aug 2015 16:26:38 +0000 (12:26 -0400)]
archive/tar: don't treat multiple file system links as a tar hardlink

Do not assume that if stat shows multiple links that we should mark the
file as a hardlink in the tar format.  If the hardlink link was not
referenced, this caused a link to "/".  On an overlay file system, all
files have multiple links.

The caller must keep the inode references and set TypeLink, Size = 0,
and LinkName themselves.

Change-Id: I873b8a235bc8f8fbb271db74ee54232da36ca013
Reviewed-on: https://go-review.googlesource.com/13045
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: document that functions are exported by cgo
Ian Lance Taylor [Mon, 3 Aug 2015 19:49:00 +0000 (12:49 -0700)]
cmd/go: document that functions are exported by cgo

The buildmode docs mention exported functions, but don't say anything
about how to export them.  Mention the cgo tool to make this somewhat
clearer.

Fixes #11955.

Change-Id: Ie5420445daa87f5aceec6ad743465d5d32d0a786
Reviewed-on: https://go-review.googlesource.com/13080
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agogo/types: remove the renaming import of go/constant
Rob Pike [Mon, 3 Aug 2015 03:57:25 +0000 (13:57 +1000)]
go/types: remove the renaming import of go/constant

For niceness, when go/exact was moved from x/tools, it
was renamed go/constant.

For simplicity, when go/types was moved from x/tools, its
imports of (now) go/constant were done with a rename:

    import exact "go/constant"

This kept the code just as it was before and avoided the issue
of what to call the internal constant called, um, constant.

But not all was hidden, as the text of some fields of structs and
the like leaked the old name, so things like "exact.Value" appeared
in type definitions and function signatures in the documentation.
This is unacceptable.

Fix the documentation issue by fixing the code. Rename the constant
constant constant_, and remove the renaming import.

This should go into 1.5. It's mostly a mechanical change, is
internal to the package, and fixes the documentation. It contains
no semantic changes except to fix a benchmark that was broken
in the original transition.

Fixes #11949.

Change-Id: Ieb94b6558535b504180b1378f19e8f5a96f92d3c
Reviewed-on: https://go-review.googlesource.com/13051
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodoc: link to the release cycle from contribute.html
Caleb Spare [Tue, 4 Aug 2015 00:48:43 +0000 (17:48 -0700)]
doc: link to the release cycle from contribute.html

Change-Id: Ia5d41b66006682084fcbfac3da020946ea3dd116
Reviewed-on: https://go-review.googlesource.com/13093
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: re-run mkalldocs.sh after testflag change
Caleb Spare [Tue, 4 Aug 2015 00:20:31 +0000 (17:20 -0700)]
cmd/go: re-run mkalldocs.sh after testflag change

Change-Id: Ia21501df23a91c065d9f2acc6f043019a1419b22
Reviewed-on: https://go-review.googlesource.com/13092
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodoc: Mention contributor agreement immediately after Gerrit
Andy Maloney [Mon, 3 Aug 2015 14:15:52 +0000 (10:15 -0400)]
doc: Mention contributor agreement immediately after Gerrit

I walked through the steps for a contribution but ended up
with an error when doing "git mail" because I didn't have a
signed agreement.

Added a section to check for or create one through Gerrit right
after the user has created the account and logged in.

Moved some info from copyright section to the new section.

Change-Id: I79bbd3e18fc3a742fa59a242085da14be9e19ba0
Reviewed-on: https://go-review.googlesource.com/13062
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: documented default value of the -timeout testflag
Caleb Spare [Mon, 3 Aug 2015 23:32:28 +0000 (16:32 -0700)]
cmd/go: documented default value of the -timeout testflag

Change-Id: I4dc75065038a9cfd06f61c0deca1c86c70713d3a
Reviewed-on: https://go-review.googlesource.com/13091
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: clean up installHeader action
Russ Cox [Fri, 31 Jul 2015 19:07:44 +0000 (15:07 -0400)]
cmd/go: clean up installHeader action

This was confusing when I was trying to fix go build -o.
Perhaps due to that fix, this can now be simplified from
three functions to one.

Change-Id: I878a6d243b14132a631e7c62a3bb6d101bc243ea
Reviewed-on: https://go-review.googlesource.com/13027
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: document and fix 'go build -o' semantics
Russ Cox [Fri, 31 Jul 2015 17:07:41 +0000 (13:07 -0400)]
cmd/go: document and fix 'go build -o' semantics

Quoting the new docs:

«
If the arguments to build are a list of .go files, build treats
them as a list of source files specifying a single package.

When compiling a single main package, build writes
the resulting executable to an output file named after
the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe')
or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
The '.exe' suffix is added when writing a Windows executable.

When compiling multiple packages or a single non-main package,
build compiles the packages but discards the resulting object,
serving only as a check that the packages can be built.

The -o flag, only allowed when compiling a single package,
forces build to write the resulting executable or object
to the named output file, instead of the default behavior described
in the last two paragraphs.
»

There is a change in behavior here, namely that 'go build -o x.a x.go'
where x.go is not a command (not package main) did not write any
output files (back to at least Go 1.2) but now writes x.a.
This seems more reasonable than trying to explain that -o is
sometimes silently ignored.

Otherwise the behavior is unchanged.

The lines being deleted in goFilesPackage look like they are
setting up 'go build x.o' to write 'x.a', but they were overridden
by the p.target = "" in runBuild. Again back to at least Go 1.2,
'go build x.go' for a non-main package has never produced
output. It seems better to keep it that way than to change it,
both for historical consistency and for consistency with
'go build strings' and 'go build std'.

All of this behavior is now tested.

Fixes #10865.

Change-Id: Iccdf21f366fbc8b5ae600a1e50dfe7fc3bff8b1c
Reviewed-on: https://go-review.googlesource.com/13024
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
8 years agonet/http: deflake TestZeroLengthPostAndResponse
Brad Fitzpatrick [Mon, 3 Aug 2015 09:51:21 +0000 (11:51 +0200)]
net/http: deflake TestZeroLengthPostAndResponse

It was failing with multiple goroutines a few out of every thousand
runs (with errRequestCanceled) because it was using the same
*http.Request for all 5 RoundTrips, but the RoundTrips' goroutines
(notably the readLoop method) were all still running, sharing that
same pointer. Because the response has no body (which is what
TestZeroLengthPostAndResponse tests), the readLoop was marking the
connection as reusable early (before the caller read until the body's
EOF), but the Transport code was clearing the Request's cancelation
func *AFTER* the caller had already received it from RoundTrip. This
let the test continue looping and do the next request with the same
pointer, fetch a connection, and then between getConn and roundTrip
have an invariant violated: the Request's cancelation func was nil,
tripping this check:

        if !pc.t.replaceReqCanceler(req.Request, pc.cancelRequest) {
                pc.t.putIdleConn(pc)
                return nil, errRequestCanceled
        }

The solution is to clear the request cancelation func in the readLoop
goroutine in the no-body case before it's returned to the caller.

This now passes reliably:

$ go test -race -run=TestZeroLengthPostAndResponse -count=3000

I think we've only seen this recently because we now randomize scheduling
of goroutines in race mode (https://golang.org/cl/11795). This race
has existed for a long time but the window was hard to hit.

Change-Id: Idb91c582919f85aef5b9e5ef23706f1ba9126e9a
Reviewed-on: https://go-review.googlesource.com/13070
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: fix server/transport data race when sharing the request body
Brad Fitzpatrick [Mon, 3 Aug 2015 08:04:42 +0000 (10:04 +0200)]
net/http: fix server/transport data race when sharing the request body

Introduced in https://go-review.googlesource.com/12865 (git rev c2db5f4c).

This fix doesn't add any new lock acquistions: it just moves the
existing one taken by the unreadDataSize method and moves it out
wider.

It became flaky at rev c2db5f4c, but now reliably passes again:
$ go test -v -race -run=TestTransportAndServerSharedBodyRace -count=100 net/http

Fixes #11985

Change-Id: I6956d62839fd7c37e2f7441b1d425793f4a0db30
Reviewed-on: https://go-review.googlesource.com/12909
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: skip TestCgoCallbackGC on dragonfly
Mikio Hara [Mon, 3 Aug 2015 03:43:25 +0000 (12:43 +0900)]
runtime: skip TestCgoCallbackGC on dragonfly

Updates #11990.

Change-Id: I6c58923a1b5a3805acfb6e333e3c9e87f4edf4ba
Reviewed-on: https://go-review.googlesource.com/13050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: document new linker -X syntax in go1.5.html
Rob Pike [Mon, 3 Aug 2015 01:05:05 +0000 (11:05 +1000)]
doc: document new linker -X syntax in go1.5.html

Fixes #11973.

Change-Id: Icffa3213246663982b7cc795982e0923e272f405
Reviewed-on: https://go-review.googlesource.com/12919
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: link to proposal process from contribution guidelines
Andrew Gerrand [Fri, 31 Jul 2015 01:43:57 +0000 (11:43 +1000)]
doc: link to proposal process from contribution guidelines

Change-Id: I992cb1afeef498353d529238e508fa438d6c069c
Reviewed-on: https://go-review.googlesource.com/12912
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: update install from source instructions for go1.5
ALTree [Sun, 2 Aug 2015 15:59:31 +0000 (17:59 +0200)]
doc: update install from source instructions for go1.5

Fixes #11983

Change-Id: I5ee930314a43356f5be31d758d90d7ddcafc7b37
Reviewed-on: https://go-review.googlesource.com/12908
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agonet/http: close server conn after request body error
Jed Denlea [Thu, 30 Jul 2015 01:10:32 +0000 (18:10 -0700)]
net/http: close server conn after request body error

HTTP servers attempt to entirely consume a request body before sending a
response.  However, when doing so, it previously would ignore any errors
encountered.

Unfortunately, the errors triggered at this stage are indicative of at
least a couple problems: read timeouts and chunked encoding errors.
This means properly crafted and/or timed requests could lead to a
"smuggled" request.

The fix is to inspect the errors created by the response body Reader,
and treat anything other than io.EOF or ErrBodyReadAfterClose as
fatal to the connection.

Fixes #11930

Change-Id: I0bf18006d7d8f6537529823fc450f2e2bdb7c18e
Reviewed-on: https://go-review.googlesource.com/12865
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet/http: fix SetKeepAlivesEnabled receiver name
Carl Jackson [Sat, 1 Aug 2015 06:25:48 +0000 (23:25 -0700)]
net/http: fix SetKeepAlivesEnabled receiver name

This makes the receiver name consistent with the rest of the methods on
type Server.

Change-Id: Ic2a007d3b5eb50bd87030e15405e9856109cf590
Reviewed-on: https://go-review.googlesource.com/13035
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agospec: fixed various example code snippets
Robert Griesemer [Fri, 31 Jul 2015 18:15:11 +0000 (11:15 -0700)]
spec: fixed various example code snippets

Per suggestions by Peter Olsen (https://github.com/pto).

Fixes #11964.

Change-Id: Iae261ac14f75abf848f5601f59d7fe6e95b6805a
Reviewed-on: https://go-review.googlesource.com/13006
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/objdump: don't run TestDisasmExtld if cgo is not enabled
Ian Lance Taylor [Fri, 31 Jul 2015 17:49:01 +0000 (10:49 -0700)]
cmd/objdump: don't run TestDisasmExtld if cgo is not enabled

The test uses external linking mode, which is probably not available
if cgo does not work.

Fixes #11969.

Change-Id: Id1c2828cd2540391e16b422bf51674ba6ff084b0
Reviewed-on: https://go-review.googlesource.com/13005
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoos: add explicit tests for fchown(2) and lchown(2) on unix platforms
Dave Cheney [Wed, 29 Jul 2015 10:06:45 +0000 (20:06 +1000)]
os: add explicit tests for fchown(2) and lchown(2) on unix platforms

Fixes #11919

Issue #11918 suggested that os.File.Chown and os.Lchown were under tested.

Change-Id: Ib41f7cb2d2fe0066d2ccb4d1bdabe1795efe80fc
Reviewed-on: https://go-review.googlesource.com/12834
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>