]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocmd: -buildmode=c-shared for linux/arm
Srdjan Petrovic [Mon, 13 Apr 2015 22:39:10 +0000 (15:39 -0700)]
cmd: -buildmode=c-shared for linux/arm

Already supported platforms are linux/amd64 and android/arm.

Running -buildmode=c-shared on linux/arm is equivalent to:
  -ldflags "-shared" -asmflags "-shared"

Change-Id: Ifdb267f1d6508157f236be912fa369440172d161
Reviewed-on: https://go-review.googlesource.com/8895
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agotest: add gcc65755.go for http://gcc.gnu.org/PR65755
Ian Lance Taylor [Mon, 13 Apr 2015 22:29:09 +0000 (15:29 -0700)]
test: add gcc65755.go for http://gcc.gnu.org/PR65755

Change-Id: Ic35dff4c9a7fc6716ef9d5553a7b1769bed9be01
Reviewed-on: https://go-review.googlesource.com/8892
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoos: fix TestProgWideChdir on darwin
Mikio Hara [Mon, 13 Apr 2015 03:11:00 +0000 (12:11 +0900)]
os: fix TestProgWideChdir on darwin

On darwin, /tmp and /var directories are usually linked to /private.

% cd $TMPDIR; pwd -L
/var/.../T
% pwd -P
/private/var/.../T

Change-Id: I277ff2d096344d9a80e6004a83e9fc3e1716348c
Reviewed-on: https://go-review.googlesource.com/8842
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoruntime: shared library init support for android/arm.
Srdjan Petrovic [Fri, 3 Apr 2015 16:48:51 +0000 (09:48 -0700)]
runtime: shared library init support for android/arm.

Follows http://golang.org/cl/8454, a similar CL for arm architectures.
This CL involves android-specific changes, namely, synthesizing
argv/auxv, as android doesn't provide those to the init functions.

This code is based on crawshaw@ android code in golang.org/x/mobile.

Change-Id: I32364efbb2662e80270a99bd7dfb1d0421b5417d
Reviewed-on: https://go-review.googlesource.com/8457
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agodoc/go1.5.txt: fmt fix for empty byte slice
Rob Pike [Mon, 13 Apr 2015 21:40:09 +0000 (14:40 -0700)]
doc/go1.5.txt: fmt fix for empty byte slice

Change-Id: I392cedc49847c8ea0daa38024fca97a289d805af
Reviewed-on: https://go-review.googlesource.com/8890
Reviewed-by: Rob Pike <r@golang.org>
10 years agofmt: empty byte slices should print nothing in hex
Rob Pike [Mon, 13 Apr 2015 19:41:11 +0000 (12:41 -0700)]
fmt: empty byte slices should print nothing in hex

The documentation is clear that formats like %02x applied to a
byte slice are per-element, so the result should be nothing if the
slice is empty. It's not, because the top-level padding routine is called.
It shouldn't be: the loop does the padding for us.

Fixes #10430.

Change-Id: I04ea0e804c0f2e70fff3701e5bf22acc90e890da
Reviewed-on: https://go-review.googlesource.com/8864
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: document that DNSError.Timeout and Temporary are unreliable
Ian Lance Taylor [Sat, 11 Apr 2015 17:30:13 +0000 (10:30 -0700)]
net: document that DNSError.Timeout and Temporary are unreliable

Update #10417.

Change-Id: Ibfbdd05358f696a37217eef160f71b14a468ff86
Reviewed-on: https://go-review.googlesource.com/8788
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: use gccgo as bootstrap compiler
Dave Cheney [Mon, 13 Apr 2015 11:50:47 +0000 (21:50 +1000)]
cmd/dist: use gccgo as bootstrap compiler

Fixes #10092

This change makes it possible to use gccgo 5 as the GOROOT_BOOTSTRAP
compiler.

Change-Id: Ie3a312781ac1a09ea77f95b5a78c9488d437e0aa
Reviewed-on: https://go-review.googlesource.com/8809
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agomisc/cgo/testcarchive: avoid bad pointer passing
David Crawshaw [Mon, 13 Apr 2015 18:54:36 +0000 (14:54 -0400)]
misc/cgo/testcarchive: avoid bad pointer passing

Change-Id: Ifbcc0eb24834f2f7d3b160d1dc911209723d9797
Reviewed-on: https://go-review.googlesource.com/8863
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agomisc/ios: support go run in go_darwin_arm_exec
David Crawshaw [Fri, 6 Mar 2015 14:45:24 +0000 (09:45 -0500)]
misc/ios: support go run in go_darwin_arm_exec

The -lldb flag makes it easy to use go run and end up in a debugging
session on darwin/arm.

Change-Id: I556f93e950086a7dff4839f301b9c55f7579f87b
Reviewed-on: https://go-review.googlesource.com/8024
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: shared library runtime init for arm
Srdjan Petrovic [Fri, 3 Apr 2015 16:40:10 +0000 (09:40 -0700)]
runtime: shared library runtime init for arm

Adds the runtime initialization flow for arm akin to amd64.
In particular,we use the library initialization entry point to:
    - create a new OS thread and run the "regular" runtime init stack on
      that thread
    - return immediately from the main (i.e., loader) thread
    - at the first CGO invocation, we wait for the runtime initialization
      to complete.

Verified to work on a Raspberry Pi and an Android phone.

Change-Id: I32f39228ae30a03ce9569287f234b305790fecf6
Reviewed-on: https://go-review.googlesource.com/8455
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>

10 years agomisc/cgo/testcarchive: test -buildmode=c-archive
David Crawshaw [Mon, 13 Apr 2015 15:31:14 +0000 (11:31 -0400)]
misc/cgo/testcarchive: test -buildmode=c-archive

Change-Id: I1668a6885c45180ff88fe673d04cec7eba395ee7
Reviewed-on: https://go-review.googlesource.com/8861
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: remove runtime wait/notify from ppc64x architectures.
Srdjan Petrovic [Sat, 11 Apr 2015 00:23:00 +0000 (17:23 -0700)]
runtime: remove runtime wait/notify from ppc64x architectures.

Related to issue #10410

For some reason, any non-trivial code in _cgo_wait_runtime_init_done
(even fprintf()) will crash that call.

If anybody has any guess why this is happening, please let me know!

For now, I'm clearing the functions for ppc64, as it's currently not used.

Change-Id: I1b11383aaf4f9f9a16f1fd6606842cfeedc9f0b3
Reviewed-on: https://go-review.googlesource.com/8766
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>

10 years agoiostest.bash: do not restart device by default
Josh Bleecher Snyder [Mon, 13 Apr 2015 16:30:56 +0000 (09:30 -0700)]
iostest.bash: do not restart device by default

This is friendlier for manual runs and personal devices.
Builders will pass -restart.

Fixes #10333.

Change-Id: Ia64c8f1660e275b5a1543d7f81f5f5efb623182f
Reviewed-on: https://go-review.googlesource.com/8870
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/go: -buildmode=c-archive support
David Crawshaw [Fri, 10 Apr 2015 13:11:03 +0000 (09:11 -0400)]
cmd/go: -buildmode=c-archive support

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

10 years agoruntime/cgo: EXC_BAD_ACCESS handler for arm64
David Crawshaw [Sat, 11 Apr 2015 23:14:02 +0000 (19:14 -0400)]
runtime/cgo: EXC_BAD_ACCESS handler for arm64

