1
0
mirror of https://github.com/golang/go synced 2024-09-25 01:20:13 -06:00
Commit Graph

28504 Commits

Author SHA1 Message Date
Russ Cox
feb6131b1a cmd/compile: add -linkobj flag to allow writing object file in two parts
This flag is experimental and the semantics may change
even after Go 1.7 is released. There are no changes to code
not using the flag.

The first part is for reading by future compiles.
The second part is for reading by the final link step.
Splitting the file this way allows distributed build systems
to ship the compile-input part only to compile steps and
the linker-input part only to linker steps.

The first part is basically just the export data,
and the second part is basically everything else.
The overall files still have the same broad structure,
so that existing tools will work with both halves.
It's just that various pieces are empty in the two halves.

This also copies the two bits of data the linker needed from
export data into the object header proper, so that the linker
doesn't need any export data at all. That eliminates a TODO
that was left for switching to the binary export data.
(Now the linker doesn't need to know about the switch.)

The default is still to write out a combined output file.
Nothing changes unless you pass -linkobj to the compiler.
There is no support in the go command for -linkobj,
since the go command doesn't copy objects around.
The expectation is that other build systems (like bazel, say)
might take advantage of this.

The header adjustment and the option for the split output
was intended as part of the zip archives, but the zip archives
have been cut from Go 1.7. Doing this to the current archives
both unblocks one step in the switch to binary export data
and enables alternate build systems to experiment with the
new flag using the Go 1.7 release.

Change-Id: I8b6eab25b8a22b0a266ba0ac6d31e594f3d117f3
Reviewed-on: https://go-review.googlesource.com/22500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-09 17:31:45 +00:00
Dmitry Vyukov
aeecee8ce4 runtime/race: deflake test
The test sometimes fails on builders.
The test uses sleeps to establish the necessary goroutine
execution order. If sleeps undersleep/oversleep
the race is still reported, but it can be reported when the
main test goroutine returns. In such case test driver
can't match the race with the test and reports failure.

Wait for both test goroutines to ensure that the race
is reported in the test scope.

Fixes #15579

Change-Id: I0b9bec0ebfb0c127d83eb5325a7fe19ef9545050
Reviewed-on: https://go-review.googlesource.com/22951
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-09 14:50:18 +00:00
Robert Griesemer
87a2ae1fa2 cmd/compile: fix binary export of composite literals with implicit types
Also:
- replaced remaining panics with Fatal calls
- more comments

Fixes #15572.

Change-Id: Ifb27e80b66700f5692a84078764a1e928d4b310d
Reviewed-on: https://go-review.googlesource.com/22935
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-09 06:16:07 +00:00
Josh Bleecher Snyder
3696e469e5 test: add test for issue 15602
The problem was fixed by the rollback in CL 22930.
This CL just adds a test to prevent regressions.

Fixes #15602

Change-Id: I37453f6e18ca43081266fe7f154c6d63fbaffd9b
Reviewed-on: https://go-review.googlesource.com/22931
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-08 22:59:43 +00:00
Matthew Dempsky
55546efeee Revert "cmd/compile: properly handle map assignments for OAS2DOTTYPE"
This reverts commit 9d7c9b4384.

For #15602.

Change-Id: I464184b05babe4cb8dedab6161efa730cea6ee2d
Reviewed-on: https://go-review.googlesource.com/22930
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-08 20:15:04 +00:00
Joel Sing
0b6e5e3d73 cmd/link: specify correct size for dynamic symbols in 386 elf output
Currently 386 ELF binaries are generated with dynamic symbols that have
a size of zero bytes, even though the symbol in the symbol table has
the correct size. Fix this by specifying the correct size when creating
dynamic symbols.

Issue found on OpenBSD -current, where ld.so is now producing link
warnings due to mismatched symbol sizes.

Fixes #15593.

Change-Id: Ib1a12b23ff9159c61ac980bf48a983b86f3df256
Reviewed-on: https://go-review.googlesource.com/22912
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-08 05:34:56 +00:00
Robert Griesemer
394ac818b0 cmd/compile: add and enable (internal) option to only track named types
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>
2016-05-07 23:56:02 +00:00
Elias Naur
fa270ad98e cmd/go: add -shared to darwin/arm{,64} default build mode
Buildmode c-archive now supports position independent code for
darwin/arm (in addition to darwin/arm64). Make PIC (-shared) the
default for both platforms in the default buildmode.

Without this change, gomobile will go install the standard library
into its separate package directory without PIC support.

Also add -shared to darwin/arm64 in buildmode c-archive, for
symmetry (darwin/arm64 always generates position independent code).

Fixes #15519

Change-Id: If27d2cbea8f40982e14df25da2703cbba572b5c6
Reviewed-on: https://go-review.googlesource.com/22920
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-07 18:58:39 +00:00
Tal Shprecher
9d7c9b4384 cmd/compile: properly handle map assignments for OAS2DOTTYPE
The boolean destination in an OAS2DOTTYPE expression craps out during
compilation when trying to assign to a map entry because, unlike slice entries,
map entries are not directly addressable in memory. The solution is to
properly order the boolean destination node so that map entries are set
via autotmp variables.

Fixes #14678

Change-Id: If344e8f232b5bdac1b53c0f0d21eeb43ab17d3de
Reviewed-on: https://go-review.googlesource.com/22833
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-07 08:00:39 +00:00
Elias Naur
e6ec82067a runtime: use entire address space on 32 bit
In issue #13992, Russ mentioned that the heap bitmap footprint was
halved but that the bitmap size calculation hadn't been updated. This
presents the opportunity to either halve the bitmap size or double
the addressable virtual space. This CL doubles the addressable virtual
space. On 32 bit this can be tweaked further to allow the bitmap to
cover the entire 4GB virtual address space, removing a failure mode
if the kernel hands out memory with a too low address.

First, fix the calculation and double _MaxArena32 to cover 4GB virtual
memory space with the same bitmap size (256 MB).

Then, allow the fallback mode for the initial memory reservation
on 32 bit (or 64 bit with too little available virtual memory) to not
include space for the arena. mheap.sysAlloc will automatically reserve
additional space when the existing arena is full.

Finally, set arena_start to 0 in 32 bit mode, so that any address is
acceptable for subsequent (additional) reservations.

Before, the bitmap was always located just before arena_start, so
fix the two places relying on that assumption: Point the otherwise unused
mheap.bitmap to one byte after the end of the bitmap, and use it for
bitmap addressing instead of arena_start.

With arena_start set to 0 on 32 bit, the cgoInRange check is no longer a
sufficient check for Go pointers. Introduce and call inHeapOrStack to
check whether a pointer is to the Go heap or stack.

While we're here, remove sysReserveHigh which seems to be unused.

Fixes #13992

Change-Id: I592b513148a50b9d3967b5c5d94b86b3ec39acc2
Reviewed-on: https://go-review.googlesource.com/20471
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-07 03:04:39 +00:00
Brad Fitzpatrick
83676d694b net/url: remove RFC 3986 mention in package comment
Change-Id: Ifd707a4bbfcb1721655b4fce2045f3b043e66818
Reviewed-on: https://go-review.googlesource.com/22859
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-06 19:27:45 +00:00
Brad Fitzpatrick
7c5c6645d2 net: skip more flaky net tests on flaky net builders
e.g. https://storage.googleapis.com/go-build-log/9b937dd8/linux-arm_df54a25a.log

Change-Id: Ic5864c7bd840b4f0c6341f919fcbcd5c708b14e7
Reviewed-on: https://go-review.googlesource.com/22881
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-05-06 19:23:29 +00:00
Ian Lance Taylor
a1813ae0a0 misc/cgo/testcarchive: avoid possible pthread_create race
The old code assumed that the thread ID set by pthread_create would be
available in the newly created thread.  While that is clearly true
eventually, it is not necessarily true immediately.  Rather than try to
pass down the thread ID, just call pthread_self in the created thread.

Fixes #15576 (I hope).

Change-Id: Ic07086b00e4fd5676c04719a299c583320da64a1
Reviewed-on: https://go-review.googlesource.com/22880
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06 19:15:52 +00:00
Russ Cox
f0e2d32fde Revert "net/url: validate ports in IPv4 addresses"
This reverts commit 9f1ccd647f.

For #14860.

Change-Id: I63522a4dda8915dc8b972ae2e12495553ed65f09
Reviewed-on: https://go-review.googlesource.com/22861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 18:53:01 +00:00
Brad Fitzpatrick
4eccc77f19 net/http: wait longer for subprocess to startup in test
Might deflake the occasional linux-amd64-race failures.

Change-Id: I273b0e32bb92236168eb99887b166e079799c1f1
Reviewed-on: https://go-review.googlesource.com/22858
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-06 18:42:18 +00:00
Brad Fitzpatrick
31283dd483 net/http: don't assume Response.Request is populated after redirect errors
Fixes #15577

Change-Id: I5f023790a393b17235db2e66c02c2483773ddc1a
Reviewed-on: https://go-review.googlesource.com/22857
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 18:37:34 +00:00
Russ Cox
670a5cda20 Revert "testing/quick: generate more map and slice states"
This reverts commit 0ccabe2e0b.

Change-Id: Ib1c230fb6801c0ee26f4a352b0c1130fa240a76a
Reviewed-on: https://go-review.googlesource.com/22860
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06 18:25:28 +00:00
Brad Fitzpatrick
131231b8db os: rename remaining four os1_*.go files to os_*.go
Change-Id: Ice9c234960adc7857c8370b777a0b18e29d59281
Reviewed-on: https://go-review.googlesource.com/22853
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 17:47:44 +00:00
Brad Fitzpatrick
1ff57143af net: ignore network failures on some builders
We run the external network tests on builders, but some of our
builders have less-than-ideal DNS connectivity. This change continues
to run the tests on all builders, but marks certain builders as flaky
(network-wise), and only validates their DNS results if they got DNS
results.

Change-Id: I826dc2a6f6da55add89ae9c6db892b3b2f7b526b
Reviewed-on: https://go-review.googlesource.com/22852
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-06 17:24:09 +00:00
Brad Fitzpatrick
61602b0e9e runtime: delete empty files
I meant to delete these in CL 22850, actually.

Change-Id: I0c286efd2b9f1caf0221aa88e3bcc03649c89517
Reviewed-on: https://go-review.googlesource.com/22851
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 17:04:11 +00:00
Alberto Donizetti
a5c5f6ea94 all: fix copy-and-paste errors in tests
Fixes #15570

Change-Id: I95d1ac26e342c3bbf36ad1f0209711ea96eaf487
Reviewed-on: https://go-review.googlesource.com/22870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:56:19 +00:00
Aliaksandr Valialkin
c81a3532fe cmd/vet: check sync.* types' copying
Embed noLock struct into the following types, so `go vet -copylocks` catches
their copying additionally to types containing sync.Mutex:
  - sync.Cond
  - sync.WaitGroup
  - sync.Pool
  - atomic.Value

Fixes #14582

Change-Id: Icb543ef5ad10524ad239a15eec8a9b334b0e0660
Reviewed-on: https://go-review.googlesource.com/22015
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:43:51 +00:00
Richard Miller
258a4c3daf syscall,os,net: don't use ForkLock in plan9
This is the follow-on to CL 22610: now that it's the child instead of
the parent which lists unwanted fds to close in syscall.StartProcess,
plan9 no longer needs the ForkLock to protect the list from changing.
The readdupdevice function is also now unused and can be removed.

Change-Id: I904c8bbf5dbaa7022b0f1a1de0862cd3064ca8c7
Reviewed-on: https://go-review.googlesource.com/22842
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:43:07 +00:00
Brad Fitzpatrick
2dc680007e runtime: merge the last four os-vs-os1 files together
Change-Id: Ib0ba691c4657fe18a4659753e70d97c623cb9c1d
Reviewed-on: https://go-review.googlesource.com/22850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-06 16:03:25 +00:00
Cherry Zhang
bf151cc2aa cmd/compile/internal/mips64: fix large uint -> float conversion
Re-enable TestFP in cmd/compile/internal/gc on mips64.

Fixes #15552.

Change-Id: I5c3a5564b94d28c723358f0862468fb6da371991
Reviewed-on: https://go-review.googlesource.com/22835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:02:30 +00:00
Ilya Tocar
fafadc521e crypto/sha1: Add AVX2 version for AMD64
name             old time/op    new time/op    delta
Hash8Bytes-48       271ns ± 8%     273ns ± 5%     ~     (p=0.313 n=19+19)
Hash320Bytes-48    1.04µs ± 7%    0.75µs ± 8%  -27.66%  (p=0.000 n=20+20)
Hash1K-48          2.72µs ± 6%    1.75µs ± 6%  -35.79%  (p=0.000 n=19+20)
Hash8K-48          19.9µs ± 7%    11.6µs ± 6%  -41.84%  (p=0.000 n=20+19)

name             old speed      new speed      delta
Hash8Bytes-48    29.5MB/s ± 8%  29.3MB/s ± 5%     ~     (p=0.314 n=19+19)
Hash320Bytes-48   307MB/s ± 7%   424MB/s ± 8%  +38.29%  (p=0.000 n=20+20)
Hash1K-48         377MB/s ± 6%   587MB/s ± 6%  +55.76%  (p=0.000 n=19+20)
Hash8K-48         413MB/s ± 7%   709MB/s ± 6%  +71.85%  (p=0.000 n=20+19)

Change-Id: I2963cf744eeb2e8191d4e4223fbf6f533a7fd405
Reviewed-on: https://go-review.googlesource.com/22607
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 15:20:49 +00:00
Ilya Tocar
2210d88a88 crypto/sha256: Use AVX2 if possible
name          old time/op    new time/op    delta
Hash8Bytes-4     376ns ± 0%     246ns ± 0%  -34.57%  (p=0.000 n=20+20)
Hash1K-4        5.21µs ± 0%    2.82µs ± 0%  -45.83%  (p=0.000 n=20+20)
Hash8K-4        38.6µs ± 0%    20.8µs ± 0%  -46.05%  (p=0.000 n=20+20)

name          old speed      new speed      delta
Hash8Bytes-4  21.2MB/s ± 0%  32.4MB/s ± 0%  +52.70%  (p=0.000 n=15+19)
Hash1K-4       197MB/s ± 0%   363MB/s ± 0%  +84.60%  (p=0.000 n=20+20)
Hash8K-4       212MB/s ± 0%   393MB/s ± 0%  +85.36%  (p=0.000 n=20+20)

Change-Id: Ib50119c591074ff486d11d3566e24b691bcc6598
Reviewed-on: https://go-review.googlesource.com/22608
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-06 15:20:37 +00:00
Elias Naur
e558fdbd9a misc/cgo/testcarchive: don't force -no_pie on Darwin
Now that darwin/arm supports position independent code, allow the
binaries generated by the c-archive tests be position independent
(PIE) as well.

Change-Id: If0517f06e92349ada29a4e3e0a951f08b0fcc710
Reviewed-on: https://go-review.googlesource.com/22841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 15:19:55 +00:00
Ilya Tocar
009c002c92 cmd/internal/obj/x86: add AVX2 instrutions needed for sha1/sha512/sha256 acceleration
This means: VPSHUFB, VPSHUFD, VPERM2F128, VPALIGNR, VPADDQ, VPADDD, VPSRLDQ,
VPSLLDQ, VPSRLQ, VPSLLQ, VPSRLD, VPSLLD, VPOR, VPBLENDD, VINSERTI128,
VPERM2I128, RORXL, RORXQ.

Change-Id: Ief27190ee6acfa86b109262af5d999bc101e923d
Reviewed-on: https://go-review.googlesource.com/22606
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-06 13:48:29 +00:00
Shenghou Ma
2e32efc44a runtime: get randomness from AT_RANDOM AUXV on linux/mips64x
Fixes #15148.

Change-Id: If3b628f30521adeec1625689dbc98aaf4a9ec858
Reviewed-on: https://go-review.googlesource.com/22811
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 05:50:02 +00:00
Cherry Zhang
ef92857e27 cmd/go, cmd/cgo: pass "-mabi=64" to gcc on mips64
Change-Id: I9ac2ae57a00cee23d6255db02419b0a0f087d4f3
Reviewed-on: https://go-review.googlesource.com/22801
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
2016-05-06 04:08:43 +00:00
Robert Griesemer
d68f800620 test: update test for issue 15548
Accidentally checked in the version of file c.go that doesn't
exhibit the bug - hence the test was not testing the bug fix.
Double-checked that this version exposes the bug w/o the fix.

Change-Id: Ie4dc455229d1ac802a80164b5d549c2ad4d971f5
Reviewed-on: https://go-review.googlesource.com/22837
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-06 02:50:42 +00:00
Brad Fitzpatrick
b90cb3f471 cmd/go: fail with nice error message on bad GOOS/GOARCH pair
Fixes #12272

Change-Id: I2115ec62ed4061084c482eb385a583a1c1909888
Reviewed-on: https://go-review.googlesource.com/22838
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-06 01:18:07 +00:00
Joe Tsai
30bfafc319 archive/tar: centralize all information about tar header format
The Reader and Writer have hard-coded constants regarding the
offsets and lengths of certain fields in the tar format sprinkled
all over. This makes it harder to verify that the offsets are
correct since a reviewer would need to search for them throughout
the code. Instead, all information about the layout of header
fields should be centralized in one single file. This has the
advantage of being both centralized, and also acting as a form
of documentation about the header struct format.

This method was chosen over using "encoding/binary" since that
method would cause an allocation of a header struct every time
binary.Read was called. This method causes zero allocations and
its logic is no longer than if structs were declared.

Updates #12594

Change-Id: Ic7a0565d2a2cd95d955547ace3b6dea2b57fab34
Reviewed-on: https://go-review.googlesource.com/14669
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06 00:57:22 +00:00
Russ Cox
88d3db0a5b runtime: stop traceback at foreign function
This can only happen when profiling and there is foreign code
at the top of the g0 stack but we're not in cgo.
That in turn only happens with the race detector.

Fixes #13568.

Change-Id: I23775132c9c1a3a3aaae191b318539f368adf25e
Reviewed-on: https://go-review.googlesource.com/18322
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 00:54:25 +00:00
Mikio Hara
a633d766d1 Revert "net: add support for Zone of IPNet"
Updates #14518.

This reverts commit 3e9264c9ae.

Change-Id: I2531b04efc735b5b51ef675541172f2f5ae747d9
Reviewed-on: https://go-review.googlesource.com/22836
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06 00:14:26 +00:00
Joe Tsai
acc757f678 all: use SeekStart, SeekCurrent, SeekEnd
CL/19862 (f79b50b8d5) 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>
2016-05-06 00:10:41 +00:00
David Chase
6db98a3c51 cmd/compile: repair MININT conversion bug in arm softfloat
Negative-case conversion code was wrong for minimum int32,
used negate-then-widen instead of widen-then-negate.

Test already exists; this fixes the failure.

Fixes #15563.

Change-Id: I4b0b3ae8f2c9714bdcc405d4d0b1502ccfba2b40
Reviewed-on: https://go-review.googlesource.com/22830
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 22:29:25 +00:00
Alan Donovan
5f83bf6053 go/token: document postcondition of SetLines
Change-Id: Ie163deade396b3e298a93845b9ca4d52333ea82a
Reviewed-on: https://go-review.googlesource.com/22831
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-05 22:06:31 +00:00
Richard Miller
5bf9b39acc os/exec: re-enable TestExtraFiles for plan9
This test should now succeed after CL 22610 which fixes issue #7118

Change-Id: Ie785a84d77b27c832a1ddd81699bf25dab24b97d
Reviewed-on: https://go-review.googlesource.com/22640
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 22:01:06 +00:00
Richard Miller
639a20da90 syscall: simplify closing of extra fds in plan9 StartProcess
Reviving earlier work by @ality in https://golang.org/cl/57890043
to make the closing of extra file descriptors in syscall.StartProcess
less race-prone. Instead of making a list of open fds in the parent
before forking, the child can read through the list of open fds and
close the ones not explicitly requested.  Also eliminate the
complication of keeping open any extra fds which were inherited by
the parent when it started.

This CL will be followed by one to eliminate the ForkLock in plan9,
which is now redundant.

Fixes #5605

Change-Id: I6b4b942001baa54248b656c52dced3b62021c486
Reviewed-on: https://go-review.googlesource.com/22610
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
2016-05-05 21:58:03 +00:00
Andrew Gerrand
9b05ae612a doc: update broken links in release notes
Fixes #15559

Change-Id: Ie58650f35e32c1f49669134b62876357abcdc583
Reviewed-on: https://go-review.googlesource.com/22823
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-05 20:32:06 +00:00
Robert Griesemer
8650c23034 cmd/compile: verify imported types after they are fully imported
Fixes #15548.

Change-Id: I1dfa9c8739a4b6d5e4c737c1a1e09e80e045b7aa
Reviewed-on: https://go-review.googlesource.com/22803
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-05 20:31:30 +00:00
Emmanuel Odeke
1a7fc2357b runtime: print signal name in panic, if name is known
Adds a small function signame that infers a signal name
from the signal table, otherwise will fallback to using
hex(sig) as previously. No signal table is present for
Windows hence it will always print the hex value.

Sample code and new result:
```go
package main

import (
  "fmt"
  "time"
)

func main() {
  defer func() {
    if err := recover(); err != nil {
      fmt.Printf("err=%v\n", err)
    }
  }()

  ticker := time.Tick(1e9)
  for {
    <-ticker
  }
}
```

```shell
$ go run main.go &
$ kill -11 <pid>
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e
pc=0xc71db]
...
```

Fixes #13969

Change-Id: Ie6be312eb766661f1cea9afec352b73270f27f9d
Reviewed-on: https://go-review.googlesource.com/22753
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 19:58:00 +00:00
Russ Cox
fafd792de3 net: fix hostLookupOrder("")
Fixes #13623.

Change-Id: I1bd96aa7b6b715e4dbdcf0c37c2d29228df6565c
Reviewed-on: https://go-review.googlesource.com/18329
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 19:15:38 +00:00
Lynn Boger
eeca3ba92f sync/atomic, runtime/internal/atomic: improve ppc64x atomics
The following performance improvements have been made to the
low-level atomic functions for ppc64le & ppc64:

- For those cases containing a lwarx and stwcx (or other sizes):
sync, lwarx, maybe something, stwcx, loop to sync, sync, isync
The sync is moved before (outside) the lwarx/stwcx loop, and the
 sync after is removed, so it becomes:
sync, lwarx, maybe something, stwcx, loop to lwarx, isync

- For the Or8 and And8, the shifting and manipulation of the
address to the word aligned version were removed and the
instructions were changed to use lbarx, stbcx instead of
register shifting, xor, then lwarx, stwcx.

- New instructions LWSYNC, LBAR, STBCC were tested and added.
runtime/atomic_ppc64x.s was changed to use the LWSYNC opcode
instead of the WORD encoding.

Fixes #15469

Ran some of the benchmarks in the runtime and sync directories.
Some results varied from run to run but the trend was improvement
based on best times for base and new:

runtime.test:
BenchmarkChanNonblocking-128         0.88          0.89          +1.14%
BenchmarkChanUncontended-128         569           511           -10.19%
BenchmarkChanContended-128           63110         53231         -15.65%
BenchmarkChanSync-128                691           598           -13.46%
BenchmarkChanSyncWork-128            11355         11649         +2.59%
BenchmarkChanProdCons0-128           2402          2090          -12.99%
BenchmarkChanProdCons10-128          1348          1363          +1.11%
BenchmarkChanProdCons100-128         1002          746           -25.55%
BenchmarkChanProdConsWork0-128       2554          2720          +6.50%
BenchmarkChanProdConsWork10-128      1909          1804          -5.50%
BenchmarkChanProdConsWork100-128     1624          1580          -2.71%
BenchmarkChanCreation-128            237           212           -10.55%
BenchmarkChanSem-128                 705           667           -5.39%
BenchmarkChanPopular-128             5081190       4497566       -11.49%

BenchmarkCreateGoroutines-128             532           473           -11.09%
BenchmarkCreateGoroutinesParallel-128     35.0          34.7          -0.86%
BenchmarkCreateGoroutinesCapture-128      4923          4200          -14.69%

sync.test:
BenchmarkUncontendedSemaphore-128      112           94.2          -15.89%
BenchmarkContendedSemaphore-128        133           128           -3.76%
BenchmarkMutexUncontended-128          1.90          1.67          -12.11%
BenchmarkMutex-128                     353           310           -12.18%
BenchmarkMutexSlack-128                304           283           -6.91%
BenchmarkMutexWork-128                 554           541           -2.35%
BenchmarkMutexWorkSlack-128            567           556           -1.94%
BenchmarkMutexNoSpin-128               275           242           -12.00%
BenchmarkMutexSpin-128                 1129          1030          -8.77%
BenchmarkOnce-128                      1.08          0.96          -11.11%
BenchmarkPool-128                      29.8          27.4          -8.05%
BenchmarkPoolOverflow-128              40564         36583         -9.81%
BenchmarkSemaUncontended-128           3.14          2.63          -16.24%
BenchmarkSemaSyntNonblock-128          1087          1069          -1.66%
BenchmarkSemaSyntBlock-128             897           893           -0.45%
BenchmarkSemaWorkNonblock-128          1034          1028          -0.58%
BenchmarkSemaWorkBlock-128             949           886           -6.64%

Change-Id: I4403fb29d3cd5254b7b1ce87a216bd11b391079e
Reviewed-on: https://go-review.googlesource.com/22549
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-05 18:52:28 +00:00
Shenghou Ma
0960c7c7eb context: use https in docs
Change-Id: I9354712768702e3b083c77f30165a34cb414d686
Reviewed-on: https://go-review.googlesource.com/22810
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-05 18:31:23 +00:00
Josh Bleecher Snyder
bc1989f115 cmd/compile: optimize lookupVarOutgoing
If b has exactly one predecessor, as happens
frequently with static calls, we can make
lookupVarOutgoing generate less garbage.

Instead of generating a value that is just
going to be an OpCopy and then get eliminated,
loop. This can lead to lots of looping.
However, this loop is way cheaper than generating
lots of ssa.Values and then eliminating them.

For a subset of the code in #15537:

Before:

       28.31 real        36.17 user         1.68 sys
2282450944  maximum resident set size

After:

        9.63 real        11.66 user         0.51 sys
 638144512  maximum resident set size

Updates #15537.

Excitingly, it appears that this also helps
regular code:

name       old time/op      new time/op      delta
Template        288ms ± 6%       276ms ± 7%   -4.13%        (p=0.000 n=21+24)
Unicode         143ms ± 8%       141ms ±10%     ~           (p=0.287 n=24+25)
GoTypes         932ms ± 4%       874ms ± 4%   -6.20%        (p=0.000 n=23+22)
Compiler        4.89s ± 4%       4.58s ± 4%   -6.46%        (p=0.000 n=22+23)
MakeBash        40.2s ±13%       39.8s ± 9%     ~           (p=0.648 n=23+23)

name       old user-ns/op   new user-ns/op   delta
Template   388user-ms ±10%  373user-ms ± 5%   -3.80%        (p=0.000 n=24+25)
Unicode    203user-ms ± 6%  202user-ms ± 7%     ~           (p=0.492 n=22+24)
GoTypes    1.29user-s ± 4%  1.17user-s ± 4%   -9.67%        (p=0.000 n=25+23)
Compiler   6.86user-s ± 5%  6.28user-s ± 4%   -8.49%        (p=0.000 n=25+25)

name       old alloc/op     new alloc/op     delta
Template       51.5MB ± 0%      47.6MB ± 0%   -7.47%        (p=0.000 n=22+25)
Unicode        37.2MB ± 0%      37.1MB ± 0%   -0.21%        (p=0.000 n=25+25)
GoTypes         166MB ± 0%       138MB ± 0%  -16.83%        (p=0.000 n=25+25)
Compiler        756MB ± 0%       628MB ± 0%  -16.96%        (p=0.000 n=25+23)

name       old allocs/op    new allocs/op    delta
Template         450k ± 0%        445k ± 0%   -1.02%        (p=0.000 n=25+25)
Unicode          356k ± 0%        356k ± 0%     ~           (p=0.374 n=24+25)
GoTypes         1.31M ± 0%       1.25M ± 0%   -4.18%        (p=0.000 n=25+25)
Compiler        5.29M ± 0%       5.02M ± 0%   -5.15%        (p=0.000 n=25+23)

It also seems to help in other cases in which
phi insertion is a pain point (#14774, #14934).

Change-Id: Ibd05ed7b99d262117ece7bb250dfa8c3d1cc5dd2
Reviewed-on: https://go-review.googlesource.com/22790
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2016-05-05 17:45:21 +00:00
Cherry Zhang
6ccab441de cmd/compile/internal/gc: skip TestFP on mips64x
The legacy mips64 backend doesn't handle large uint->float conversion
correctly. See #15552.

Change-Id: I84ceeaa95cc4e85f09cc46dfb30ab5d151f6b205
Reviewed-on: https://go-review.googlesource.com/22800
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-05 16:14:47 +00:00
Cherry Zhang
bfa89c3cd4 cmd/compile/internal/gc: remove duplicated TestFP
TestFp and TestFP are same, remove one.

Change-Id: Iffdece634cd4572421974496298925e7c6ac13a9
Reviewed-on: https://go-review.googlesource.com/22799
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 16:14:17 +00:00