]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
7 years agoall: merge dev.inline into master
Russ Cox [Wed, 1 Feb 2017 14:35:27 +0000 (09:35 -0500)]
all: merge dev.inline into master

Change-Id: I7715581a04e513dcda9918e853fa6b1ddc703770

7 years agoall: merge dev.typealias into master
Russ Cox [Tue, 31 Jan 2017 17:57:12 +0000 (12:57 -0500)]
all: merge dev.typealias into master

For #18130.

f8b4123613 [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
9ecc3ee252 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
49b7af8a30 [dev.typealias] reflect: add test for type aliases
9bbb07ddec [dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
43c7094386 [dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
9657e0b077 [dev.typealias] cmd/doc: update for type alias
de2e5459ae [dev.typealias] cmd/compile: declare methods after resolving receiver type
9259f3073a [dev.typealias] test: match gccgo error messages on alias2.go
5d92916770 [dev.typealias] cmd/compile: change Func.Shortname to *Sym
a7c884efc1 [dev.typealias] go/internal/gccgoimporter: support for type aliases
5802cfd900 [dev.typealias] cmd/compile: export/import test cases for type aliases
d7cabd40dd [dev.typealias] go/types: clarified doc string
cc2dcce3d7 [dev.typealias] cmd/compile: a few better comments related to alias types
5c160b28ba [dev.typealias] cmd/compile: improved error message for cyles involving type aliases
b2386dffa1 [dev.typealias] cmd/compile: type-check type alias declarations
ac8421f9a5 [dev.typealias] cmd/compile: various minor cleanups
f011e0c6c3 [dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes
49de5f0351 [dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases
5ceec42dc0 [dev.typealias] go/types: export TypeName.IsAlias so clients can use it
aa1f0681bc [dev.typealias] go/types: improved Object printing
c80748e389 [dev.typealias] go/types: remove some more vestiges of prior alias implementation
80d8b69e95 [dev.typealias] go/types: implement type aliases
a917097b5e [dev.typealias] go/build: add go1.9 build tag
3e11940437 [dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)
e0a05c274a [dev.typealias] cmd/gofmt: added test cases for alias type declarations
2e5116bd99 [dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support

Change-Id: Ia65f2e011fd7195f18e1dce67d4d49b80a261203

7 years agotesting: stop timeout-timer after running tests
Alberto Donizetti [Sun, 29 Jan 2017 19:53:35 +0000 (20:53 +0100)]
testing: stop timeout-timer after running tests

Fixes #18845

Change-Id: Icdc3e2067807781e42f2ffc94d1824aed94d3713
Reviewed-on: https://go-review.googlesource.com/35956
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years ago[dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
Robert Griesemer [Wed, 11 Jan 2017 00:19:14 +0000 (16:19 -0800)]
[dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'

First steps towards defining type aliases in the spec.
This is a nomenclature clarification, not a language change.

The spec used all three terms 'embedded type', 'anonymous field',
and 'embedded field'. Users where using the terms inconsistently.

The notion of an 'anonymous' field was always misleading since they
always had a de-facto name. With type aliases that name becomes even
more important because we may have different names for the same type.

Use the term 'embedded field' consistently and remove competing
terminology.

For #18130.

Change-Id: I2083bbc85788cab0b2e2cb1ff58b2f979491f001
Reviewed-on: https://go-review.googlesource.com/35108
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agocmd/dist: really skip the testsanitizers tests on Android
Elias Naur [Mon, 30 Jan 2017 18:55:35 +0000 (19:55 +0100)]
cmd/dist: really skip the testsanitizers tests on Android

The test.bash script in misc/cgo/testsanitizers use GOOS, not GOHOSTOS.
Fix the dist check from gohostos to goos accordingly.

The error was masked on the builders because they run on a darwin host
where the sanitizers tests never ran.

With this change, the Android test suite completes successfully on
Android/amd64.

Change-Id: Id7690429f78c6ac7a26fc9118d913b719b565bb2
Reviewed-on: https://go-review.googlesource.com/35959
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoruntime: add explicit (void) in C to avoid GCC 7 problem
Ian Lance Taylor [Mon, 30 Jan 2017 17:43:25 +0000 (09:43 -0800)]
runtime: add explicit (void) in C to avoid GCC 7 problem

This avoids errors like
    ./traceback.go:80:2: call of non-function C.f1

I filed https://gcc.gnu.org/PR79289 for the GCC problem. I think this
is a bug in GCC, and it may be fixed before the final GCC 7 release.
This CL is correct either way.

Fixes #18855.

Change-Id: I0785a7b7c5b1d0ca87b454b5eca9079f390fcbd4
Reviewed-on: https://go-review.googlesource.com/35919
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
7 years agocmd/dist: use the target GOOS to skip the test for issue 18153
Elias Naur [Sun, 29 Jan 2017 22:57:14 +0000 (23:57 +0100)]
cmd/dist: use the target GOOS to skip the test for issue 18153

Fixes (skips) the test on Android, where stdout/stderr are not
terminals.

Updates #18153

Change-Id: Ieca65150362a5c423747ad751e00f76f0b890746
Reviewed-on: https://go-review.googlesource.com/35957
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: update go1.8 release notes after TxOptions change
Daniel Theophanes [Sat, 28 Jan 2017 15:36:09 +0000 (07:36 -0800)]
doc: update go1.8 release notes after TxOptions change

Missed the release notes when updating the sql API.

Fixes #18825

Change-Id: I89056d46939ad4fc99590f3434d2881f5764e1b6
Reviewed-on: https://go-review.googlesource.com/35915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: update alldocs after CL 35150
Alberto Donizetti [Sat, 28 Jan 2017 10:56:15 +0000 (11:56 +0100)]
cmd/go: update alldocs after CL 35150

Author of CL 35150 forgot to run mkalldocs.sh to update
the autogenerated alldocs.go

Change-Id: Ib824562db6044702456a221a8c6f9af412927a98
Reviewed-on: https://go-review.googlesource.com/35952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: use CMPWU for 32-bit or smaller unsigned Geq on ppc64{,le}
Michael Munday [Fri, 27 Jan 2017 04:31:28 +0000 (23:31 -0500)]
cmd/compile: use CMPWU for 32-bit or smaller unsigned Geq on ppc64{,le}

Fixes #18808.

Change-Id: I49b266380b9d6804c9f6563ebac9c7c0e05f37f6
Reviewed-on: https://go-review.googlesource.com/35890
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years ago[dev.typealias] cmd/compile: avoid false positive cycles from type aliases
Matthew Dempsky [Thu, 26 Jan 2017 17:00:56 +0000 (09:00 -0800)]
[dev.typealias] cmd/compile: avoid false positive cycles from type aliases

For #18130.
Fixes #18640.

Change-Id: I26cf1d1b78cca6ef207cc4333f30a9011ef347c9
Reviewed-on: https://go-review.googlesource.com/35831
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agodoc: document go1.7.5
Chris Broadfoot [Thu, 26 Jan 2017 17:30:04 +0000 (09:30 -0800)]
doc: document go1.7.5

Change-Id: Ic8d4e971edebba9412f2e7c3d3c29f296c4977ff
Reviewed-on: https://go-review.googlesource.com/35833
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: don't reject ./... matching top-level file outside GOPATH
Ian Lance Taylor [Wed, 25 Jan 2017 14:25:17 +0000 (06:25 -0800)]
cmd/go: don't reject ./... matching top-level file outside GOPATH

This unwinds a small part of CL 31668: we now accept "./." in cleanImport.

Fixes #18778.

Change-Id: Ia7f1fde1cafcea3cc9e0b597a95a0e0bb410a3ed
Reviewed-on: https://go-review.googlesource.com/35646
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agodatabase/sql: fix race when canceling queries immediately
Daniel Theophanes [Sat, 21 Jan 2017 01:12:50 +0000 (17:12 -0800)]
database/sql: fix race when canceling queries immediately

Previously the following could happen, though in practice it would
be rare.

Goroutine 1:
(*Tx).QueryContext begins a query, passing in userContext

Goroutine 2:
(*Tx).awaitDone starts to wait on the context derived from the passed in context

Goroutine 1:
(*Tx).grabConn returns a valid (*driverConn)
The (*driverConn) passes to (*DB).queryConn

Goroutine 3:
userContext is canceled

Goroutine 2:
(*Tx).awaitDone unblocks and calls (*Tx).rollback
(*driverConn).finalClose obtains dc.Mutex
(*driverConn).finalClose sets dc.ci = nil

Goroutine 1:
(*DB).queryConn obtains dc.Mutex in withLock
ctxDriverPrepare accepts dc.ci which is now nil
ctxCriverPrepare panics on the nil ci

The fix for this is to guard the Tx methods with a RWLock
holding it exclusivly when closing the Tx and holding a read lock
when executing a query.

Fixes #18719

Change-Id: I37aa02c37083c9793dabd28f7f934a1c5cbc05ea
Reviewed-on: https://go-review.googlesource.com/35550
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agogo/printer: fix format with leading comments in composite literal
Robert Griesemer [Wed, 25 Jan 2017 23:05:39 +0000 (15:05 -0800)]
go/printer: fix format with leading comments in composite literal

This fix is less pervasive than it seems. The only change affecting
formatting is on printer.go:760. The remaining changes have no effect
on formatting since the value of p.level is ignored except on this
specific line.

The remaining changes are:
- renamed adjBlock to funcBody since that's how it is used
- introduced new printer field 'level' tracking the composite
  literal nesting level
- update/restore the composite literal nesting level as needed

Fixes #18782.

Change-Id: Ie833a9b5a559c4ec0f2eef2c5dc97aa263dca53a
Reviewed-on: https://go-review.googlesource.com/35811
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: reorder modules so main.main comes first
David Crawshaw [Wed, 25 Jan 2017 04:19:36 +0000 (20:19 -0800)]
runtime: reorder modules so main.main comes first

Modules appear in the moduledata linked list in the order they are
loaded by the dynamic loader, with one exception: the
firstmoduledata itself the module that contains the runtime.
This is not always the first module (when using -buildmode=shared,
it is typically libstd.so, the second module).

The order matters for typelinksinit, so we swap the first module
with whatever module contains the main function.

Updates #18729

This fixes the test case extracted with -linkshared, and now

go test -linkshared encoding/...

passes. However the original issue about a plugin failure is not
yet fixed.

Change-Id: I9f399ecc3518e22e6b0a350358e90b0baa44ac96
Reviewed-on: https://go-review.googlesource.com/35644
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodatabase/sql: let tests wait for db pool to come to expected state
Daniel Theophanes [Wed, 25 Jan 2017 16:27:45 +0000 (08:27 -0800)]
database/sql: let tests wait for db pool to come to expected state

Slower builders were failing TestQueryContext because the cancel
and return to conn pool happens async. TestQueryContext already
uses a wait method for this reason. Use the same method for
other context tests.

Fixes #18759

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

7 years ago[dev.typealias] reflect: add test for type aliases
Russ Cox [Tue, 24 Jan 2017 19:59:22 +0000 (14:59 -0500)]
[dev.typealias] reflect: add test for type aliases

For #18130.

Change-Id: Idd77cb391178c185227cfd779c70fec16351f825
Reviewed-on: https://go-review.googlesource.com/35733
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years ago[dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
Russ Cox [Wed, 25 Jan 2017 15:19:33 +0000 (10:19 -0500)]
[dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune

Will also fix type aliases.

Fixes #17766.
For #18130.

Change-Id: I9e1584d47128782152e06abd0a30ef423d5c30d2
Reviewed-on: https://go-review.googlesource.com/35732
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years ago[dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
Russ Cox [Wed, 25 Jan 2017 14:50:36 +0000 (09:50 -0500)]
[dev.typealias] reflect: fix StructOf use of StructField to match StructField docs

The runtime internal structField interprets name=="" as meaning anonymous,
but the exported reflect.StructField has always set Name, even for anonymous
fields, and also set Anonymous=true.

The initial implementation of StructOf confused the internal and public
meanings of the StructField, expecting the runtime representation of
anonymous fields instead of the exported reflect API representation.
It also did not document this fact, so that users had no way to know how
to create an anonymous field.

This CL changes StructOf to use the previously documented interpretation
of reflect.StructField instead of an undocumented one.

The implementation of StructOf also, in some cases, allowed creating
structs with unexported fields (if you knew how to ask) but set the
PkgPath incorrectly on those fields. Rather than try to fix that, this CL
changes StructOf to reject attempts to create unexported fields.
(I think that may be the right design choice, not just a temporary limitation.
In any event, it's not the topic for today's work.)

For #17766.
Fixes #18780.

Change-Id: I585a4e324dc5a90551f49d21ae04d2de9ea04b6c
Reviewed-on: https://go-review.googlesource.com/35731
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years ago[dev.typealias] cmd/doc: update for type alias
Russ Cox [Tue, 24 Jan 2017 19:53:31 +0000 (14:53 -0500)]
[dev.typealias] cmd/doc: update for type alias

For #18130.

Change-Id: I06b05a2b45a2aa6764053fc51e05883063572dad
Reviewed-on: https://go-review.googlesource.com/35670
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years ago[dev.typealias] cmd/compile: declare methods after resolving receiver type
Matthew Dempsky [Mon, 23 Jan 2017 22:24:24 +0000 (14:24 -0800)]
[dev.typealias] cmd/compile: declare methods after resolving receiver type

For #18130.
Fixes #18655.

Change-Id: I58e2f076b9d8273f128cc033bba9edcd06c81567
Reviewed-on: https://go-review.googlesource.com/35575
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years ago[dev.typealias] test: match gccgo error messages on alias2.go
Ian Lance Taylor [Tue, 24 Jan 2017 20:43:52 +0000 (12:43 -0800)]
[dev.typealias] test: match gccgo error messages on alias2.go

For #18130.

Change-Id: I9561ee2b8a9f7b11f0851f281a899f78b9e9703e
Reviewed-on: https://go-review.googlesource.com/35640
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agodoc: update gccgo docs
Ian Lance Taylor [Tue, 24 Jan 2017 17:32:29 +0000 (09:32 -0800)]
doc: update gccgo docs

Update docs on correspondence between Go releases and GCC releases.

Update C type that corresponds to Go type `int`.

Drop out of date comments about Ubuntu and RTEMS.

Change-Id: Ic1b5ce9f242789af23ec3b7e7a64c9d257d6913e
Reviewed-on: https://go-review.googlesource.com/35631
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: clarify what to do with Go 1.4 when installing from source
Ian Lance Taylor [Tue, 24 Jan 2017 17:56:57 +0000 (09:56 -0800)]
doc: clarify what to do with Go 1.4 when installing from source

You have to actually run make.bash (or make.bat).

Update #18771.

Change-Id: Ie6672a4e4abde0150c1ae57cabb1222de2c78716
Reviewed-on: https://go-review.googlesource.com/35632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: note that plugins are not fully baked
Brad Fitzpatrick [Mon, 23 Jan 2017 20:55:17 +0000 (20:55 +0000)]
doc: note that plugins are not fully baked

Change-Id: I6341b8cce0b4a9922928f73f8b459cbb9ec25e79
Reviewed-on: https://go-review.googlesource.com/35571
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years agonet/http: don't send body on redirects for 301, 302, 303 when GetBody is set
Brad Fitzpatrick [Tue, 24 Jan 2017 17:52:54 +0000 (17:52 +0000)]
net/http: don't send body on redirects for 301, 302, 303 when GetBody is set

The presence of Request.GetBody being set on a request was causing all
redirected requests to have a body, even if the redirect status didn't
warrant one.

This bug came from 307/308 support (https://golang.org/cl/29852) which
removed the line that set req.Body to nil after POST/PUT redirects.

Change-Id: I2a4dd5320f810ae25cfd8ea8ca7c9700e5dbd369
Reviewed-on: https://go-review.googlesource.com/35633
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years agonet/http: fix a nit
Mikio Hara [Tue, 24 Jan 2017 10:46:27 +0000 (19:46 +0900)]
net/http: fix a nit

Change-Id: I31fa5f906ad2e8dc475dbbeb91f568f91e16861b
Reviewed-on: https://go-review.googlesource.com/35514
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/link: mark DWARF function symbols as reachable
Ian Lance Taylor [Tue, 24 Jan 2017 01:30:41 +0000 (17:30 -0800)]
cmd/link: mark DWARF function symbols as reachable

Otherwise we don't emit any required ELF relocations when doing an
external link, because elfrelocsect skips unreachable symbols.

Fixes #18745.

Change-Id: Ia3583c41bb6c5ebb7579abd26ed8689370311cd6
Reviewed-on: https://go-review.googlesource.com/35590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
7 years ago[dev.typealias] cmd/compile: change Func.Shortname to *Sym
Matthew Dempsky [Mon, 23 Jan 2017 21:40:25 +0000 (13:40 -0800)]
[dev.typealias] cmd/compile: change Func.Shortname to *Sym

A Func's Shortname is just an identifier. No need for an entire ONAME
Node.

Change-Id: Ie4d397e8d694c907fdf924ce57bd96bdb4aaabca
Reviewed-on: https://go-review.googlesource.com/35574
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agodoc: mention testing.MainStart signature change
Brad Fitzpatrick [Mon, 23 Jan 2017 22:26:27 +0000 (22:26 +0000)]
doc: mention testing.MainStart signature change

Fixes #18766

Change-Id: Ic0f72f3b7bbccd0546692993c4ed414f8c88c1c6
Reviewed-on: https://go-review.googlesource.com/35573
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agoruntime: amd64, use 4-byte ops for memmove of 4 bytes
Keith Randall [Mon, 23 Jan 2017 16:22:10 +0000 (08:22 -0800)]
runtime: amd64, use 4-byte ops for memmove of 4 bytes

memmove used to use 2 2-byte load/store pairs to move 4 bytes.
When the result is loaded with a single 4-byte load, it caused
a store to load fowarding stall.  To avoid the stall,
special case memmove to use 4 byte ops for the 4 byte copy case.

We already have a special case for 8-byte copies.
386 already specializes 4-byte copies.
I'll do 2-byte copies also, but not for 1.8.

benchmark                 old ns/op     new ns/op     delta
BenchmarkIssue18740-8     7567          4799          -36.58%

3-byte copies get a bit slower.  Other copies are unchanged.
name         old time/op   new time/op   delta
Memmove/3-8   4.76ns ± 5%   5.26ns ± 3%  +10.50%  (p=0.000 n=10+10)

Fixes #18740

Change-Id: Iec82cbac0ecfee80fa3c8fc83828f9a1819c3c74
Reviewed-on: https://go-review.googlesource.com/35567
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years agocmd/compile: fix constant propagation through s390x MOVDNE instructions
Michael Munday [Sat, 21 Jan 2017 03:03:13 +0000 (22:03 -0500)]
cmd/compile: fix constant propagation through s390x MOVDNE instructions

The constant propagation rules selected the wrong operand to
propagate. So MOVDNE (move if not equal) propagated operands as if
it were a MOVDEQ (move if equal).

Fixes #18735.

Change-Id: I87ac469172f9df7d5aabaf7106e2936ce54ae202
Reviewed-on: https://go-review.googlesource.com/35498
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agomisc/cgo/test: pass current environment to syscall.Exec
Ian Lance Taylor [Fri, 20 Jan 2017 06:07:20 +0000 (22:07 -0800)]
misc/cgo/test: pass current environment to syscall.Exec

This is needed for typical tests with gccgo, as it passes the
LD_LIBRARY_PATH environment variable to the new program.

Change-Id: I9bf4b0dbdff63f5449c7fcb8124eaeab10ed7f34
Reviewed-on: https://go-review.googlesource.com/35481
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agomisc/cgo/test: fix test when using GCC 7
Ian Lance Taylor [Fri, 20 Jan 2017 06:04:45 +0000 (22:04 -0800)]
misc/cgo/test: fix test when using GCC 7

With GCC 7 (not yet released), cgo fails with errors like

./sigaltstack.go:65:8: call of non-function C.restoreSignalStack

I do not know precisely why. Explicitly declaring that there are no
arguments to the static function is a simple fix for the debug info.

Change-Id: Id96e1cb1e55ee37a9f1f5ad243d7ee33e71584ac
Reviewed-on: https://go-review.googlesource.com/35480
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: don't use nilcheck information until the next block
Keith Randall [Fri, 20 Jan 2017 17:54:10 +0000 (09:54 -0800)]
cmd/compile: don't use nilcheck information until the next block

When nilcheck runs, the values in a block are not in any particular
order.  So any facts derived from examining the blocks shouldn't be
used until we reach the next block.

This is suboptimal as it won't eliminate nil checks within a block.
But it's probably a better fix for now as it is a much smaller change
than other strategies for fixing this bug.

nilptr3.go changes are mostly because for this pattern:
  _ = *p
  _ = *p
either nil check is fine to keep, and this CL changes which one
the compiler tends to keep.
There are a few regressions from code like this:
  _ = *p
  f()
  _ = *p
For this pattern, after this CL we issue 2 nil checks instead of one.
(For the curious, this happens because intra-block nil check
 elimination now falls to CSE, not nilcheck proper.  The former
 pattern has two nil checks with the same store argument.  The latter
 pattern has two nil checks with different store arguments.)

Fixes #18725

Change-Id: I3721b494c8bc9ba1142dc5c4361ea55c66920ac8
Reviewed-on: https://go-review.googlesource.com/35485
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agocmd/compile: fix compilebench -alloc
Josh Bleecher Snyder [Fri, 20 Jan 2017 16:11:34 +0000 (08:11 -0800)]
cmd/compile: fix compilebench -alloc

pprof.WriteHeapProfile is shorthand for
pprof.Lookup("heap").WriteTo(f, 0).
The second parameter is debug.
If it is non-zero, pprof writes legacy-format
pprof output, which compilebench can parse.

Fixes #18641

Change-Id: Ica69adeb9809e9b5933aed943dcf4a07910e43fc
Reviewed-on: https://go-review.googlesource.com/35484
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years ago[dev.typealias] go/internal/gccgoimporter: support for type aliases
Robert Griesemer [Tue, 17 Jan 2017 23:06:04 +0000 (15:06 -0800)]
[dev.typealias] go/internal/gccgoimporter: support for type aliases

For #18130.

Change-Id: Iac182a6c5bc62633eb02191d9da6166d3b254c4c
Reviewed-on: https://go-review.googlesource.com/35268
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years ago[dev.typealias] cmd/compile: export/import test cases for type aliases
Robert Griesemer [Sat, 14 Jan 2017 01:23:01 +0000 (17:23 -0800)]
[dev.typealias] cmd/compile: export/import test cases for type aliases

Plus a few minor changes.

For #18130.

Change-Id: Ica6503fe9c888cc05c15b46178423f620c087491
Reviewed-on: https://go-review.googlesource.com/35233
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years agoruntime: check for nil g and m in msanread
Bryan C. Mills [Wed, 18 Jan 2017 20:12:18 +0000 (15:12 -0500)]
runtime: check for nil g and m in msanread

fixes #18707.

Change-Id: Ibc4efef01197799f66d10bfead22faf8ac00473c
Reviewed-on: https://go-review.googlesource.com/35452
Run-TryBot: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agogo/ast: fix Object's doc comment about Data
Hironao OTSUBO [Thu, 12 Jan 2017 14:21:53 +0000 (23:21 +0900)]
go/ast: fix Object's doc comment about Data

The doc comment about the Data field of go/ast.Object reflects its old
behavior, from when the go/types typechecker depended on ast.Objects.

Since when the doc was written, the behavior has changed in
https://golang.org/cl/7058060 and https://golang.org/cl/7096048 .

Fixes #18631

Change-Id: I10fc3e31cfbf7b303eec44150df917f6eb285f90
Reviewed-on: https://go-review.googlesource.com/35075
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agoruntime: force workers out before checking mark roots
Austin Clements [Wed, 18 Jan 2017 02:58:10 +0000 (21:58 -0500)]
runtime: force workers out before checking mark roots

Currently we check that all roots are marked as soon as gcMarkDone
decides to transition from mark 1 to mark 2. However, issue #16083
indicates that there may be a race where we try to complete mark 1
while a worker is still scanning a stack, causing the root mark check
to fail.

We don't yet understand this race, but as a simple mitigation, move
the root check to after gcMarkDone performs a ragged barrier, which
will force any remaining workers to finish their current job.

Updates #16083. This may "fix" it, but it would be better to
understand and fix the underlying race.

Change-Id: I1af9ce67bd87ade7bc2a067295d79c28cd11abd2
Reviewed-on: https://go-review.googlesource.com/35353
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
7 years agotesting: make parallel t.Run safe again
Russ Cox [Wed, 18 Jan 2017 05:05:32 +0000 (00:05 -0500)]
testing: make parallel t.Run safe again

Fixes #18603.

Change-Id: I5760c0a9f862200b7e943058a672eb559ac1b9d9
Reviewed-on: https://go-review.googlesource.com/35354
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocrypto/x509: revert SystemCertPool implementation for Windows
Brad Fitzpatrick [Tue, 17 Jan 2017 21:24:17 +0000 (21:24 +0000)]
crypto/x509: revert SystemCertPool implementation for Windows

Updates #18609

Change-Id: I8306135660f52cf625bed4c7f53f632e527617de
Reviewed-on: https://go-review.googlesource.com/35265
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
7 years agodoc/go1.8: document Plan 9 requirements
David du Colombier [Wed, 18 Jan 2017 00:10:18 +0000 (01:10 +0100)]
doc/go1.8: document Plan 9 requirements

Fixes #18610.

Change-Id: I19da4d59a1b6293c9a4722aa696e2cb58d982a15
Reviewed-on: https://go-review.googlesource.com/35333
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: for plugins, don't add duplicate itabs
Keith Randall [Wed, 11 Jan 2017 23:14:06 +0000 (15:14 -0800)]
runtime: for plugins, don't add duplicate itabs

We already do this for shared libraries. Do it for plugins also.
Suggestions on how to test this would be welcome.

I'd like to get this in for 1.8.  It could lead to mysterious
hangs when using plugins.

Fixes #18676

Change-Id: I03209b096149090b9ba171c834c5e59087ed0f92
Reviewed-on: https://go-review.googlesource.com/35117
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
7 years agoREADME.md: update and simplify
Alberto Donizetti [Mon, 16 Jan 2017 11:25:33 +0000 (12:25 +0100)]
README.md: update and simplify

Fixes #18675

Change-Id: I82e63e8ee3fe4a998b01d9397c3045912588e2f5
Reviewed-on: https://go-review.googlesource.com/35183
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: fix bug help message
gulyasm [Thu, 12 Jan 2017 13:26:00 +0000 (14:26 +0100)]
cmd/go: fix bug help message

The bug subcommand opens up the browser instead of printing information.
Fixes help message to reflect that.

Fixes #18630.

Change-Id: I660c94bc65ef1994292cfd72d08a544699545701
Reviewed-on: https://go-review.googlesource.com/35150
Reviewed-by: Russ Cox <rsc@golang.org>
7 years ago[dev.typealias] go/types: clarified doc string
Robert Griesemer [Tue, 17 Jan 2017 19:40:04 +0000 (11:40 -0800)]
[dev.typealias] go/types: clarified doc string

Also: removed internal TODO and added better comment

Fixes #18644.

Change-Id: I3e3763d3afdad6937173cdd32fc661618fb60820
Reviewed-on: https://go-review.googlesource.com/35245
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agocrypto/tls: disable CBC cipher suites with SHA-256 by default
Filippo Valsorda [Mon, 16 Jan 2017 23:54:45 +0000 (23:54 +0000)]
crypto/tls: disable CBC cipher suites with SHA-256 by default

As is, they were fully vulnerable to the Lucky13 attack. The SHA1
variants implement limited countermeasures (see f28cf8346c4) but the
SHA256 ones are apparently used rarely enough (see 8741504888b) that
it's not worth the extra code.

Instead, disable them by default and update the warning.

Updates #13385
Updates #15487

Change-Id: I45b8b716001e2fa0811b17e25be76e2512e5abb2
Reviewed-on: https://go-review.googlesource.com/35290
Reviewed-by: Adam Langley <alangley@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/compile: add ZeroWB case in writebarrier
Cherry Zhang [Fri, 13 Jan 2017 20:42:50 +0000 (15:42 -0500)]
cmd/compile: add ZeroWB case in writebarrier

It looks like it should be there, although I couldn't find a test
case that fails without it. ZeroWB is probably never generated now:
zeroing an initialized heap object is done by making an autotmp on
stack, zeroing it, and copying (typedmemmove) to heap.

Passes "toolstash -cmp" on std.

Change-Id: I702a59759e33fb8cc2a34a3b3029e7540aca080a
Reviewed-on: https://go-review.googlesource.com/35250
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodoc: 2017 is the Year of the Gopher
Brad Fitzpatrick [Mon, 16 Jan 2017 01:48:42 +0000 (01:48 +0000)]
doc: 2017 is the Year of the Gopher

Change-Id: Iac713ae1f322f893c92b3fc47fe9b5719052f9eb
Reviewed-on: https://go-review.googlesource.com/35240
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
7 years agocmd/compile: lvalues are only required for == when calling runtime fns
Josh Bleecher Snyder [Sun, 15 Jan 2017 05:40:16 +0000 (21:40 -0800)]
cmd/compile: lvalues are only required for == when calling runtime fns

Fixes #18661.

Change-Id: I865802a9b88ab22560c9914a70901d1924242bdc
Reviewed-on: https://go-review.googlesource.com/35236
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agovendor/golang_org/x/crypto/poly1305: revendor to pick up fix for #18673
Shenghou Ma [Mon, 16 Jan 2017 01:39:10 +0000 (20:39 -0500)]
vendor/golang_org/x/crypto/poly1305: revendor to pick up fix for #18673

Fixes #18673.

Change-Id: Ic827c16ad414733392c348da1c9ed9b308879fef
Reviewed-on: https://go-review.googlesource.com/35260
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agonet/http: skip TestServerHijackGetsBackgroundByte on Plan 9
David du Colombier [Sat, 14 Jan 2017 13:13:58 +0000 (14:13 +0100)]
net/http: skip TestServerHijackGetsBackgroundByte on Plan 9

CL 5232 added TestServerHijackGetsBackgroundByte, which is failing
on Plan 9, because CloseWrite is not implemented on Plan 9 yet.

Updates #17906.
Updates #18657.

Change-Id: I3c2f73760b0f767f3f9ed2698c855372170e0481
Reviewed-on: https://go-review.googlesource.com/35178
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: skip TestServerHijackGetsBackgroundByte_big on Plan 9
David du Colombier [Sat, 14 Jan 2017 13:27:40 +0000 (14:27 +0100)]
net/http: skip TestServerHijackGetsBackgroundByte_big on Plan 9

CL 35234 added TestServerHijackGetsBackgroundByte_big, which is failing
on Plan 9, because CloseWrite is not implemented on Plan 9 yet.

Updates #17906.
Updates #18658.

Change-Id: Icaf3fe3600d586515ecd92aca874104ea81ce6b9
Reviewed-on: https://go-review.googlesource.com/35179
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: add another hijack-after-background-read test
Brad Fitzpatrick [Sat, 14 Jan 2017 03:19:54 +0000 (03:19 +0000)]
net/http: add another hijack-after-background-read test

Follow-up test from Ian's comments in https://golang.org/cl/35232
after submit.

Change-Id: Ifa504bd8d09e555c3c7738376199dfc9b99130cf
Reviewed-on: https://go-review.googlesource.com/35234
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years agoall: test adjustments for the iOS builder
David Crawshaw [Sat, 14 Jan 2017 03:08:27 +0000 (22:08 -0500)]
all: test adjustments for the iOS builder

The working directory is now adjusted to match the typical Go test
working directory in main, as the old trick for adjusting earlier
stopped working with the latest version of LLDB bugs.

That means the small number of places where testdata files are
read before main is called no longer work. This CL adjusts those
reads to happen after main is called. (This has the bonus effect of
not reading some benchmark testdata files in all.bash.)

Fixes compress/bzip2, go/doc, go/parser, os, and time package
tests on the iOS builder.

Change-Id: If60f026aa7848b37511c36ac5e3985469ec25209
Reviewed-on: https://go-review.googlesource.com/35255
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agonet/http: make sure Hijack's bufio.Reader includes pre-read background byte
Brad Fitzpatrick [Fri, 13 Jan 2017 21:43:56 +0000 (21:43 +0000)]
net/http: make sure Hijack's bufio.Reader includes pre-read background byte

Previously, if the Hijack called stopped the background read call
which read a byte, that byte was sitting in memory, buffered, ready to
be Read by Hijack's returned bufio.Reader, but it wasn't yet in the
bufio.Reader's buffer itself, so bufio.Reader.Buffered() reported 1
byte fewer.

This matters for callers who wanted to stitch together any buffered
data (with bufio.Reader.Peek(bufio.Reader.Buffered())) with Hijack's
returned net.Conn. Otherwise there was no way for callers to know a
byte was read.

Change-Id: Id7cb0a0a33fe2f33d79250e13dbaa9c0f7abba13
Reviewed-on: https://go-review.googlesource.com/35232
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years ago[dev.inline] cmd/compile: parse source files concurrently
Matthew Dempsky [Wed, 11 Jan 2017 23:48:30 +0000 (15:48 -0800)]
[dev.inline] cmd/compile: parse source files concurrently

Conversion to Nodes still happens sequentially at the moment.

Change-Id: I3407ba0711b8b92e22ece0a06fefaff863c3ccc9
Reviewed-on: https://go-review.googlesource.com/35126
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.inline] cmd/compile: reorganize file parsing logic
Matthew Dempsky [Wed, 11 Jan 2017 23:31:48 +0000 (15:31 -0800)]
[dev.inline] cmd/compile: reorganize file parsing logic

Preparation for concurrent parsing. No behavior change.

Change-Id: Ic1ec45fc3cb316778c29065cf055c82e92ffa874
Reviewed-on: https://go-review.googlesource.com/35125
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.inline] cmd/compile: split mkpackage into separate functions
Matthew Dempsky [Wed, 11 Jan 2017 23:20:38 +0000 (15:20 -0800)]
[dev.inline] cmd/compile: split mkpackage into separate functions

Previously, mkpackage jumbled together three unrelated tasks: handling
package declarations, clearing imports from processing previous source
files, and assigning a default value to outfile.

Change-Id: I1e124335768aeabfd1a6d9cc2499fbb980d951cf
Reviewed-on: https://go-review.googlesource.com/35124
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/go, misc: rework cwd handling for iOS tests
David Crawshaw [Fri, 13 Jan 2017 12:18:40 +0000 (07:18 -0500)]
cmd/go, misc: rework cwd handling for iOS tests

Another change in behvaior (bug) in LLDB. Despite the fact that
LLDB can dump the symtab of our test binaries and show the function
addresses, it can no longer call the functions. This means the chdir
trick on signal is failing.

This CL uses a new trick. For iOS, the exec script passes the change
in directory as an argument, and it is processed early by the test
harness generated by cmd/go.

For the iOS builders.

Change-Id: I8f5d0f831fe18de99f097761f89c5184d5bf2afb
Reviewed-on: https://go-review.googlesource.com/35152
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agosyscall: export Fsid.X__val on s390x
Michael Munday [Fri, 30 Sep 2016 15:12:01 +0000 (11:12 -0400)]
syscall: export Fsid.X__val on s390x

mkpost.go replaces all variables prefixed with 'X_' with '_' on s390x
because most of them do not need to be exposed. X__val is being used
by a third party library so it turns out we do need to expose it on
s390x (it is already exposed on all other Linux architectures).

Fixes #17298 and updates #18632.

Change-Id: Ic03463229a5f75ca41a4a4b50300da4b4d892d45
Reviewed-on: https://go-review.googlesource.com/30130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/gdb: mention GOTRACEBACK=crash
Alberto Donizetti [Mon, 9 Jan 2017 18:11:58 +0000 (19:11 +0100)]
doc/gdb: mention GOTRACEBACK=crash

Also fix a couple of other errors.

Fixes #6877

Change-Id: I94c81c5847cc7b0adab19418e71687bc2ee7fe94
Reviewed-on: https://go-review.googlesource.com/34960
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agomisc/cgo/testplugin: test that types and itabs are unique
Keith Randall [Wed, 11 Jan 2017 23:08:08 +0000 (15:08 -0800)]
misc/cgo/testplugin: test that types and itabs are unique

Make sure that the same type and itab generated in two
different plugins are actually the same thing.

See also CL 35115

Change-Id: I0c1ecb039d7e2bf5a601d58dfa162a435ae4ef76
Reviewed-on: https://go-review.googlesource.com/35116
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
7 years agoreflect: keep makeFuncImpl live across makeFuncStub
Austin Clements [Thu, 12 Jan 2017 21:54:42 +0000 (16:54 -0500)]
reflect: keep makeFuncImpl live across makeFuncStub

When traceback sees reflect.makeFuncStub (or reflect.methodValueCall)
on the stack, it expects to be able to get the *reflect.makeFuncImpl
(or *reflect.methodValue) for that call from the first outgoing
argument slot of makeFuncStub/methodValueCall.

However, currently this object isn't necessarily kept live across
makeFuncStub. This means it may get garbage collected while in a
reflect call and reused for something else. If we then try to
traceback, the runtime will see a corrupted makeFuncImpl object and
panic. This was not a problem in previous releases because we always
kept arguments live across the whole function. This became a problem
when we stopped doing this.

Fix this by using reflect.KeepAlive to keep the
makeFuncImpl/methodValue live across all of callReflect/callMethod,
which in turn keeps it live as long as makeFuncStub/methodValueCall
are on the stack.

Fixes #18635.

Change-Id: I91853efcf17912390fddedfb0230648391c33936
Reviewed-on: https://go-review.googlesource.com/35151
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/link: only exclude C-only symbols on darwin
David Crawshaw [Thu, 12 Jan 2017 22:35:53 +0000 (17:35 -0500)]
cmd/link: only exclude C-only symbols on darwin

C-only symbols are excluded from pclntab because of a quirk of darwin,
where functions are referred to by an exported symbol so dynamic
relocations de-duplicate to the host binary module and break unwinding.

This doesn't happen on ELF systems because the linker always refers to
unexported module-local symbols, so we don't need this condition.
And the current logic for excluding some functions breaks the module
verification code in moduledataverify1. So disable this for plugins
on linux.

(In 1.9, it will probably be necessary to introduce a module-local
symbol reference system on darwin to fix a different bug, so all of
this onlycsymbol code made be short-lived.)

With this CL, the tests in CL 35116 pass.

Change-Id: I517d7ca4427241fa0a91276c462827efb9383be9
Reviewed-on: https://go-review.googlesource.com/35190
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.typealias] cmd/compile: a few better comments related to alias types
Robert Griesemer [Thu, 12 Jan 2017 23:21:21 +0000 (15:21 -0800)]
[dev.typealias] cmd/compile: a few better comments related to alias types

For #18130.

Change-Id: I50bded3af0db673fc92b20c41a86b9cae614acd9
Reviewed-on: https://go-review.googlesource.com/35191
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years ago[dev.typealias] cmd/compile: improved error message for cyles involving type aliases
Robert Griesemer [Thu, 12 Jan 2017 22:35:20 +0000 (14:35 -0800)]
[dev.typealias] cmd/compile: improved error message for cyles involving type aliases

Known issue: #18640 (requires a bit more work, I believe).

For #18130.

Change-Id: I53dc26012070e0c79f63b7c76266732190a83d47
Reviewed-on: https://go-review.googlesource.com/35129
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years ago[dev.typealias] cmd/compile: type-check type alias declarations
Robert Griesemer [Wed, 11 Jan 2017 19:24:35 +0000 (11:24 -0800)]
[dev.typealias] cmd/compile: type-check type alias declarations

Known issues:
- needs many more tests
- duplicate method declarations via type alias names are not detected
- type alias cycle error messages need to be improved
- need to review setup of byte/rune type aliases

For #18130.

Change-Id: Icc2fefad6214e5e56539a9dcb3fe537bf58029f8
Reviewed-on: https://go-review.googlesource.com/35121
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agocompress/flate: avoid large stack growth in fillDeflate
Joe Tsai [Thu, 12 Jan 2017 07:03:15 +0000 (23:03 -0800)]
compress/flate: avoid large stack growth in fillDeflate

Ranging over an array causes the array to be copied over to the
stack, which cause large re-growths. Instead, we should iterate
over slices of the array.

Also, assigning a large struct literal uses the stack even
though the actual fields being populated are small in comparison
to the entirety of the struct (see #18636).

Fixing the stack growth does not alter CPU-time performance much
since the stack-growth and copying was such a tiny portion of the
compression work:

name                         old time/op    new time/op    delta
Encode/Digits/Default/1e4-8     332µs ± 1%     332µs ± 1%   ~     (p=0.796 n=10+10)
Encode/Digits/Default/1e5-8    5.07ms ± 2%    5.05ms ± 1%   ~       (p=0.815 n=9+8)
Encode/Digits/Default/1e6-8    53.7ms ± 1%    53.9ms ± 1%   ~     (p=0.075 n=10+10)
Encode/Twain/Default/1e4-8      380µs ± 1%     380µs ± 1%   ~     (p=0.684 n=10+10)
Encode/Twain/Default/1e5-8     5.79ms ± 2%    5.79ms ± 1%   ~      (p=0.497 n=9+10)
Encode/Twain/Default/1e6-8     61.5ms ± 1%    61.8ms ± 1%   ~     (p=0.247 n=10+10)

name                         old speed      new speed      delta
Encode/Digits/Default/1e4-8  30.1MB/s ± 1%  30.1MB/s ± 1%   ~     (p=0.753 n=10+10)
Encode/Digits/Default/1e5-8  19.7MB/s ± 2%  19.8MB/s ± 1%   ~       (p=0.795 n=9+8)
Encode/Digits/Default/1e6-8  18.6MB/s ± 1%  18.5MB/s ± 1%   ~     (p=0.072 n=10+10)
Encode/Twain/Default/1e4-8   26.3MB/s ± 1%  26.3MB/s ± 1%   ~     (p=0.616 n=10+10)
Encode/Twain/Default/1e5-8   17.3MB/s ± 2%  17.3MB/s ± 1%   ~      (p=0.484 n=9+10)
Encode/Twain/Default/1e6-8   16.3MB/s ± 1%  16.2MB/s ± 1%   ~     (p=0.238 n=10+10)

Updates #18636
Fixes #18625

Change-Id: I471b20339bf675f63dc56d38b3acdd824fe23328
Reviewed-on: https://go-review.googlesource.com/35122
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/go: add comment about SIGUSR2 on iOS
David Crawshaw [Thu, 12 Jan 2017 15:49:35 +0000 (10:49 -0500)]
cmd/go: add comment about SIGUSR2 on iOS

Missing from CL 34926.

Change-Id: I4a046440c30811f26da53bee0e853dae3b0ac57a
Reviewed-on: https://go-review.googlesource.com/35123
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go, misc: switch from breakpoint to SIGUSR2
David Crawshaw [Sun, 8 Jan 2017 01:41:00 +0000 (17:41 -0800)]
cmd/go, misc: switch from breakpoint to SIGUSR2

The iOS test harness has set a breakpoint early in the life of Go
programs so that it can change the current working directory using
information only available from the host debugger. Somewhere in the
upgrade to iOS 10 / XCode 8.2, breakpoints stopped working. This
may be an LLDB bug, or a bug in the ios-deploy LLDB scripts, it's
not clear.

Work around the problem by giving up on breakpoints. Instead, early
in the life of every test binary built for iOS, send (and ignore) a
SIGUSR2 signal. The debugger will catch this, giving the script
go_darwin_arm_exec a chance to change the working directory.

For the iOS builders.

Change-Id: I7476531985217d0c76bc176904c48379210576c2
Reviewed-on: https://go-review.googlesource.com/34926
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodoc/go1.8: update timezone database version
Shenghou Ma [Thu, 12 Jan 2017 03:48:34 +0000 (22:48 -0500)]
doc/go1.8: update timezone database version

Fixes #18623.

Change-Id: Ic965f5f7088c3270adbca7162226be486d1b9b4e
Reviewed-on: https://go-review.googlesource.com/35130
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agomisc/cgo/testshared: test that types and itabs are unique
Keith Randall [Wed, 11 Jan 2017 23:02:16 +0000 (15:02 -0800)]
misc/cgo/testshared: test that types and itabs are unique

Make sure that the same type and itab generated in two
different shared library are actually the same thing.

Change-Id: Ica45862d65ff8bc7ad04d59a41f57223f71224cd
Reviewed-on: https://go-review.googlesource.com/35115
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: avoid clobbering C callee-save register in cgoSigtramp
Bryan C. Mills [Wed, 11 Jan 2017 22:39:41 +0000 (17:39 -0500)]
runtime: avoid clobbering C callee-save register in cgoSigtramp

Use R11 (a caller-saved temp register) instead of RBX (a callee-saved
register).

I believe this only affects linux/amd64, since it is the only platform
with a non-trivial cgoSigtramp implementation.

Updates #18328.

Change-Id: I3d35c4512624184d5a8ece653fa09ddf50e079a2
Reviewed-on: https://go-review.googlesource.com/35068
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/compile: hide testdclstack behind debug flag
Josh Bleecher Snyder [Wed, 11 Jan 2017 21:53:34 +0000 (13:53 -0800)]
cmd/compile: hide testdclstack behind debug flag

This reduces compilation time for the program
in #18602 from 7 hours to 30 min.

Updates #14781
Updates #18602

Change-Id: I3c4af878a08920e6373d3b3b0c4453ee002e32eb
Reviewed-on: https://go-review.googlesource.com/35113
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocompress/gzip: skip TestGZIPFilesHaveZeroMTimes on non-builders
Joe Tsai [Wed, 11 Jan 2017 07:13:45 +0000 (23:13 -0800)]
compress/gzip: skip TestGZIPFilesHaveZeroMTimes on non-builders

Fixes #18604

Change-Id: I89221d5e632042167dfced068e1dc14e932cd618
Reviewed-on: https://go-review.googlesource.com/35111
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocrypto/dsa: gofmt
Austin Clements [Wed, 11 Jan 2017 16:36:07 +0000 (11:36 -0500)]
crypto/dsa: gofmt

Somehow this file didn't get gofmted after the last change, which
interferes with merges.

Change-Id: I965cfdbf27a01124a6ed300be9687ff84f68f9a1
Reviewed-on: https://go-review.googlesource.com/35064
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Adam Langley <agl@chromium.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agonet/http: deflake TestRetryIdempotentRequestsOnError
Brad Fitzpatrick [Tue, 10 Jan 2017 23:42:06 +0000 (23:42 +0000)]
net/http: deflake TestRetryIdempotentRequestsOnError

The test was previously an integration test, relying on luck and many
goroutines and lots of time to hit the path to be tested.

Instead, rewrite the test to exactly hit the path to be tested, in one
try, in one goroutine.

Fixes #18205

Change-Id: I63cd513316344bfd7375dcc452c1c396dec0e49f
Reviewed-on: https://go-review.googlesource.com/35107
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc: remove inline styles
Jaana Burcu Dogan [Tue, 10 Jan 2017 19:25:14 +0000 (11:25 -0800)]
doc: remove inline styles

Change-Id: I7ca7e9a2d4cf97cf33c60a9a4d0ba5fb0ca6e44c
Reviewed-on: https://go-review.googlesource.com/35098
Reviewed-by: Chris Broadfoot <cbro@golang.org>
7 years ago[dev.typealias] cmd/compile: various minor cleanups
Robert Griesemer [Thu, 29 Dec 2016 23:49:01 +0000 (15:49 -0800)]
[dev.typealias] cmd/compile: various minor cleanups

Also: Don't allow type pragmas with type alias declarations.

For #18130.

Change-Id: Ie54ea5fefcd677ad87ced03466bbfd783771e974
Reviewed-on: https://go-review.googlesource.com/35102
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years ago[dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes
Robert Griesemer [Wed, 28 Dec 2016 00:53:33 +0000 (16:53 -0800)]
[dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes

cmd/compile:
- remove crud from prior alias implementation
- better comments in places

go/types:
- fix TypeName.IsAlias predicate
- more tests

go/importer (go/internal/gcimporter15):
- handle "@" format for anonymous fields using aliases
  (currently tested indirectly via x/tools/gcimporter15 tests)

For #18130.

Change-Id: I23a6d4e3a4c2a5c1ae589513da73fde7cad5f386
Reviewed-on: https://go-review.googlesource.com/35101
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years ago[dev.typealias] cmd/compile, go/importer: define export format and implement importin...
Robert Griesemer [Thu, 22 Dec 2016 21:04:04 +0000 (13:04 -0800)]
[dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases

This defines the (tentative) export/import format for type aliases.

The compiler doesn't support type aliases yet, so while the code is present
it is guarded with a flag.

The export format for embedded (anonymous) fields now has three modes (mode 3 is new):
1) The original type name and the anonymous field name are the same, and the name is exported:
   we don't need the field name and write "" instead
2) The original type name and the anonymous field name are the same, and the name is not exported:
   we don't need the field name and write "?" instead, indicating that there is package info
3) The original type name and the anonymous field name are different:
   we do need the field name and write "@" followed by the field name (and possible package info)

For #18130.

Change-Id: I790dad826757233fa71396a210f966c6256b75d3
Reviewed-on: https://go-review.googlesource.com/35100
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years ago[dev.typealias] go/types: export TypeName.IsAlias so clients can use it
Robert Griesemer [Thu, 22 Dec 2016 22:42:05 +0000 (14:42 -0800)]
[dev.typealias] go/types: export TypeName.IsAlias so clients can use it

For #18130.

Change-Id: I634eaaeaa11e92fc31219d70419fdb4a7aa6e0b4
Reviewed-on: https://go-review.googlesource.com/35099
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.typealias] go/types: improved Object printing
Robert Griesemer [Thu, 22 Dec 2016 19:27:48 +0000 (11:27 -0800)]
[dev.typealias] go/types: improved Object printing

- added internal isAlias predicated and test
- use it for improved Object printing
- when printing a basic type object, don't repeat type name
  (i.e., print "type int" rather than "type int int")
- added another test to testdata/decls4.src

For #18130.

Change-Id: Ice9517c0065a2cc465c6d12f87cd27c01ef801e6
Reviewed-on: https://go-review.googlesource.com/35093
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years ago[dev.typealias] go/types: remove some more vestiges of prior alias implementation
Robert Griesemer [Thu, 22 Dec 2016 17:48:43 +0000 (09:48 -0800)]
[dev.typealias] go/types: remove some more vestiges of prior alias implementation

For #18130.

Change-Id: Ibec8efd158d32746978242910dc71e5ed23e9d91
Reviewed-on: https://go-review.googlesource.com/35092
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years ago[dev.typealias] go/types: implement type aliases
Robert Griesemer [Tue, 20 Dec 2016 01:55:47 +0000 (17:55 -0800)]
[dev.typealias] go/types: implement type aliases

Now a TypeName is just that: a name for a type (not just Named and Basic types
as before). If it happens to be an alias, its type won't be a Named or Basic type,
or it won't have the same name. We can determine this externally.

It may be useful to provide a helper predicate to make that test easily accessible,
but we can get to that if there's an actual need.

The field/method lookup code has become more general an simpler, which is a good sign.
The changes in methodset.go are symmetric to the changes in lookup.go.

Known issue: Cycles created via alias types are not properly detected at the moment.

For #18130.

Change-Id: I90a3206be13116f89c221b5ab4d0f577eec6c78a
Reviewed-on: https://go-review.googlesource.com/35091
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years agocmd/compile: disable flaky test
David Chase [Tue, 10 Jan 2017 13:29:34 +0000 (08:29 -0500)]
cmd/compile: disable flaky test

The test is inherently racy and vulnerable to starvation,
and within all.bash on some platforms that means it flakes.
Test is kept because it can be useful standalone to verify
behavior of GOEXPERIMENT=preeemptibleloops, and there is
likely to be further development of this feature in the
future.

There's also some question as to why it is flaking, because
though technically this is permitted, it's very odd in this
simple case.

Fixes #18589.

Change-Id: Ia0dd9037285c4a03122da4012c96981c9cc43b60
Reviewed-on: https://go-review.googlesource.com/35051
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agoruntime: debug prints for spanBytesAlloc underflow
Austin Clements [Tue, 20 Dec 2016 03:55:53 +0000 (22:55 -0500)]
runtime: debug prints for spanBytesAlloc underflow

Updates #18043.

Change-Id: I24e687fdd5521c48b672987f15f0d5de9f308884
Reviewed-on: https://go-review.googlesource.com/34612
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.typealias] go/build: add go1.9 build tag
Russ Cox [Tue, 10 Jan 2017 00:41:19 +0000 (19:41 -0500)]
[dev.typealias] go/build: add go1.9 build tag

It's earlier than usual but this will help us put the type alias-aware
code into x/tools without breaking clients on go1.6, go1.7,
or (eventually) go1.8.

Change-Id: I43e7ea804922de07d153c7e356cf95e2a11fc592
Reviewed-on: https://go-review.googlesource.com/35050
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years ago[dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet...
Robert Griesemer [Sat, 17 Dec 2016 00:28:30 +0000 (16:28 -0800)]
[dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)

Added test file.

For #18130.

Change-Id: Ifcfd7cd1acf9dd6a2f4f3d85979d232bb6b8c6b1
Reviewed-on: https://go-review.googlesource.com/34988
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.typealias] cmd/gofmt: added test cases for alias type declarations
Robert Griesemer [Fri, 16 Dec 2016 23:56:05 +0000 (15:56 -0800)]
[dev.typealias] cmd/gofmt: added test cases for alias type declarations

For #18130.

Change-Id: I95e84130df40db5241e0cc25c36873c3281199ff
Reviewed-on: https://go-review.googlesource.com/34987
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years ago[dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support
Robert Griesemer [Fri, 16 Dec 2016 23:10:07 +0000 (15:10 -0800)]
[dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support

Parsing and printing support for type aliases complete.
go/types recognizes them an issues an "unimplemented" error for now.

For #18130.

Change-Id: I9f2f7b1971b527276b698d9347bcd094ef0012ee
Reviewed-on: https://go-review.googlesource.com/34986
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.inline] cmd/internal/obj: remove vestiges of LineHist - not used anymore
Robert Griesemer [Thu, 29 Dec 2016 01:58:51 +0000 (17:58 -0800)]
[dev.inline] cmd/internal/obj: remove vestiges of LineHist - not used anymore

Change-Id: I9d3fcdd5b002953fa9d2f001bf7a834073443794
Reviewed-on: https://go-review.googlesource.com/34722
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years ago[dev.inline] cmd/internal/src: introduce compact source position representation
Robert Griesemer [Fri, 16 Dec 2016 01:17:01 +0000 (17:17 -0800)]
[dev.inline] cmd/internal/src: introduce compact source position representation

XPos is a compact (8 instead of 16 bytes on a 64bit machine) source
position representation. There is a 1:1 correspondence between each
XPos and each regular Pos, translated via a global table.

In some sense this brings back the LineHist, though positions can
track line and column information; there is a O(1) translation
between the representations (no binary search), and the translation
is factored out.

The size increase with the prior change is brought down again and
the compiler speed is in line with the master repo (measured on
the same "quiet" machine as for prior change):

name       old time/op     new time/op     delta
Template       256ms ± 1%      262ms ± 2%    ~             (p=0.063 n=5+4)
Unicode        132ms ± 1%      135ms ± 2%    ~             (p=0.063 n=5+4)
GoTypes        891ms ± 1%      871ms ± 1%  -2.28%          (p=0.016 n=5+4)
Compiler       3.84s ± 2%      3.89s ± 2%    ~             (p=0.413 n=5+4)
MakeBash       47.1s ± 1%      46.2s ± 2%    ~             (p=0.095 n=5+5)

name       old user-ns/op  new user-ns/op  delta
Template        309M ± 1%       314M ± 2%    ~             (p=0.111 n=5+4)
Unicode         165M ± 1%       172M ± 9%    ~             (p=0.151 n=5+5)
GoTypes        1.14G ± 2%      1.12G ± 1%    ~             (p=0.063 n=5+4)
Compiler       5.00G ± 1%      4.96G ± 1%    ~             (p=0.286 n=5+4)

Change-Id: Icc570cc60ab014d8d9af6976f1f961ab8828cc47
Reviewed-on: https://go-review.googlesource.com/34506
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years ago[dev.inline] cmd/internal/src: replace src.Pos with syntax.Pos
Robert Griesemer [Sat, 10 Dec 2016 01:15:05 +0000 (17:15 -0800)]
[dev.inline] cmd/internal/src: replace src.Pos with syntax.Pos

This replaces the src.Pos LineHist-based position tracking with
the syntax.Pos implementation and updates all uses.

The LineHist table is not used anymore - the respective code is still
there but should be removed eventually. CL forthcoming.

Passes toolstash -cmp when comparing to the master repo (with the
exception of a couple of swapped assembly instructions, likely due
to different instruction scheduling because the line-based sorting
has changed; though this is won't affect correctness).

The sizes of various important compiler data structures have increased
significantly (see the various sizes_test.go files); this is probably
the reason for an increase of compilation times (to be addressed). Here
are the results of compilebench -count 5, run on a "quiet" machine (no
apps running besides a terminal):

name       old time/op     new time/op     delta
Template       256ms ± 1%      280ms ±15%  +9.54%          (p=0.008 n=5+5)
Unicode        132ms ± 1%      132ms ± 1%    ~             (p=0.690 n=5+5)
GoTypes        891ms ± 1%      917ms ± 2%  +2.88%          (p=0.008 n=5+5)
Compiler       3.84s ± 2%      3.99s ± 2%  +3.95%          (p=0.016 n=5+5)
MakeBash       47.1s ± 1%      47.2s ± 2%    ~             (p=0.841 n=5+5)

name       old user-ns/op  new user-ns/op  delta
Template        309M ± 1%       326M ± 2%  +5.18%          (p=0.008 n=5+5)
Unicode         165M ± 1%       168M ± 4%    ~             (p=0.421 n=5+5)
GoTypes        1.14G ± 2%      1.18G ± 1%  +3.47%          (p=0.008 n=5+5)
Compiler       5.00G ± 1%      5.16G ± 1%  +3.12%          (p=0.008 n=5+5)

Change-Id: I241c4246cdff627d7ecb95cac23060b38f9775ec
Reviewed-on: https://go-review.googlesource.com/34273
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agocmd/compile: insert scheduling checks on loop backedges
David Chase [Thu, 10 Nov 2016 21:03:47 +0000 (16:03 -0500)]
cmd/compile: insert scheduling checks on loop backedges

Loop breaking with a counter.  Benchmarked (see comments),
eyeball checked for sanity on popular loops.  This code
ought to handle loops in general, and properly inserts phi
functions in cases where the earlier version might not have.

Includes test, plus modifications to test/run.go to deal with
timeout and killing looping test.  Tests broken by the addition
of extra code (branch frequency and live vars) for added
checks turn the check insertion off.

If GOEXPERIMENT=preemptibleloops, the compiler inserts reschedule
checks on every backedge of every reducible loop.  Alternately,
specifying GO_GCFLAGS=-d=ssa/insert_resched_checks/on will
enable it for a single compilation, but because the core Go
libraries contain some loops that may run long, this is less
likely to have the desired effect.

This is intended as a tool to help in the study and diagnosis
of GC and other latency problems, now that goal STW GC latency
is on the order of 100 microseconds or less.

Updates #17831.
Updates #10958.

Change-Id: I6206c163a5b0248e3f21eb4fc65f73a179e1f639
Reviewed-on: https://go-review.googlesource.com/33910
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 years agocmd/compile: file line number for //go:xxx directives
Robert Griesemer [Thu, 29 Dec 2016 01:29:25 +0000 (17:29 -0800)]
cmd/compile: file line number for //go:xxx directives

Minimally invasive; fixes a regression from 1.7.

Fixes #18459.

Change-Id: I93b3b5c05706eaff8ae97a237f770838c1f8778c
Reviewed-on: https://go-review.googlesource.com/34721
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>