summaryrefslogtreecommitdiff
path: root/src/go
Commit message (Collapse)AuthorAgeFilesLines
...
* cmd/compile: remove support for textual export formatRobert Griesemer2016-08-162-912/+4
| | | | | | | | | | Fixes #15323. Change-Id: I50e996e6fde6b24327cb45dd84da31deef4dcc56 Reviewed-on: https://go-review.googlesource.com/27171 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: don't crash when exporting self-recursive interfacesRobert Griesemer2016-08-161-0/+1
| | | | | | | | For #16369. Change-Id: I4c9f5a66b95558adcc1bcface164b9b2b4382d2f Reviewed-on: https://go-review.googlesource.com/24979 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/token: Fix race in FileSet.PositionFor.Jan Mercl2016-08-162-1/+32
| | | | | | | | | | | | | | | | | | | | Methods of FileSet are documented to be safe for concurrent use by multiple goroutines, so FileSet is protected by a mutex and all its methods use it to prevent concurrent mutations. All methods of File that mutate the respective FileSet, including AddLine, do also lock its mutex, but that does not help when PositionFor is invoked concurrently and reads without synchronization what AddLine mutates. The change adds acquiring a RLock around the racy call of File.position and the respective test. Fixes #16548 Change-Id: Iecaaa02630b2532cb29ab555376633ee862315dd Reviewed-on: https://go-review.googlesource.com/25345 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: fix bad printf verbsJosh Bleecher Snyder2016-08-161-2/+2
| | | | | | | | | | | | | | | This fixes the following vet warnings: go/types/builtins.go:437: arg call for printf verb %s of wrong type: *go/ast.CallExpr go/types/builtins.go:598: arg call for printf verb %s of wrong type: *go/ast.CallExpr Updates #11041 Change-Id: I746d054e8e49b330fbdf961912a98f55dd5f3ff9 Reviewed-on: https://go-review.googlesource.com/26997 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* go/types: fix multiword data structure alignment on naclJosh Bleecher Snyder2016-08-162-0/+32
| | | | | | | | | | Fixes #16464 Change-Id: Ibf5625c1b5fa3abd18623023f18664e8f81fa45a Reviewed-on: https://go-review.googlesource.com/26996 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* go/types: remove struct Sizeof cacheJosh Bleecher Snyder2016-08-163-35/+74
| | | | | | | | | | | | | It was not responsive to the sizes param. Remove it, and unwind the extra layers. Fixes #16316 Change-Id: I940a57184a1601f52348d4bff8638f3f7462f5cd Reviewed-on: https://go-review.googlesource.com/26995 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* go/types: minor cleanupsRobert Griesemer2016-08-163-17/+18
| | | | | | | | | | | | | 1) Removed mark field from declInfo struct. Instead use a visited map in ordering.go which was the only use place for the mark field. 2) Introduced objSet type for the common map[Object]bool type. 3) Improved comments. Change-Id: I7544e7458d844b0ca08193f11de6238d317eaf2d Reviewed-on: https://go-review.googlesource.com/24153 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/types: fix computation of initialization orderRobert Griesemer2016-08-163-108/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old algorithm operated on a dependency graph that included all objects (including functions) for simplicity: it was based directly on the dependencies collected for each object during type checking an object's initialization expression. It also used that graph to compute the objects involved in an erroneous initialization cycle. Cycles that consist only of (mutually recursive) functions are permitted in initialization code; so those cycles were silently ignored if encountered. However, such cycles still inflated the number of dependencies a variable might have (due to the cycle), which in some cases lead to the wrong variable being scheduled for initialization before the one with the inflated dependency count. Correcting for the cycle when it is found is too late since at that point another variable may have already been scheduled. The new algorithm computes the initialization dependency graph as before but adds an extra pass during which functions are eliminated from the graph (and their dependencies are "back-propagated"). This eliminates the problem of cycles only involving functions (there are no functions). When a cycle is found, the new code computes the cycle path from the original object dependencies so it can still include functions on the path as before, for the same detailed error message. The new code also more clearly distinguishes between objects that can be in the dependency graph (constants, variables, functions), and objects that cannot, by introducing the dependency type, a new subtype of Object. As a consequence, the dependency graph is smaller. Fixes #10709. Change-Id: Ib58d6ea65cfb279041a0286a2c8e865f11d244eb Reviewed-on: https://go-review.googlesource.com/24131 Reviewed-by: Alan Donovan <adonovan@google.com>
* all: rename vendored golang.org/x/net packages to golang_orgBrad Fitzpatrick2016-07-132-8/+8
| | | | | | | | | | | | | | | | | | | | Regression from Go 1.6 to Go 1.7rc1: we had broken the ability for users to vendor "golang.org/x/net/http2" or "golang.org/x/net/route" because we were vendoring them ourselves and cmd/go and cmd/compile do not understand multiple vendor directories across multiple GOPATH workspaces (e.g. user's $GOPATH and default $GOROOT). As a short-term fix, since fixing cmd/go and cmd/compile is too invasive at this point in the cycle, just rename "golang.org" to "golang_org" for the standard library's vendored copy. Fixes #16333 Change-Id: I9bfaed91e9f7d4ca6bab07befe80d71d437a21af Reviewed-on: https://go-review.googlesource.com/24902 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/compile: don't lose //go:nointerface pragma in export dataRobert Griesemer2016-07-011-2/+8
| | | | | | | | | | Fixes #16243. Change-Id: I207d1e8aa48abe453a23c709ccf4f8e07368595b Reviewed-on: https://go-review.googlesource.com/24648 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* math/big: special-case a 0 mantissa during Rat parsingNathan VanBenschoten2016-06-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a 0 mantissa was special-cased during big.Float parsing, but not during big.Rat parsing. This meant that a value like 0e9999999999 would parse successfully in big.Float.SetString, but would hang in big.Rat.SetString. This discrepancy became an issue in https://golang.org/src/go/constant/value.go?#L250, where the big.Float would report an exponent of 0, so big.Rat.SetString would be used and would subsequently hang. A Go Playground example of this is https://play.golang.org/p/3fy28eUJuF The solution is to special-case a zero mantissa during big.Rat parsing as well, so that neither big.Rat nor big.Float will hang when parsing a value with 0 mantissa but a large exponent. This was discovered using go-fuzz on CockroachDB: https://github.com/cockroachdb/go-fuzz/blob/master/examples/parser/main.go Fixes #16176 Change-Id: I775558a8682adbeba1cc9d20ba10f8ed26259c56 Reviewed-on: https://go-review.googlesource.com/24430 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/ast: fix comments misinterpreted as documentationMatthew Dempsky2016-06-151-4/+4
| | | | | | | | | | The comments describing blocks of Pos/End implementations for various nodes types are being misinterpreted as documentation for BadDecl, BadExpr, BadStmt, and ImportSpec's Pos methods. Change-Id: I935b0bc38dbc13e9305f3efeb437dd3a6575d9a1 Reviewed-on: https://go-review.googlesource.com/24152 Reviewed-by: Robert Griesemer <gri@golang.org>
* go/parser: document that parse functions need valid token.FileSetRobert Griesemer2016-06-101-3/+13
| | | | | | | | | | | | | | | + panic with explicit error if no file set it provided (Not providing a file set is invalid use of the API; panic is the appropriate action rather than returning an error.) Fixes #16018. Change-Id: I207f5b2a2e318d65826bdd9522fce46d614c24ee Reviewed-on: https://go-review.googlesource.com/24010 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: correctly export underlying type of predecl. error typeRobert Griesemer2016-06-012-0/+36
| | | | | | | | | | Fixes #15920. Change-Id: I78cd79b91a58d0f7218b80f9445417f4ee071a6e Reviewed-on: https://go-review.googlesource.com/23606 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime/pprof, cmd/pprof: fix profiling for PIEIan Lance Taylor2016-05-311-1/+1
| | | | | | | | | | | | | | | | In order to support pprof for position independent executables, pprof needs to adjust the PC addresses stored in the profile by the address at which the program is loaded. The legacy profiling support which we use already supports recording the GNU/Linux /proc/self/maps data immediately after the CPU samples, so do that. Also change the pprof symbolizer to use the information, if available, when looking up addresses in the Go pcline data. Fixes #15714. Change-Id: I4bf679210ef7c51d85cf873c968ce82db8898e3e Reviewed-on: https://go-review.googlesource.com/23525 Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
* go/types: better debugging output for init order computationRobert Griesemer2016-05-273-13/+75
| | | | | | | | | | | Also: Added some test cases for issue #10709. No impact when debugging output is disabled (default). For #10709. Change-Id: I0751befb222c86d46225377a674f6bad2990349e Reviewed-on: https://go-review.googlesource.com/23442 Reviewed-by: Alan Donovan <adonovan@google.com>
* cmd/compile, go/types: omit needless word in error messageRuss Cox2016-05-242-2/+2
| | | | | | | | | | | CL 21462 and CL 21463 made this message say explicitly that the problem was a struct field in a map, but the word "directly" is unnecessary, sounds wrong, and makes the error long. Change-Id: I2fb68cdaeb8bd94776b8022cf3eae751919ccf6f Reviewed-on: https://go-review.googlesource.com/23373 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: David Chase <drchase@google.com>
* cmd/go: fix //go:binary-only-package checkRuss Cox2016-05-241-1/+1
| | | | | | | | | | | The use of a prefix check was too liberal. Noted in review after submit. Change-Id: I4fe1df660997efd225609e818040b8392fab79f0 Reviewed-on: https://go-review.googlesource.com/23375 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/types: don't drop type in n:1 var decl if one is givenRobert Griesemer2016-05-232-0/+35
| | | | | | | | | | | | | | | In n:1 variable declarations (multiple lhs variables with single multi-valued initialization expression) where also a variable type is provided, make sure that that type is assigned to all variables on the lhs before the init expression assignment is checked. Otherwise, (some) variables are assumed to take the type of the corresponding value of the multi-valued init expression. Fixes #15755. Change-Id: I969cb5a95c85e28dbb38abd7fa7df16ff5554c03 Reviewed-on: https://go-review.googlesource.com/23313 Reviewed-by: Alan Donovan <adonovan@google.com>
* net/http: update bundled http2Brad Fitzpatrick2016-05-191-0/+1
| | | | | | | | | | | | | | | | | | | Updates x/net/http2 to git rev 5916dcb1 for: * http2, lex/httplex: make Transport reject bogus headers before sending https://golang.org/cl/23229 * http2: reject more trailer values https://golang.org/cl/23230 Fixes #14048 Fixes #14188 Change-Id: Iaa8beca6e005267a3e849a10013eb424a882f2bb Reviewed-on: https://go-review.googlesource.com/23234 Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: golang.org/x/net/route plumbingMikio Hara2016-05-151-2/+5
| | | | | | | | | | | | | | This change makes use of new routing message APIs for BSD variants to support FreeBSD 11 and newer versions of other BSDs. Fixes #7849. Fixes #14724. Change-Id: I56c7886d6622cdeddd7cc29c8a8062dcc06216d5 Reviewed-on: https://go-review.googlesource.com/22451 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* Revert "cmd/build: reject non-existant directories in ImportDir"Mikio Hara2016-05-132-16/+1
| | | | | | | | | | | | | | | | | | | | | This reverts commit 7af2ce3f159760033c903b3730bfb5995b4edd40. The commit had a wrong prefix in the description line, probably misreconginized something. As a result it broke golang.org/x/tools/godoc and golang.org/x/tools/cmd/godoc like the following: --- FAIL: TestCLI (10.90s) --- FAIL: TestWeb (13.74s) FAIL FAIL golang.org/x/tools/cmd/godoc 36.428s --- FAIL: TestCommandLine (0.00s) FAIL FAIL golang.org/x/tools/godoc 0.068s Change-Id: I362a862a4ded8592dec7488a28e7a256adee148f Reviewed-on: https://go-review.googlesource.com/23076 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Andrew Gerrand <adg@golang.org>
* cmd/build: reject non-existant directories in ImportDirEmmanuel Odeke2016-05-122-1/+16
| | | | | | | | | | | | | | | | Re-apply @adg's CL https://golang.org/cl/7129048 that was previously disabled in https://golang.org/cl/7235052 because it broke `godoc net/http` for go1.1. Currently `godoc net/http` seems to work fine with this CL. Fixes #3428. Change-Id: I7df06df02fd62dededac6ec60bea62561be59cf1 Reviewed-on: https://go-review.googlesource.com/23013 Run-TryBot: Andrew Gerrand <adg@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* go/types: fix certain vet warningsAliaksandr Valialkin2016-05-122-2/+2
| | | | | | | | | | Updates #11041 Change-Id: I4e1c670d2b7fc04927d77c6f933cee39b7d48b6e Reviewed-on: https://go-review.googlesource.com/23083 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/importer: use correct path when checking if package was already importedRobert Griesemer2016-05-114-2/+54
| | | | | | | | | | | | | | | The importer uses a global (shared) package map across multiple imports to determine if a package was imported before. That package map is usually indexed by package (import) path ('id' in this code). However, the binary importer was using the incoming (possibly unclean) path. Fixes #15517. Change-Id: I0c32a708dfccf345e0353fbda20ad882121e437c Reviewed-on: https://go-review.googlesource.com/23012 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* go/internal/gccgoimporter: remove workaround on Plan 9David du Colombier2016-05-101-6/+0
| | | | | | | | | | | | | | We fixed the implementation of the pread syscall in the Plan 9 kernel, so calling pread doesn't update the channel offset when reading a file. Fixes #11194. Change-Id: Ie4019e445542a73479728af861a50bb54caea3f6 Reviewed-on: https://go-review.googlesource.com/22245 Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* time: don't depend on the io packageBrad Fitzpatrick2016-05-091-1/+13
| | | | | | | | | | | | | | | | | | | The time package has never depended on the io package until a recent change during Go 1.7 to use the io.Seek* constants. The go/build dependency check didn't catch this because "time" was allowed to depend on meta package group "L0", which included "io". Adding the "io" package broke one of Dmitry's tools. The tool is fixable, but it's also not necessary for us to depend on "io" at all for some constants. Mirror the constants instead, and change deps_test.go to prevent an io dependency in the future. Change-Id: I74325228565279a74fa4a2f419643f5710e3e09f Reviewed-on: https://go-review.googlesource.com/22960 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/compile: add and enable (internal) option to only track named typesRobert Griesemer2016-05-072-16/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new export format keeps track of all types that are exported. If a type is seen that was exported before, only a reference to that type is emitted. The importer maintains a list of all the seen types and uses that list to resolve type references. The existing compiler infrastructure's invariants assumes that only named types are referred to before they are fully set up. Referring to unnamed incomplete types causes problems. One of the issues was #15548. Added a new internal flag 'trackAllTypes' to enable/disable this type tracking. With this change only named types are tracked. Verified that this fix also addresses #15548, even w/o the prior fix for that issue (in fact that prior fix is turned off if trackAllTypes is disabled because it's not needed). The test for #15548 covers also this change. For #15548. Change-Id: Id0b3ff983629703d025a442823f99649fd728a56 Reviewed-on: https://go-review.googlesource.com/22839 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* all: use SeekStart, SeekCurrent, SeekEndJoe Tsai2016-05-061-2/+2
| | | | | | | | | | | | | | CL/19862 (f79b50b8d5bc159561c1dcf7c17e2a0db96a9a11) recently introduced the constants SeekStart, SeekCurrent, and SeekEnd to the io package. We should use these constants consistently throughout the code base. Updates #15269 Change-Id: If7fcaca7676e4a51f588528f5ced28220d9639a2 Reviewed-on: https://go-review.googlesource.com/22097 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/token: document postcondition of SetLinesAlan Donovan2016-05-051-0/+1
| | | | | | Change-Id: Ie163deade396b3e298a93845b9ca4d52333ea82a Reviewed-on: https://go-review.googlesource.com/22831 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: use correct packages when exporting/importing _ (blank) namesRobert Griesemer2016-05-031-1/+3
| | | | | | | | | | | | | | | | | | 1) Blank parameters cannot be accessed so the package doesn't matter. Do not export it, and consistently use localpkg when importing a blank parameter. 2) More accurately replicate fmt.go and parser.go logic when importing a blank struct field. Blank struct fields get exported without package qualification. (This is actually incorrect, even with the old textual export format, but we will fix that in a separate change. See also issue 15514.) Fixes #15491. Change-Id: I7978e8de163eb9965964942aee27f13bf94a7c3c Reviewed-on: https://go-review.googlesource.com/22714 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net/http: add Transport.MaxIdleConns limitBrad Fitzpatrick2016-05-011-1/+1
| | | | | | | | | | | | | | | | | | | The HTTP client had a limit for the maximum number of idle connections per-host, but not a global limit. This CLs adds a global idle connection limit too, Transport.MaxIdleConns. All idle conns are now also stored in a doubly-linked list. When there are too many, the oldest one is closed. Fixes #15461 Change-Id: I72abbc28d140c73cf50f278fa70088b45ae0deef Reviewed-on: https://go-review.googlesource.com/22655 Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go, go/build: add support for binary-only packagesRuss Cox2016-04-293-8/+60
| | | | | | | | | | | See https://golang.org/design/2775-binary-only-packages for design. Fixes #2775. Change-Id: I33e74eebffadc14d3340bba96083af0dec5172d5 Reviewed-on: https://go-review.googlesource.com/22433 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http, net/http/httptrace: new package for tracing HTTP client requestsBrad Fitzpatrick2016-04-281-1/+5
| | | | | | | | | | | Updates #12580 Change-Id: I9f9578148ef2b48dffede1007317032d39f6af55 Reviewed-on: https://go-review.googlesource.com/22191 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tom Bergan <tombergan@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: use delta encoding for filenames in export data position infoRobert Griesemer2016-04-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the export data size significantly (15%-25%) for some packages, especially where the paths are very long or if there are many files involved. Slight (2%) reduction on average, with virtually no increases in export data size. Selected export data sizes for packages with |delta %| > 3%: package before after delta % cmd/asm/internal/arch 11647 11088 -559 -4% cmd/compile/internal/amd64 838 600 -238 -27% cmd/compile/internal/arm 7323 6793 -530 -6% cmd/compile/internal/arm64 19948 18971 -977 -4% cmd/compile/internal/big 9043 8548 -495 -4% cmd/compile/internal/mips64 645 482 -163 -24% cmd/compile/internal/ppc64 695 497 -198 -27% cmd/compile/internal/s390x 553 433 -120 -21% cmd/compile/internal/x86 744 555 -189 -24% cmd/dist 145 121 -24 -16% cmd/internal/objfile 17359 16474 -885 -4% cmd/internal/pprof/symbolz 8346 7941 -405 -4% cmd/link/internal/amd64 11178 10604 -574 -4% cmd/link/internal/arm 204 171 -33 -15% cmd/link/internal/arm64 210 175 -35 -16% cmd/link/internal/mips64 213 177 -36 -16% cmd/link/internal/ppc64 211 176 -35 -16% cmd/link/internal/s390x 210 175 -35 -16% cmd/link/internal/x86 203 170 -33 -15% cmd/trace 782 744 -38 -4% compress/lzw 402 383 -19 -4% crypto/aes 311 262 -49 -15% crypto/cipher 1138 959 -179 -15% crypto/des 315 288 -27 -8% crypto/elliptic 6063 5746 -317 -4% crypto/rc4 317 295 -22 -6% crypto/sha256 348 312 -36 -9% crypto/sha512 487 451 -36 -6% go/doc 3871 3649 -222 -5% go/internal/gccgoimporter 2063 1949 -114 -5% go/internal/gcimporter 3253 3096 -157 -4% math 4343 3572 -771 -17% math/cmplx 1580 1274 -306 -18% math/rand 982 926 -56 -5% net/internal/socktest 2159 2049 -110 -4% os/exec 7928 7492 -436 -4% os/signal 237 208 -29 -11% os/user 717 682 -35 -4% runtime/internal/atomic 728 693 -35 -4% runtime/internal/sys 2287 2107 -180 -7% sync 1306 1214 -92 -6% all packages 1509255 1465507 -43748 -2% Change-Id: I98a11521b552166b7f47f2039a29f106748bf5d4 Reviewed-on: https://go-review.googlesource.com/22580 Reviewed-by: Alan Donovan <adonovan@google.com>
* os/exec: add Cmd.RunContext and Cmd.WaitContextBrad Fitzpatrick2016-04-281-1/+1
| | | | | | | | | | Updates #14660 Change-Id: Ifa5c97ba327ad7ceea0a9a252e3dbd9d079dae54 Reviewed-on: https://go-review.googlesource.com/22529 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: for now, keep parameter numbering in binary export formatRobert Griesemer2016-04-251-0/+4
| | | | | | | | | | | | | The numbering is only required for parameters of functions/methods with exported inlineable bodies. For now, always export parameter names with internal numbering to minimize the diffs between assembly code dumps of code compiled with the textual vs the binary format. To be disabled again once the new export format is default. Change-Id: I6d14c564e734cc5596c7e995d8851e06d5a35013 Reviewed-on: https://go-review.googlesource.com/22441 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: don't export pos info in new export format for nowRobert Griesemer2016-04-221-2/+9
| | | | | | | | | Exporting filenames as part of the position information can lead to different object files which breaks tests. Change-Id: Ia678ab64293ebf04bf83601e6ba72919d05762a4 Reviewed-on: https://go-review.googlesource.com/22385 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* go/types: trailing semis are ok after valid fallthroughRobert Griesemer2016-04-192-4/+23
| | | | | | | | Fixes #15376. Change-Id: I9ece80f26b83be129671c961120c157da2ac0079 Reviewed-on: https://go-review.googlesource.com/22270 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/types: accept trailing empty stmts in terminating stmt listsRobert Griesemer2016-04-192-2/+83
| | | | | | | | | | | | Per the latest spec refinement (https://golang.org/cl/19981). Fixes #14537. Change-Id: I2dedee942c4da21dc94bdeda466f133827ab5bb9 Reviewed-on: https://go-review.googlesource.com/22241 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: context plumbing, add Dialer.DialContextBrad Fitzpatrick2016-04-151-1/+3
| | | | | | | | | | | | For #12580 (http.Transport tracing/analytics) Updates #13021 Change-Id: I126e494a7bd872e42c388ecb58499ecbf0f014cc Reviewed-on: https://go-review.googlesource.com/22101 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* all: remove unnecessary type conversionsMatthew Dempsky2016-04-151-1/+1
| | | | | | | | | | | | | cmd and runtime were handled separately, and I'm intentionally skipped syscall. This is the rest of the standard library. CL generated mechanically with github.com/mdempsky/unconvert. Change-Id: I9e0eff886974dedc37adb93f602064b83e469122 Reviewed-on: https://go-review.googlesource.com/22104 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: first cut at exporting position infoRobert Griesemer2016-04-141-41/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - position info for all exported globals, plus methods and fields - use delta-encoded line number info in most cases - canonicalize all strings: each filename appears only once, but will also compact other strings (names) to at most one occurence in encoding - positions not yet hooked up when reading in Also: - adjusted go/importer (gcimporter) - some refactoring for better symmetry Stats: - comparison of export data size w/o and w/ position info (bytes). - delta is increase in % - overall (see bottom of table): 14% increase - however, the current binary format decreased from the original binary format last week by 14% - compared to original textual format: 65% decrease (increase by 14% after decrease by 14% still leads to a decrease from original textual format) (caveat: we used the textual size from last week, assuming it has not changed - there may be a small error here). package w/o pos w/ pos delta archive/tar 4234 4902 16% archive/zip 6387 7340 15% bufio 3106 3419 10% bytes 4362 4757 9% cmd/addr2line 27 70 159% cmd/api 12065 13590 13% cmd/asm 27 64 137% cmd/asm/internal/arch 9957 11529 16% cmd/asm/internal/asm 11788 13385 14% cmd/asm/internal/flags 239 311 30% cmd/asm/internal/lex 13415 15358 14% cmd/cgo 13064 15006 15% cmd/compile 27 67 148% cmd/compile/internal/amd64 461 869 89% cmd/compile/internal/arm 5963 7273 22% cmd/compile/internal/arm64 363 657 81% cmd/compile/internal/big 7186 8590 20% cmd/compile/internal/gc 48242 56234 17% cmd/compile/internal/mips64 367 666 81% cmd/compile/internal/ppc64 372 721 94% cmd/compile/internal/s390x 330 569 72% cmd/compile/internal/ssa 30464 35058 15% cmd/compile/internal/x86 429 770 79% cmd/cover 3984 4731 19% cmd/dist 74 154 108% cmd/doc 7272 8591 18% cmd/expdump 27 71 163% cmd/fix 342 419 23% cmd/go 8126 9520 17% cmd/gofmt 27 70 159% cmd/gofmt2 27 69 156% cmd/gofmt2/internal/format 702 856 22% cmd/gofmt2/internal/lexical 2954 3509 19% cmd/gofmt2/internal/parse 6185 7295 18% cmd/gofmt2/internal/syntax 3533 4738 34% cmd/gofmt2/internal/test 540 615 14% cmd/internal/bio 5395 6060 12% cmd/internal/gcprog 533 663 24% cmd/internal/goobj 1022 1277 25% cmd/internal/obj 10951 12825 17% cmd/internal/obj/arm 8612 9985 16% cmd/internal/obj/arm64 15814 17638 12% cmd/internal/obj/mips 10928 12487 14% cmd/internal/obj/ppc64 13576 15277 13% cmd/internal/obj/s390x 16513 18708 13% cmd/internal/obj/x86 21152 23482 11% cmd/internal/objfile 14442 16505 14% cmd/internal/pprof/commands 1663 1885 13% cmd/internal/pprof/driver 9517 10789 13% cmd/internal/pprof/fetch 7632 8635 13% cmd/internal/pprof/plugin 13150 14809 13% cmd/internal/pprof/profile 7004 8248 18% cmd/internal/pprof/report 7763 8942 15% cmd/internal/pprof/svg 1332 1534 15% cmd/internal/pprof/symbolizer 7376 8439 14% cmd/internal/pprof/symbolz 6970 7976 14% cmd/internal/pprof/tempfile 3645 4093 12% cmd/internal/sys 505 619 23% cmd/internal/unvendor/golang.org/x/arch/arm/armasm 73951 79188 7% cmd/internal/unvendor/golang.org/x/arch/x86/x86asm 10140 11738 16% cmd/link 27 64 137% cmd/link/internal/amd64 9317 11034 18% cmd/link/internal/arm 110 213 94% cmd/link/internal/arm64 112 219 96% cmd/link/internal/ld 53524 60149 12% cmd/link/internal/mips64 113 222 96% cmd/link/internal/ppc64 113 220 95% cmd/link/internal/s390x 112 219 96% cmd/link/internal/x86 110 212 93% cmd/nm 27 61 126% cmd/objdump 27 68 152% cmd/pack 4141 4688 13% cmd/pprof 27 67 148% cmd/trace 624 842 35% cmd/vet 11194 13140 17% cmd/vet/internal/whitelist 52 113 117% cmd/yacc 1141 1317 15% compress/bzip2 2101 2484 18% compress/flate 3619 4336 20% compress/gzip 6261 7111 14% compress/lzw 276 401 45% compress/zlib 3630 4158 15% container/heap 187 250 34% container/list 1370 1506 10% container/ring 466 546 17% context 3005 3338 11% crypto 728 856 18% crypto/aes 181 321 77% crypto/cipher 744 1163 56% crypto/des 220 320 45% crypto/dsa 4526 4990 10% crypto/ecdsa 5341 5982 12% crypto/elliptic 4969 5593 13% crypto/hmac 188 250 33% crypto/md5 560 706 26% crypto/rand 4218 4746 13% crypto/rc4 214 321 50% crypto/rsa 5648 6355 13% crypto/sha1 597 751 26% crypto/sha256 228 351 54% crypto/sha512 354 484 37% crypto/subtle 586 621 6% crypto/tls 20909 23438 12% crypto/x509 14862 16857 13% crypto/x509/pkix 8384 9278 11% database/sql 6721 7715 15% database/sql/driver 1243 1535 23% debug/dwarf 7867 9153 16% debug/elf 25479 28025 10% debug/gosym 1887 2267 20% debug/macho 7222 8846 22% debug/pe 6921 8081 17% debug/plan9obj 1084 1319 22% encoding 217 280 29% encoding/ascii85 587 722 23% encoding/asn1 1043 1268 22% encoding/base32 929 1112 20% encoding/base64 1166 1368 17% encoding/binary 2168 2410 11% encoding/csv 3761 4203 12% encoding/gob 11304 12936 14% encoding/hex 510 606 19% encoding/json 9965 11395 14% encoding/pem 202 266 32% encoding/xml 11817 13361 13% errors 126 170 35% expvar 930 1142 23% flag 5905 6519 10% fmt 1027 1190 16% go/ast 12910 15541 20% go/build 5460 6173 13% go/constant 1645 1816 10% go/doc 3107 3882 25% go/format 1416 1729 22% go/importer 1426 1668 17% go/internal/gccgoimporter 1624 2028 25% go/internal/gcimporter 2650 3095 17% go/parser 6220 7073 14% go/printer 1924 2306 20% go/scanner 3137 3602 15% go/token 3053 3474 14% go/types 21793 25561 17% hash 234 327 40% hash/adler32 465 553 19% hash/crc32 668 817 22% hash/crc64 630 727 15% hash/fnv 1413 1582 12% html 76 114 50% html/template 14382 16457 14% image 10248 11409 11% image/color 2247 2562 14% image/color/palette 107 169 58% image/draw 2313 2494 8% image/gif 3079 3450 12% image/internal/imageutil 3136 3456 10% image/jpeg 2349 2735 16% image/png 2404 2695 12% index/suffixarray 4978 5596 12% internal/race 225 278 24% internal/singleflight 551 697 26% internal/syscall/windows/sysdll 97 166 71% internal/testenv 4488 5052 13% internal/trace 1392 1680 21% io 2811 3318 18% io/ioutil 3988 4467 12% log 3532 3907 11% log/syslog 4247 4775 12% math 3021 4499 49% math/big 7250 8456 17% math/cmplx 1034 1617 56% math/rand 734 885 21% mime 1889 2194 16% mime/multipart 4313 4849 12% mime/quotedprintable 1758 1996 14% net 15686 18617 19% net/http 42182 47848 13% net/http/cgi 19496 21768 12% net/http/cookiejar 4615 5248 14% net/http/fcgi 17758 19771 11% net/http/httptest 26108 29350 12% net/http/httputil 20732 23286 12% net/http/internal 2195 2497 14% net/http/pprof 17596 19545 11% net/internal/socktest 1689 2153 27% net/mail 4328 4810 11% net/rpc 24328 27249 12% net/rpc/jsonrpc 11052 12438 13% net/smtp 17127 19174 12% net/textproto 3705 4329 17% net/url 1193 1371 15% os 8493 10113 19% os/exec 6625 7532 14% os/signal 137 236 72% os/user 529 761 44% path 295 372 26% path/filepath 3452 3952 14% reflect 5091 6028 18% regexp 4848 5585 15% regexp/syntax 2590 3076 19% runtime 8721 11598 33% runtime/cgo 17 17 0% runtime/debug 2721 3130 15% runtime/internal/atomic 569 704 24% runtime/internal/sys 1874 2318 24% runtime/pprof 478 582 22% runtime/race 18 18 0% runtime/trace 95 146 54% sort 1052 1215 15% strconv 1389 1667 20% strings 3372 3772 12% sync 946 1371 45% sync/atomic 962 1079 12% syscall 41574 45613 10% testing 6184 7243 17% testing/iotest 883 1116 26% testing/quick 4659 5443 17% text/scanner 2930 3269 12% text/tabwriter 2333 2607 12% text/template 13335 15274 15% text/template/parse 8270 9285 12% time 4687 5313 13% unicode 3831 4355 14% unicode/utf16 530 584 10% unicode/utf8 872 946 8% vendor/golang.org/x/net/http2/hpack 3386 3970 17% 1295440 1481566 14% orig. textual 4253585 1481566 -65% orig. binary 1724071 1481566 -14% Change-Id: I4177c6511cc57ebe5eb80c89bf3aefc83376ce86 Reviewed-on: https://go-review.googlesource.com/22096 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* go/types: record CallExpr result type even if argument is invalidAlan Donovan2016-04-142-5/+29
| | | | | | | | | | + test Fixes #15305 Change-Id: Ica657c00c92f0b19f0df7452cdbe5a95d23cc8a4 Reviewed-on: https://go-review.googlesource.com/22085 Reviewed-by: Robert Griesemer <gri@golang.org>
* cmd/compile, go/importer: minor cleanupsRobert Griesemer2016-04-131-27/+19
| | | | | | Change-Id: Ic7a1fb0dbbf108052c970a4a830269a5673df7df Reviewed-on: https://go-review.googlesource.com/21963 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: move more compiler specifics into compiler specific export sectionRobert Griesemer2016-04-131-2/+0
| | | | | | | | | | | | | | Instead of indicating with each function signature if it has an inlineable body, collect all functions in order and export function bodies with function index in platform-specific section. Moves this compiler specific information out of the platform-independent export data section, and removes an int value for all functions w/o body. Also simplifies the code a bit. Change-Id: I8b2d7299dbe81f2706be49ecfb9d9f7da85fd854 Reviewed-on: https://go-review.googlesource.com/21939 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: move compiler-specific flags into compiler-spec. export data ↵Robert Griesemer2016-04-121-4/+1
| | | | | | | | | | section Also: Adjust go/importer accordingly. Change-Id: Ia6669563793e218946af45b9fba1cf986a21c031 Reviewed-on: https://go-review.googlesource.com/21896 Reviewed-by: Alan Donovan <adonovan@google.com>
* go/importer: make For("gccgo", nil) not panicAlan Donovan2016-04-121-1/+1
| | | | | | | | | | Apparently we forgot to test this. Fixes #15092 Change-Id: I33d4fef0f659dfbdfc1ebf8401e96610c8215592 Reviewed-on: https://go-review.googlesource.com/21860 Reviewed-by: Robert Griesemer <gri@golang.org>
* context: document that WithValue's key must be comparableBrad Fitzpatrick2016-04-111-1/+1
| | | | | | | | | | | Also, check it and explode earlier, rather than cryptic failures later. Change-Id: I319a425f60e2bc9d005a187fbdbd153faa96411c Reviewed-on: https://go-review.googlesource.com/21799 Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
* all: replace magic 0x80 with named constant utf8.RuneSelfMartin Möhrmann2016-04-103-5/+6
| | | | | | | | Change-Id: Id1c2e8e9d60588de866e8b6ca59cc83dd28f848f Reviewed-on: https://go-review.googlesource.com/21756 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>