Change-Id: Ia9ff9c0d381fad43fc5d3e5972dd6e66503733a5
Reviewed-on: https://go-review.googlesource.com/8815
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/objdump: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:37:29 +0000 (19:37 -0400)]
cmd/objdump: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ibaba67980db6e05aa71568199b2dac2fcaa86fd6
Reviewed-on: https://go-review.googlesource.com/8824
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/pack: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:36:26 +0000 (19:36 -0400)]
cmd/pack: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: I5ed26975670d4189a46b585a56c66c199905d168
Reviewed-on: https://go-review.googlesource.com/8823
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime/pprof: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:04:25 +0000 (19:04 -0400)]
runtime/pprof: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ic75927bd6457d37cda7dd8279fd9b4cd52edc1d1
Reviewed-on: https://go-review.googlesource.com/8813
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/go: run darwin/arm64 tests sequentially
David Crawshaw [Sat, 11 Apr 2015 23:41:26 +0000 (19:41 -0400)]
cmd/go: run darwin/arm64 tests sequentially

Just like darwin/arm, the test devices can only install and execute
a single app at a time.

Change-Id: I74e6130ef83537c465b4585a366d02953fd907bf
Reviewed-on: https://go-review.googlesource.com/8827
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime/debug: disable arm64 test for issue 9993
David Crawshaw [Sat, 11 Apr 2015 23:10:39 +0000 (19:10 -0400)]
runtime/debug: disable arm64 test for issue 9993

Like other arm64 platforms, darwin/arm64 has a different physical
page size to logical page size so it is running into issue 9993. I
hope it can be fixed for Go 1.5, but for now it is demonstrating the
same bug as the other skipped os+arch combinations.

Change-Id: Iedaf9afe56d6954bb4391b6e843d81742a75a00c
Reviewed-on: https://go-review.googlesource.com/8814
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocrypto/x509: skip arm64 tests limited by iOS
David Crawshaw [Sat, 11 Apr 2015 23:30:37 +0000 (19:30 -0400)]
crypto/x509: skip arm64 tests limited by iOS

Just like darwin/arm.

Change-Id: Ib0438021bfe9eb105222b93e5bb375c282cc7b8c
Reviewed-on: https://go-review.googlesource.com/8822
Reviewed-by: Minux Ma <minux@golang.org>
10 years agolog/syslog: limiting tests on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:26:50 +0000 (19:26 -0400)]
log/syslog: limiting tests on darwin/arm64

Just like darwin/arm.

Change-Id: Ic5c6c0b2fdbb89f4579677e120a8f2dbf300e5b9
Reviewed-on: https://go-review.googlesource.com/8820
Reviewed-by: Minux Ma <minux@golang.org>
10 years agogo/build: skip darwin/arm64 tests that need GOROOT
David Crawshaw [Sat, 11 Apr 2015 23:28:29 +0000 (19:28 -0400)]
go/build: skip darwin/arm64 tests that need GOROOT

Just like darwin/arm.

Change-Id: I1a9f51c572c14b78d35ea62f52927f2bdc46e4c0
Reviewed-on: https://go-review.googlesource.com/8821
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoos/exec: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:23:05 +0000 (19:23 -0400)]
os/exec: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ia8c912e91259a5073aa3ab2b6509a18aa9a1fce7
Reviewed-on: https://go-review.googlesource.com/8818
Reviewed-by: Minux Ma <minux@golang.org>
10 years agopath/filepath: skip test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:16:24 +0000 (19:16 -0400)]
path/filepath: skip test on darwin/arm64

Just like darwin/arm.

Change-Id: I4b0ab4a104f2c8a821ca8b5fa8d266e51883709f
Reviewed-on: https://go-review.googlesource.com/8816
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:00:53 +0000 (19:00 -0400)]
runtime: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ie4998d24b2d891a9f6c8047ec40cd3fdf80622cd
Reviewed-on: https://go-review.googlesource.com/8812
Reviewed-by: Minux Ma <minux@golang.org>
10 years agonet/http/cgi: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:25:45 +0000 (19:25 -0400)]
net/http/cgi: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ib9a32bb0aed5f08b27de11a93aaf273cacdf5779
Reviewed-on: https://go-review.googlesource.com/8819
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/go: cache results of HTTP requests done during meta tag discovery
Brad Fitzpatrick [Fri, 10 Apr 2015 13:59:06 +0000 (15:59 +0200)]
cmd/go: cache results of HTTP requests done during meta tag discovery

Previously, running

  $ go get -u -v golang.org/x/tools/cmd/godoc

would results in dozens of HTTP requests for

  https://golang.org/x/tools?go-get=1

once per package under x/tools.

Now it caches the results. We still end up doing one HTTP request for
all the packages under x/tools, but this reduces the total number of
HTTP requests in ~half.

This also moves the singleflight package back into an internal
package. singleflight was originally elsewhere as a package, then got
copied into "net" (without its tests). But now that we have internal,
put it in its own package, and restore its test.

Fixes #9249

Change-Id: Ieb5cf04fc4d0a0c188cb957efdc7ea3068c34e3f
Reviewed-on: https://go-review.googlesource.com/8727
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agoruntime: move all exception related code into signal_windows.go
Alex Brainman [Mon, 13 Apr 2015 02:02:44 +0000 (12:02 +1000)]
runtime: move all exception related code into signal_windows.go

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

10 years agoimage/gif: expose disposal, bg index and Config
Colin Kennedy [Wed, 11 Feb 2015 22:58:55 +0000 (16:58 -0600)]
image/gif: expose disposal, bg index and Config

The background index in the global palette (located in the image.Config)
is necessary for interpreting GIF frames properly

Frame disposal information is necessary for interpreting GIF frames in
the context of a sequence (or animation)

Removes decoder.flags as it can be a local variable

Change-Id: I6790a7febf6ba0859175c834c807bc6413e6b194
Reviewed-on: https://go-review.googlesource.com/4620
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoexpvar: swap Float sync. from mutex to atomic.
Matt T. Proud [Mon, 2 Feb 2015 08:33:44 +0000 (00:33 -0800)]
expvar: swap Float sync. from mutex to atomic.

Float type from a mutex to atomic bit array in a manner akin to
Google Guava's AtomicDouble[0], including adding a benchmark for the
type (benchcmp included below) along with some expvar_test.go cruft
being fixed.

benchmark             old ns/op     new ns/op     delta
BenchmarkFloatSet     115           9.37          -91.85%
BenchmarkFloatAdd     114           17.1          -85.00%

benchmark             old allocs     new allocs     delta
BenchmarkFloatSet     0              0              +0.00%
BenchmarkFloatAdd     0              0              +0.00%

benchmark             old bytes     new bytes     delta
BenchmarkFloatSet     0             0             +0.00%
BenchmarkFloatAdd     0             0             +0.00%

[0] - http://goo.gl/m4dtlI

Change-Id: I4ce6a913734ec692e3ed243f6e6f7c11da4c6036
Reviewed-on: https://go-review.googlesource.com/3687
Reviewed-by: Rob Pike <r@golang.org>
10 years agoos: add TestProgWideChdir
David du Colombier [Sun, 12 Apr 2015 17:36:23 +0000 (19:36 +0200)]
os: add TestProgWideChdir

This test checks the working directory is
always consistent after Chdir in a Go program.

Fixes #10035.

Change-Id: I6abf0e4fcd40680ee572c6b40fc52ab17ef38d54
Reviewed-on: https://go-review.googlesource.com/6382
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agosyscall: ignore getwd errors when fixing working directory on Plan 9
David du Colombier [Sat, 11 Apr 2015 12:58:42 +0000 (14:58 +0200)]
syscall: ignore getwd errors when fixing working directory on Plan 9

In Plan 9, goroutines can run in different processes,
which don't share their working directory. However,
Go expects the working directory to be program-wide.

We use a Fixwd function to fix the working directory
before calling system calls which depend on the
working directory.

In fixwdLocked, the working directory is not fixed
when getwd returns an error. However, an error can
happen is some cases, notably when the directory
has been previously removed in another process.

Fixes #10422.

Change-Id: Ie0c36f97c4b5ebe27ff0ead360987c5b35f825e4
Reviewed-on: https://go-review.googlesource.com/8800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/go: fix a typo.
Hyang-Ah (Hana) Kim [Sun, 12 Apr 2015 16:08:06 +0000 (12:08 -0400)]
cmd/go: fix a typo.

Change-Id: Ic453da17817f66e1073f6ba740b830b8daf2fc38
Reviewed-on: https://go-review.googlesource.com/8829
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agodebug/dwarf: add Entry.AttrField method to get *Field by Attr
Austin Clements [Mon, 6 Apr 2015 22:01:45 +0000 (18:01 -0400)]
debug/dwarf: add Entry.AttrField method to get *Field by Attr

Currently, Entry has a Val method that looks up an attribute and
returns its value. Now that Field has more fields than the attribute
and its value, it's useful to return the whole Field and let the
caller retrieve the parts it needs.

This change adds an AttrField method to Entry that does the same
lookup at Val, but returns the whole *Field rather than just the
value.

Change-Id: Ic629744c14c0e09d7528fa1026b0e1857789948c
Reviewed-on: https://go-review.googlesource.com/8503
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodebug/dwarf: add DWARF attribute value class to Field
Austin Clements [Thu, 2 Apr 2015 15:19:00 +0000 (11:19 -0400)]
debug/dwarf: add DWARF attribute value class to Field

To return DWARF attribute values, debug/dwarf maps the DWARF attribute
value classes to Go types. Unfortunately, this mapping is ambiguous in
a way that makes it impossible to correctly interpret some DWARF
attributes as of DWARF 4. For example, AttrStartScope can be either a
constant or a rangelistptr. The attribute is interpreted differently
depending on its class, but debug/dwarf maps both classes to int64, so
the caller can't distinguish them from the Go type.
AttrDataMemberLocation is similar.

To address this, this change adds a field to type Field that indicates
the exact DWARF attribute value class of that field's value. This
makes it possible to distinguish value classes that can't be
distinguished by their Go type alone.

The root of this type ambiguity was DWARF itself. For example, DWARF 2
made no distinction between constants that were just constants and
constants that were section offsets because no attribute could have
both meanings. Hence, the single int64 type was sufficient. To avoid
introducing just another layer of ambiguity, this change takes pains
to canonicalize ambiguous classes in DWARF 2 and 3 files into the
unambiguous classes of DWARF 4.

Of course, there's no guarantee that future DWARF versions won't do
the same thing again and further subdivide the DWARF 4 classes. This
change gets ahead of this somewhat by distinguishing the various *ptr
classes even though the encoding does not. If there's some other form
of split, we can handle this in a backwards-compatible way by
introducing, for example, a Class5 field and type.

Change-Id: I4ef96d1223b0fd7f96ecf44fcc0e704a36af02b4
Reviewed-on: https://go-review.googlesource.com/8502
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/interal/ld: darwin c-archive buildmode support
David Crawshaw [Thu, 9 Apr 2015 14:44:05 +0000 (10:44 -0400)]
cmd/interal/ld: darwin c-archive buildmode support

Uses ar to create an archive when -buildmode=c-archive.

A small example (that I hope to turn into a test in a later CL):

goarchive.go:
package main

import "fmt"

import "C"

func init() {
fmt.Println("ran go init")
}

//export FuncInGo
func FuncInGo() {
fmt.Println("called a go function")
}

func main() {
fmt.Println("in main")
}

This can be compiled with:

go build -ldflags=-buildmode=c-archive -o=libgo.a goarchive.go

main.c:

#include <stdio.h>

extern void FuncInGo();

int main(void) {
printf("c hello\n");
FuncInGo();
printf("c goodbye\n");
return 0;
}

Can be compiled with:

cc main.c libgo.a

Apple provide a warning about the lack of PIE, but still produce a
binary which runs and outputs (on darwin/amd64):

c hello
ran go init
called a go function
c goodbye

Change-Id: I7611925f210a83afa6bd1e66a5601dd636a428c8
Reviewed-on: https://go-review.googlesource.com/8711
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: library entry point for darwin/arm
David Crawshaw [Fri, 10 Apr 2015 17:07:04 +0000 (13:07 -0400)]
runtime: library entry point for darwin/arm

Tested by using -buildmode=c-archive to generate an archive, add it
to an Xcode project and calling a Go function from an iOS app. (I'm
still investigating proper buildmode tests for all.bash.)

Change-Id: I7890df15246df8e90ad27837b8d64ba2cde409fe
Reviewed-on: https://go-review.googlesource.com/8719
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/addr2line: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:43:27 +0000 (19:43 -0400)]
cmd/addr2line: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Ia84662f58f6b1bb168cce8a9837945b1cbd175e1
Reviewed-on: https://go-review.googlesource.com/8828
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/obj/x86: skip test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:40:16 +0000 (19:40 -0400)]
cmd/internal/obj/x86: skip test on darwin/arm64

Just like darwin/arm, cannot fork..

Change-Id: If565afbceb79013b9e3103e1e28d93691e9fc0a5
Reviewed-on: https://go-review.googlesource.com/8826
Reviewed-by: Minux Ma <minux@golang.org>
10 years agosyscall: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 22:54:30 +0000 (18:54 -0400)]
syscall: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Iadc30b7307ae56fd4f8a681d49672bed7ca6966f
Reviewed-on: https://go-review.googlesource.com/8810
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/nm: skip fork test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 23:38:45 +0000 (19:38 -0400)]
cmd/nm: skip fork test on darwin/arm64

Just like darwin/arm.

Change-Id: Iabb6282f18548da43117ee60f7ad6e272502f09d
Reviewed-on: https://go-review.googlesource.com/8825
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoos: adjust working dir for darwin/arm64 tests
David Crawshaw [Sat, 11 Apr 2015 23:17:47 +0000 (19:17 -0400)]
os: adjust working dir for darwin/arm64 tests

Just like darwin/arm.

Change-Id: Ib64a3e8ff11249a20b0208bd3b900db318c682b7
Reviewed-on: https://go-review.googlesource.com/8817
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agosync/atomic: skip issue 7338 test on darwin/arm64
David Crawshaw [Sat, 11 Apr 2015 22:57:18 +0000 (18:57 -0400)]
sync/atomic: skip issue 7338 test on darwin/arm64

Similar to darwin/arm. This issue is quite worrying and I hope it
can be addressed for Go 1.5.

Change-Id: Ic095281d6a2e9a38a59973f58d464471db5a2edc
Reviewed-on: https://go-review.googlesource.com/8811
Reviewed-by: Minux Ma <minux@golang.org>
10 years agomisc/ios: pick clang arch based on GOARCH
David Crawshaw [Sat, 11 Apr 2015 23:44:18 +0000 (19:44 -0400)]
misc/ios: pick clang arch based on GOARCH

Change-Id: Ia49ab729747acb07bf392d90aea9e752471e152e
Reviewed-on: https://go-review.googlesource.com/8789
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/6l: support -linkshared
Michael Hudson-Doyle [Wed, 1 Apr 2015 01:57:34 +0000 (14:57 +1300)]
cmd/6l: support -linkshared

Change-Id: Id469165b1acd383837b1f4e1e6f961e10dfa5d61
Reviewed-on: https://go-review.googlesource.com/8332
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

10 years agocmd/5g, cmd/internal/ld, cmd/internal/obj: destutter composite literals
Matthew Dempsky [Fri, 10 Apr 2015 22:25:10 +0000 (15:25 -0700)]
cmd/5g, cmd/internal/ld, cmd/internal/obj: destutter composite literals

While here, this changes DWAbbrev's attr field from a [30]DWAttrForm
with zero-termination to a simple []DWAttrForm, and updates its users
accordingly.

Passes "go build -toolexec 'toolstash -cmp' -a std" on linux/amd64.

Change-Id: I52b5f7a749bdb3e7588fc8ebdb8fee2cf8cab602
Reviewed-on: https://go-review.googlesource.com/8762
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/go: fix error message
Dmitry Vyukov [Sat, 11 Apr 2015 18:25:35 +0000 (21:25 +0300)]
cmd/go: fix error message

Change-Id: I440435927fc9f417d81ed4e8656a73787bf0968a
Reviewed-on: https://go-review.googlesource.com/8801
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: make a few more symbols local
Michael Hudson-Doyle [Sat, 11 Apr 2015 02:04:17 +0000 (14:04 +1200)]
cmd/internal/ld: make a few more symbols local

The symbols for the actual data in a constant string or bytes literal should
be local.

Change-Id: Idafcfba9a638eaa4e460e5103d96843960559b35
Reviewed-on: https://go-review.googlesource.com/8772
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

10 years agoreflect, runtime: check equality, not identity, for method names
Michael Hudson-Doyle [Mon, 30 Mar 2015 02:03:03 +0000 (02:03 +0000)]
reflect, runtime: check equality, not identity, for method names

When dynamically linking Go code, it is no longer safe to assume that
strings that end up in method names are identical if they are equal.

The performance impact seems to be noise:

benchmark                    old ns/op     new ns/op     delta
BenchmarkAssertI2E2          13.3          13.1          -1.50%
BenchmarkAssertE2I           23.5          23.2          -1.28%
BenchmarkAssertE2E2Blank     0.83          0.82          -1.20%
BenchmarkConvT2ISmall        60.7          60.1          -0.99%
BenchmarkAssertI2T           10.2          10.1          -0.98%
BenchmarkAssertE2T           10.2          10.3          +0.98%
BenchmarkConvT2ESmall        56.7          57.2          +0.88%
BenchmarkConvT2ILarge        59.4          58.9          -0.84%
BenchmarkConvI2E             13.0          12.9          -0.77%
BenchmarkAssertI2E           13.4          13.3          -0.75%
BenchmarkConvT2IUintptr      57.9          58.3          +0.69%
BenchmarkConvT2ELarge        55.9          55.6          -0.54%
BenchmarkAssertI2I           23.8          23.7          -0.42%
BenchmarkConvT2EUintptr      55.4          55.5          +0.18%
BenchmarkAssertE2E           6.12          6.11          -0.16%
BenchmarkAssertE2E2          14.4          14.4          +0.00%
BenchmarkAssertE2T2          10.0          10.0          +0.00%
BenchmarkAssertE2T2Blank     0.83          0.83          +0.00%
BenchmarkAssertE2TLarge      10.7          10.7          +0.00%
BenchmarkAssertI2E2Blank     0.83          0.83          +0.00%
BenchmarkConvI2I             23.4          23.4          +0.00%

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

10 years agocmd/go: start support for -linkshared
Michael Hudson-Doyle [Wed, 1 Apr 2015 02:53:52 +0000 (15:53 +1300)]
cmd/go: start support for -linkshared

This will fruitlessly rebuild stale packages that are in a shared
library.

Change-Id: I66a6e1adf7818558e7d1351ab215a5021b4a8a6b
Reviewed-on: https://go-review.googlesource.com/8333
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoapi: update next.txt
Shenghou Ma [Sat, 11 Apr 2015 00:03:28 +0000 (20:03 -0400)]
api: update next.txt

Change-Id: Ibfb5a96995a954c8c1dc563c33bdddbdb4866425
Reviewed-on: https://go-review.googlesource.com/8765
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agogo/types: move go/types/internal/gcimport => go/internal/gcimporter
Robert Griesemer [Fri, 10 Apr 2015 23:45:10 +0000 (16:45 -0700)]
go/types: move go/types/internal/gcimport => go/internal/gcimporter

This will make it possible to access the gcimporter (and gccgoimporter,
eventually) from the forthcoming gc/importer package, without exposing
compiler names in package names.

This change was created by manually adjusting the gcimporter paths in
go/types.bash and then running sh go/types.bash (i.e., by revendoring
gcimporter). The only manual changes are in go/types.bash.

Change-Id: Idc282439742288c09caa58b3a66d77aec0325faf
Reviewed-on: https://go-review.googlesource.com/8764
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>

10 years agodoc/go1.5.txt: log: LUTC flag
Rob Pike [Sat, 11 Apr 2015 02:32:10 +0000 (19:32 -0700)]
doc/go1.5.txt: log: LUTC flag

Change-Id: Ieadbd2b1ad442ba3eb2ad5f552d96c93ba3e5a2e
Reviewed-on: https://go-review.googlesource.com/8790
Reviewed-by: Rob Pike <r@golang.org>
10 years agolog: add flag LUTC, to use UTC time zone for time stamp
Rob Pike [Fri, 10 Apr 2015 20:33:03 +0000 (13:33 -0700)]
log: add flag LUTC, to use UTC time zone for time stamp

Issue 9483 suggests several approaches to correlating logs from
machines in different time zones. This approach is the simplest and
really should be sufficient: provide a way to clamp the time stamps
to UTC.

Fixes #9483.

Change-Id: If540b991d758c4d845a719779f8255ece7c452e7
Reviewed-on: https://go-review.googlesource.com/8761
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6g: call duffcopy, duffzero via got when dynamically linking go
Michael Hudson-Doyle [Mon, 30 Mar 2015 01:54:49 +0000 (01:54 +0000)]
cmd/6g: call duffcopy, duffzero via got when dynamically linking go

Jumping to an offset past a symbol isn't something that is really
supported by dynamic linkers, so do it by hand.

Change-Id: Ifff8834c6cdfa3d521ebd8479d2e93906df9b258
Reviewed-on: https://go-review.googlesource.com/8238
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

10 years agodebug/gosym: skip tests when .gosymtab section not found
Michael Hudson-Doyle [Wed, 18 Feb 2015 01:58:13 +0000 (14:58 +1300)]
debug/gosym: skip tests when .gosymtab section not found

Skip the test when there is no .gosymtab section in the executable
rather than crashing.

Change-Id: Ieb3df07e307f50c33cdafab38f9b5d1ac0e55c04
Reviewed-on: https://go-review.googlesource.com/5110
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>

10 years agodoc/go1.5.txt: note new options for go, gc, asm, ld
Ian Lance Taylor [Fri, 10 Apr 2015 23:47:14 +0000 (16:47 -0700)]
doc/go1.5.txt: note new options for go, gc, asm, ld

Change-Id: I353ff7eb35b066a1a2693c087c9876adac8e3fd0
Reviewed-on: https://go-review.googlesource.com/8763
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agotest: add gccgo test case for #10407
Shenghou Ma [Fri, 10 Apr 2015 07:28:40 +0000 (03:28 -0400)]
test: add gccgo test case for #10407

Change-Id: I8d17e2b0fbc529ca7958c75222964a5e419aa3db
Reviewed-on: https://go-review.googlesource.com/8717
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: Fix GDB integration with Python 2
Derek Buitenhuis [Fri, 10 Apr 2015 19:13:04 +0000 (15:13 -0400)]
runtime: Fix GDB integration with Python 2

A similar fix was applied in 545686857bc4c2e7a5306d97e5ef48f631d277bc
but another instance of 'pc' was missed.

Also adds a test for the goroutine gdb command.

It currently uses goroutine 2 for the test, since goroutine 1 has
its stack pointer set to 0 for some reason.

Change-Id: I53ca22be6952f03a862edbdebd9b5c292e0853ae
Reviewed-on: https://go-review.googlesource.com/8729
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodoc/go1.5.txt: time.AppendFormat
Rob Pike [Fri, 10 Apr 2015 20:19:20 +0000 (13:19 -0700)]
doc/go1.5.txt: time.AppendFormat

Change-Id: I9e8a0dc152ef9403ff5ece0c161bda3a2f4448a8
Reviewed-on: https://go-review.googlesource.com/8760
Reviewed-by: Rob Pike <r@golang.org>
10 years agotime: add Time.AppendFormat
Caleb Spare [Thu, 18 Dec 2014 04:18:06 +0000 (17:18 +1300)]
time: add Time.AppendFormat

This is a version of Time.Format that doesn't require allocation.

This is an updated version of 0af302f50745b93e90a4507993a555d246acef45
submitted by @bradfitz which was later rolled back.

Fixes #5192
Updates #5195

Change-Id: I4e6255bee1cf3914a6cc8d9d2a881cfeb273c08e
Reviewed-on: https://go-review.googlesource.com/1760
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/gc: fix handling of OGETG in race mode
Dmitry Vyukov [Thu, 9 Apr 2015 07:08:29 +0000 (10:08 +0300)]
cmd/gc: fix handling of OGETG in race mode

Now that getg is an intrinsic, more runtime functions
gets inlined (in particular, LockOSThread).
Runtime code gets race instrumented after inlining into
other packages. This can lead to false positives,
as race detector ignores all internal synchronization in runtime.
Inling of LockOSThread lead to false race reports on m contents.
See the issue for an example.

Fixes #10380

Change-Id: Ic9b760b53c28c2350bc54a5d4677fcd1c1f86e5f
Reviewed-on: https://go-review.googlesource.com/8690
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoruntime: start concurrent GC promptly when we reach its trigger
Austin Clements [Fri, 3 Apr 2015 19:27:44 +0000 (15:27 -0400)]
runtime: start concurrent GC promptly when we reach its trigger

Currently, when allocation reaches the concurrent GC trigger size, we
start the concurrent collector by ready'ing its G. This simply puts it
on the end of the P's run queue, which means we may not actually start
GC for some time as the current G continues to run and then the P
drains other Gs already on its run queue. Since the mutator can
continue to allocate, the heap can potentially be much larger than we
intended by the time GC actually starts. Furthermore, how much larger
is difficult to predict since it depends on the scheduler.

Fix this by preempting the current G and switching directly to the
concurrent GC G as soon as we reach the trigger heap size.

On the garbage benchmark from the benchmarks subrepo with
GOMAXPROCS=4, this reduces the time from triggering the GC to the
beginning of sweep termination by 10 to 30 milliseconds, which reduces
allocation after the trigger by up to 10MB (a large fraction of the
64MB live heap the benchmark tries to maintain).

One other known source of delay before we "really" start GC is the
sweep finalization performed before sweep termination. This has
similar negative effects on heap size and predictability, but is an
orthogonal problem. This change adds a TODO for this.

Change-Id: I8bae98cb43685c1bf353ff55868e4647e3743c47
Reviewed-on: https://go-review.googlesource.com/8513
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove GoSched/GoStart trace events around GC
Austin Clements [Thu, 9 Apr 2015 14:17:06 +0000 (10:17 -0400)]
runtime: remove GoSched/GoStart trace events around GC

These were appropriate for STW GC, since it interrupted the allocating
Goroutine, but don't apply to concurrent GC, which runs on its own
Goroutine. Forced GC is still STW, but it makes sense to attribute the
GC to the goroutine that called runtime.GC().

Change-Id: If12418ca66dc7e53b8b16025af4e03adb5d9577e
Reviewed-on: https://go-review.googlesource.com/8715
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agointernal/trace: don't assume GC will start and end on same P
Austin Clements [Thu, 9 Apr 2015 14:03:26 +0000 (10:03 -0400)]
internal/trace: don't assume GC will start and end on same P

Currently, GC disables preemption between the traceGCStart and
traceGCDone, so it never moves Ps. Consequently, the trace verifier
attaches information about GC to its per-P state and will fail if GC
starts on one P and ends on another.

GC will soon be preemptible and may end on a different P than it
began. Hence, this change lifts this per-P verifier state to global
state.

Change-Id: I82256e2baab1ff3c4453fec312079018423b4b51
Reviewed-on: https://go-review.googlesource.com/8714
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: make test for freezetheworld more precise
Austin Clements [Fri, 27 Mar 2015 20:11:11 +0000 (16:11 -0400)]
runtime: make test for freezetheworld more precise

exitsyscallfast checks for freezetheworld, but does so only by
checking if stopwait is positive. This can also happen during
stoptheworld, which is harmless, but confusing. Shortly, it will be
important that we get to the p.status cas even if stopwait is set.

Hence, make this test more specific so it only triggers with
freezetheworld and not other uses of stopwait.

Change-Id: Ibb722cd8360c3ed5a9654482519e3ceb87a8274d
Reviewed-on: https://go-review.googlesource.com/8205
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agodebug/dwarf: document DWARF class -> Go type mapping
Austin Clements [Fri, 6 Mar 2015 20:04:17 +0000 (15:04 -0500)]
debug/dwarf: document DWARF class -> Go type mapping

Currently, the only way to know the Go type of an attribute of some
DWARF attribute class was to read the dwarf package code (or
experiment).  This makes it hard to go from the DWARF specification to
writing code that uses the dwarf package.

Fix this by adding a table to the documentation comment of the Field
type that gives the correspondence between DWARF attribute classes and
Go types.

Change-Id: I57c678a551fa1eb46f8207085d5a53d44985e3e7
Reviewed-on: https://go-review.googlesource.com/7280
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agostrconv: use 64bit uint for decimal conversion if available
Robert Griesemer [Tue, 3 Feb 2015 01:22:18 +0000 (17:22 -0800)]
strconv: use 64bit uint for decimal conversion if available

The existing code used ints for the (slow) decimal conversion and
assumed that they were 32bit wide.

This change uses uints and the appropriate width (32 or 64bit)
depending on platform.

The performance difference is in the noise for the usual (optimized)
case which does not use the slow path conversion:

benchmark                               old ns/op     new ns/op     delta
BenchmarkFormatFloatDecimal             298           299           +0.34%
BenchmarkFormatFloat                    388           392           +1.03%
BenchmarkFormatFloatExp                 365           364           -0.27%
BenchmarkFormatFloatNegExp              364           362           -0.55%
BenchmarkFormatFloatBig                 482           476           -1.24%
BenchmarkAppendFloatDecimal             100           102           +2.00%
BenchmarkAppendFloat                    199           201           +1.01%
BenchmarkAppendFloatExp                 174           175           +0.57%
BenchmarkAppendFloatNegExp              169           174           +2.96%
BenchmarkAppendFloatBig                 286           286           +0.00%
BenchmarkAppendFloat32Integer           99.9          102           +2.10%
BenchmarkAppendFloat32ExactFraction     161           164           +1.86%
BenchmarkAppendFloat32Point             199           201           +1.01%
BenchmarkAppendFloat32Exp               167           168           +0.60%
BenchmarkAppendFloat32NegExp            163           169           +3.68%
BenchmarkAppendFloat64Fixed1            137           134           -2.19%
BenchmarkAppendFloat64Fixed2            144           146           +1.39%
BenchmarkAppendFloat64Fixed3            138           140           +1.45%
BenchmarkAppendFloat64Fixed4            144           145           +0.69%

The performance difference is significant if the fast path conversion is
explicitly turned off (ftoa.go:101):

benchmark                               old ns/op     new ns/op     delta
BenchmarkFormatFloatDecimal             459           427           -6.97%
BenchmarkFormatFloat                    1560          1180          -24.36%
BenchmarkFormatFloatExp                 5501          3128          -43.14%
BenchmarkFormatFloatNegExp              24085         14360         -40.38%
BenchmarkFormatFloatBig                 1409          1081          -23.28%
BenchmarkAppendFloatDecimal             248           226           -8.87%
BenchmarkAppendFloat                    1315          982           -25.32%
BenchmarkAppendFloatExp                 5274          2869          -45.60%
BenchmarkAppendFloatNegExp              23905         14054         -41.21%
BenchmarkAppendFloatBig                 1194          860           -27.97%
BenchmarkAppendFloat32Integer           167           175           +4.79%
BenchmarkAppendFloat32ExactFraction     182           184           +1.10%
BenchmarkAppendFloat32Point             556           564           +1.44%
BenchmarkAppendFloat32Exp               1134          918           -19.05%
BenchmarkAppendFloat32NegExp            2679          1801          -32.77%
BenchmarkAppendFloat64Fixed1            274           238           -13.14%
BenchmarkAppendFloat64Fixed2            494           368           -25.51%
BenchmarkAppendFloat64Fixed3            1833          1008          -45.01%
BenchmarkAppendFloat64Fixed4            6133          3596          -41.37%

Change-Id: I829b8abcca882b1c10d8ae421d3249597c31f3c9
Reviewed-on: https://go-review.googlesource.com/3811
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: fix tracing of syscall exit
Dmitry Vyukov [Fri, 10 Apr 2015 15:32:40 +0000 (18:32 +0300)]
runtime: fix tracing of syscall exit

Fix tracing of syscall exit after:
https://go-review.googlesource.com/#/c/7504/

Change-Id: Idcde2aa826d2b9a05d0a90a80242b6bfa78846ab
Reviewed-on: https://go-review.googlesource.com/8728
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agosyscall: correct code for cover cmd
Dmitry Vyukov [Fri, 10 Apr 2015 09:34:31 +0000 (12:34 +0300)]
syscall: correct code for cover cmd

Fixes #10378

This is clumsy, but currently cover tool fails as:

$ go test -run=none -cover syscall
syscall_linux_amd64.go:15: can only use //go:noescape with external func implementations
FAIL syscall [build failed]

This happens because cover tool mishandles //go: comments.
r and gri said that fixing cover is infeasible due to go/ast limitations.

So at least fix the offending code so that coverage works.
This come up in context of coverage-guided fuzzing which works best
with program-wide coverage.

Change-Id: I142e5774c9f326ed38cb202693bd4edae93879ba
Reviewed-on: https://go-review.googlesource.com/8723
Reviewed-by: Rob Pike <r@golang.org>
10 years agotest: add -update_errors flag to run script
Dmitry Vyukov [Thu, 19 Feb 2015 19:00:11 +0000 (22:00 +0300)]
test: add -update_errors flag to run script

The flag updates error annotations in test files from actual compiler output.
This is useful when doing compiler changes that add/remove/change lots of errors,
or when adding lots of new tests.
Also I noticed at least 2 cases where annotation were sub-optimal:
1. The annotation was "leaking param p" when the actual error is
"leaking param p to result ~r1".
2. The annotation was "leaking param m" when the actual errors
are "leaking param m" and "leaking param mv1".

For now it works only for errorcheck mode.

Also, apply the update to escape and liveness tests.
Some files have gccgo-specific errors of the form "gc error|gccgo error",
so it is risky to run update on all files. Gccgo-specific error
does not necessary contain '|', it can be just truncated.

Change-Id: Iaaae767f859dcb8321a8cb4970b2b70969e8a345
Reviewed-on: https://go-review.googlesource.com/5310
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet: make multi-IP resolution more flexible.
Paul Marks [Wed, 1 Apr 2015 22:17:09 +0000 (15:17 -0700)]
net: make multi-IP resolution more flexible.

Remove the "netaddr" type, which ambiguously represented either one
address, or a list of addresses. Instead, use "addrList" wherever
multiple addresses are supported.

The "first" method returns the first address matching some condition
(e.g. "is it IPv4?"), primarily to support legacy code that can't handle
multiple addresses.

The "partition" method splits an addrList into two categories, as
defined by some strategy function. This is useful for implementing
Happy Eyeballs, and similar two-channel algorithms.

Finally, internetAddrList (formerly resolveInternetAddr) no longer
mangles the ordering defined by getaddrinfo. In the future, this may
be used by a sequential Dial implementation.

Updates #8453, #8455.

Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3
Reviewed-on: https://go-review.googlesource.com/8360
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/gc: clean up Componentgen
Dave Cheney [Thu, 9 Apr 2015 10:10:16 +0000 (20:10 +1000)]
cmd/internal/gc: clean up Componentgen

Update #9855

In preparation for introducing direct use of a zero register on
platforms that support it, take the opportunity to clean up
Componentgen a bit.

Change-Id: I120ce1ffcca8c4f7603bfe76bfa1aedd27ebb4d2
Reviewed-on: https://go-review.googlesource.com/8691
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime, cmd/internal/ld: rename themoduledata to firstmoduledata
Michael Hudson-Doyle [Tue, 7 Apr 2015 00:55:02 +0000 (12:55 +1200)]
runtime, cmd/internal/ld: rename themoduledata to firstmoduledata

'themoduledata' doesn't really make sense now we support multiple moduledata
objects.

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

10 years agocmd/internal/obj/x86: look for go cmd in GOBIN if present.
Daniel Theophanes [Fri, 10 Apr 2015 04:11:16 +0000 (21:11 -0700)]
cmd/internal/obj/x86: look for go cmd in GOBIN if present.

If GOBIN is not empty the build moves the go executable
to a new path. When this test runs it fails to find the
go cmd in the GOROOT.

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

10 years agoruntime, reflect: support multiple moduledata objects
Michael Hudson-Doyle [Sun, 29 Mar 2015 21:59:00 +0000 (21:59 +0000)]
runtime, reflect: support multiple moduledata objects

This changes all the places that consult themoduledata to consult a
linked list of moduledata objects, as will be necessary for
-linkshared to work.

Obviously, as there is as yet no way of adding moduledata objects to
this list, all this change achieves right now is wasting a few
instructions here and there.

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

10 years agocmd/go: support -buildmode=default,archive,exe,c-shared
Michael Hudson-Doyle [Wed, 8 Apr 2015 22:24:22 +0000 (10:24 +1200)]
cmd/go: support -buildmode=default,archive,exe,c-shared

Modelled somewhat on the -race support.

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

10 years agocmd/internal/obj/x86, cmd/internal/ld, cmd/6l: 6g/asm -dynlink accesses global data...
Michael Hudson-Doyle [Mon, 30 Mar 2015 00:49:25 +0000 (00:49 +0000)]
cmd/internal/obj/x86, cmd/internal/ld, cmd/6l: 6g/asm -dynlink accesses global data via a GOT

Change-Id: I49862e177045369d6c94d6a58afbdace4f13cc96
Reviewed-on: https://go-review.googlesource.com/8237
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: fix arm64 build
Josh Bleecher Snyder [Fri, 10 Apr 2015 01:18:24 +0000 (18:18 -0700)]
runtime: fix arm64 build

Broken by CL 8541.

Change-Id: Ie2e89a22b91748e82f7bc4723660a24ed4135687
Reviewed-on: https://go-review.googlesource.com/8734
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: report next_gc for initial heap size in gctrace
Austin Clements [Sat, 4 Apr 2015 16:27:46 +0000 (12:27 -0400)]
runtime: report next_gc for initial heap size in gctrace

Currently, the initial heap size reported in the gctrace line is the
heap_live right before sweep termination. However, we triggered GC
when heap_live reached next_gc, and there may have been significant
allocation between that point and the beginning of sweep
termination. Ideally these would be essentially the same, but
currently there's scheduler delay when readying the GC goroutine as
well as delay from background sweep finalization.

We should fix this delay, but in the mean time, to give the user a
better idea of how much the heap grew during the whole of garbage
collection, report the trigger rather than what the heap size happened
to be after the garbage collector finished rolling out of bed. This
will also be more useful for heap growth plots.

Change-Id: I08476b9fbcfb2de90592405e9c9f434dfb9eb1f8
Reviewed-on: https://go-review.googlesource.com/8512
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agomath/big: better doc strings for ErrNaN functionality
Robert Griesemer [Thu, 9 Apr 2015 20:11:53 +0000 (13:11 -0700)]
math/big: better doc strings for ErrNaN functionality

Change-Id: Ia0944e7b47193465d3ec37fc8dc46dea9b5dcc6b
Reviewed-on: https://go-review.googlesource.com/8710
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: add isarchive, set by the linker
David Crawshaw [Thu, 9 Apr 2015 19:09:52 +0000 (15:09 -0400)]
runtime: add isarchive, set by the linker

According to Go execution modes, a Go program compiled with
-buildmode=c-archive has a main function, but it is ignored on run.
This gives the runtime the information it needs not to run the main.

I have this working with pending linker changes on darwin/amd64.

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

10 years agolog: logging an empty string should still print a line
Rob Pike [Wed, 8 Apr 2015 21:55:45 +0000 (14:55 -0700)]
log: logging an empty string should still print a line

Print("") was printing a header but no line.

Fixes #9665.

Change-Id: Iac783187786065e1389ad6e8d7ef02c579ed7bd8
Reviewed-on: https://go-review.googlesource.com/8665
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoencoding/gob: more checks for corrupted data
Rob Pike [Wed, 8 Apr 2015 20:17:57 +0000 (13:17 -0700)]
encoding/gob: more checks for corrupted data

Also unify the tests where possible to make it easy to add more.

Fixes #10273.

Change-Id: Idfa4f4a5dcaa05974066bafe17bed6cdd2ebedb7
Reviewed-on: https://go-review.googlesource.com/8662
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: add arm64 runtime.cmpstring and bytes.Compare
Dave Cheney [Tue, 7 Apr 2015 11:38:02 +0000 (21:38 +1000)]
runtime: add arm64 runtime.cmpstring and bytes.Compare

Add arm64 assembly implementation of runtime.cmpstring and bytes.Compare.

benchmark                                old ns/op     new ns/op     delta
BenchmarkCompareBytesEqual               98.0          27.5          -71.94%
BenchmarkCompareBytesToNil               9.38          10.0          +6.61%
BenchmarkCompareBytesEmpty               13.3          10.0          -24.81%
BenchmarkCompareBytesIdentical           98.0          27.5          -71.94%
BenchmarkCompareBytesSameLength          43.3          16.3          -62.36%
BenchmarkCompareBytesDifferentLength     43.4          16.3          -62.44%
BenchmarkCompareBytesBigUnaligned        6979680       1360979       -80.50%
BenchmarkCompareBytesBig                 6915995       1381979       -80.02%
BenchmarkCompareBytesBigIdentical        6781440       1327304       -80.43%

benchmark                             old MB/s     new MB/s     speedup
BenchmarkCompareBytesBigUnaligned     150.23       770.46       5.13x
BenchmarkCompareBytesBig              151.62       758.76       5.00x
BenchmarkCompareBytesBigIdentical     154.63       790.01       5.11x

* note, the machine we are benchmarking on has some issues. What is clear is
compared to a few days ago the old MB/s value has increased from ~115 to 150.
I'm less certain about the new MB/s number, which used to be close to 1Gb/s.

Change-Id: I4f31b2c7a06296e13912aacc958525632cb0450d
Reviewed-on: https://go-review.googlesource.com/8541
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agosyscall: reduce the set of architecture-dependent files on Plan 9
Anthony Martin [Tue, 30 Dec 2014 14:14:55 +0000 (06:14 -0800)]
syscall: reduce the set of architecture-dependent files on Plan 9

Change-Id: I98b172181c2fd85aa385341e28bc661dbc274252
Reviewed-on: https://go-review.googlesource.com/2167
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet/http: handle close/response race more gracefully
Daniel Morsing [Thu, 18 Dec 2014 14:05:48 +0000 (15:05 +0100)]
net/http: handle close/response race more gracefully

There was a logical race in Transport.RoundTrip where a roundtrip with
a pending response would race with the channel for the connection
closing. This usually happened for responses with connection: close
and no body.

We handled this race by reading the close channel, setting a timer
for 100ms and if no response was returned before then, we would then
return an error.

This put a lower bound on how fast a connection could fail. We couldn't
fail a request faster than 100ms.

Reordering the channel operations gets rid of the logical race. If
the readLoop causes the connection to be closed, it would have put
its response into the return channel already and we can fetch it with
a non-blocking receive.

Change-Id: Idf09e48d7a0453d7de0120d3055d0ce5893a5428
Reviewed-on: https://go-review.googlesource.com/1787
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/go: detect which VCS to use with Bitbucket when the API call fails.
Billie H. Cleek [Sun, 21 Dec 2014 01:05:05 +0000 (17:05 -0800)]
cmd/go: detect which VCS to use with Bitbucket when the API call fails.

      The API call will fail when Bitbucket repositories are private. In
that case, probe for the repository using vcsCmd.ping.

      Fixes #5375

Change-Id: Ia604ecf9014805579dfda4b5c8e627a52783d56e
Reviewed-on: https://go-review.googlesource.com/1910
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/gc: fix escape analysis of closures
Dmitry Vyukov [Mon, 6 Apr 2015 15:17:20 +0000 (18:17 +0300)]
cmd/gc: fix escape analysis of closures

Fixes #10353

See test/escape2.go:issue10353. Previously new(int) did not escape to heap,
and so heap-allcated closure was referencing a stack var. This breaks
the invariant that heap must not contain pointers to stack.

Look at the following program:

package main

func main() {
foo(new(int))
bar(new(int))
}

func foo(x *int) func() {
return func() {
println(*x)
}
}

// Models what foo effectively does.
func bar(x *int) *C {
return &C{x}
}

type C struct {
x *int
}

Without this patch escape analysis works as follows:

$ go build -gcflags="-m -m -m -l" esc.go
escflood:1: dst ~r1 scope:foo[0]
escwalk: level:0 depth:0  func literal( l(9) f(1) esc(no) ld(1)) scope:foo[1]
/tmp/live2.go:9: func literal escapes to heap
escwalk: level:0 depth:1   x( l(8) class(PPARAM) f(1) esc(no) ld(1)) scope:foo[1]
/tmp/live2.go:8: leaking param: x to result ~r1

escflood:2: dst ~r1 scope:bar[0]
escwalk: level:0 depth:0  &C literal( l(15) esc(no) ld(1)) scope:bar[1]
/tmp/live2.go:15: &C literal escapes to heap
escwalk: level:-1 depth:1   &C literal( l(15)) scope:bar[0]
escwalk: level:-1 depth:2   x( l(14) class(PPARAM) f(1) esc(no) ld(1)) scope:bar[1]
/tmp/live2.go:14: leaking param: x

/tmp/live2.go:5: new(int) escapes to heap
/tmp/live2.go:4: main new(int) does not escape

new(int) does not escape while being captured by the closure.
With this patch escape analysis of foo and bar works similarly:

$ go build -gcflags="-m -m -m -l" esc.go
escflood:1: dst ~r1 scope:foo[0]
escwalk: level:0 depth:0  &(func literal)( l(9)) scope:foo[0]
escwalk: level:-1 depth:1   func literal( l(9) f(1) esc(no) ld(1)) scope:foo[1]
/tmp/live2.go:9: func literal escapes to heap
escwalk: level:-1 depth:2   x( l(8) class(PPARAM) f(1) esc(no) ld(1)) scope:foo[1]
/tmp/live2.go:8: leaking param: x

escflood:2: dst ~r1 scope:bar[0]
escwalk: level:0 depth:0  &C literal( l(15) esc(no) ld(1)) scope:bar[1]
/tmp/live2.go:15: &C literal escapes to heap
escwalk: level:-1 depth:1   &C literal( l(15)) scope:bar[0]
escwalk: level:-1 depth:2   x( l(14) class(PPARAM) f(1) esc(no) ld(1)) scope:bar[1]
/tmp/live2.go:14: leaking param: x

/tmp/live2.go:4: new(int) escapes to heap
/tmp/live2.go:5: new(int) escapes to heap

Change-Id: Ifd14b7ae3fc11820e3b5eb31eb07f35a22ed0932
Reviewed-on: https://go-review.googlesource.com/8408
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoruntime: make windows exception handler code arch independent
Alex Brainman [Thu, 9 Apr 2015 05:13:48 +0000 (15:13 +1000)]
runtime: make windows exception handler code arch independent

Mainly it is simple copy. But I had to change amd64
lastcontinuehandler return value from uint32 to int32.
I don't remember how it happened to be uint32, but new
int32 is matching better with Windows documentation (LONG).
I don't think it matters one way or the others.

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

10 years agoregexp: skip backtracker for long programs
Matthew Brennan [Sat, 4 Apr 2015 00:09:53 +0000 (20:09 -0400)]
regexp: skip backtracker for long programs

This update makes maxBacktrackLen return 0 if
len(prog.Inst) > maxBacktrackProg. This prevents an attempt to
backtrack against a nil bitstate.

Fixes #10319

Change-Id: Icdbeb2392782ccf66f9d0a70ea57af22fb93f01b
Reviewed-on: https://go-review.googlesource.com/8473
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet/http: don't send IPv6 zone identifier in outbound request, per RFC 6874
Mikio Hara [Wed, 21 Jan 2015 10:27:34 +0000 (19:27 +0900)]
net/http: don't send IPv6 zone identifier in outbound request, per RFC 6874

When making a request to an IPv6 address with a zone identifier, for
exmaple [fe80::1%en0], RFC 6874 says HTTP clients must remove the zone
identifier "%en0" before writing the request for security reason.

This change removes any IPv6 zone identifer attached to URI in the Host
header field in requests.

Fixes #9544.

Change-Id: I7406bd0aa961d260d96f1f887c2e45854e921452
Reviewed-on: https://go-review.googlesource.com/3111
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoos: windows Rename should overwrite destination file.
Daniel Theophanes [Thu, 26 Feb 2015 20:10:11 +0000 (12:10 -0800)]
os: windows Rename should overwrite destination file.

Rename now uses MoveFileEx which was previously not available to
use because it is not supported on Windows 2000.

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

10 years agocmd/internal/obj/arm64, cmd/asm/internal/asm: support CSEL instruction on arm64
Dave Cheney [Wed, 8 Apr 2015 15:49:28 +0000 (01:49 +1000)]
cmd/internal/obj/arm64, cmd/asm/internal/asm: support CSEL instruction on arm64

Add support for arm64 four operand conditional instructions.

Superceedes CL 8405.

Change-Id: I12da8f4822938feec400bbcc426eeaf884536135
Reviewed-on: https://go-review.googlesource.com/8638
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
10 years agoruntime: do not calculate asmstdcall address every time we make syscall
Alex Brainman [Thu, 9 Apr 2015 01:32:47 +0000 (11:32 +1000)]
runtime: do not calculate asmstdcall address every time we make syscall

Change-Id: If3c8c9035e12d41647ae4982883f6a979313ea9d
Reviewed-on: https://go-review.googlesource.com/8682
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoimage/jpeg: reject multiple Start-Of-Frame markers.
Nigel Tao [Thu, 9 Apr 2015 01:39:21 +0000 (11:39 +1000)]
image/jpeg: reject multiple Start-Of-Frame markers.

Fixes #10389

Change-Id: Id1c687122751f9317041d9e425d03b267a26c6de
Reviewed-on: https://go-review.googlesource.com/8681
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: fix darwin/386, darwin/arm builds
David Crawshaw [Wed, 8 Apr 2015 23:44:14 +0000 (19:44 -0400)]
runtime: fix darwin/386, darwin/arm builds

In cl/8652 I broke darwin/arm and darwin/386 because I removed the *g
parameter, which they both expect and use. This CL adjusts both ports
to look for g0 in m, just as darwin/amd64 does.

Tested on darwin{386,arm,amd64}.

Change-Id: Ia56f3d97e126b40d8bbd2e8f677b008e4a1badad
Reviewed-on: https://go-review.googlesource.com/8666
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: use (*context) ip, setip, sp and setsp everywhere on windows
Alex Brainman [Thu, 12 Feb 2015 01:14:02 +0000 (12:14 +1100)]
runtime: use (*context) ip, setip, sp and setsp everywhere on windows

Also move dumpregs into defs_windows_*.go.

Change-Id: Ic077d7dbb133c7b812856e758d696d6fed557afd
Reviewed-on: https://go-review.googlesource.com/4650
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>