1
0
mirror of https://github.com/golang/go synced 2024-09-24 17:10:13 -06:00
Commit Graph

22796 Commits

Author SHA1 Message Date
Dmitry Vyukov
878a86a129 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>
2015-04-09 09:56:27 +00:00
Alex Brainman
6e774faed7 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>
2015-04-09 09:55:38 +00:00
Matthew Brennan
a513088396 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>
2015-04-09 09:38:23 +00:00
Mikio Hara
957255f5ab 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>
2015-04-09 09:26:52 +00:00
Daniel Theophanes
92c57363e0 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>
2015-04-09 08:39:52 +00:00
Dave Cheney
ef49b4ca78 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>
2015-04-09 08:07:21 +00:00
Alex Brainman
414444d416 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>
2015-04-09 04:26:44 +00:00
Nigel Tao
eb44082915 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>
2015-04-09 02:32:23 +00:00
David Crawshaw
c844bf4cfc 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>
2015-04-09 01:36:21 +00:00
Alex Brainman
e0d9342da7 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>
2015-04-09 00:57:28 +00:00
Michael Hudson-Doyle
00bc19e996 cmd/internal/ld: support for -buildmode=shared
Change-Id: Id4997d611ced29397133f14def6abc88aa9e811e
Reviewed-on: https://go-review.googlesource.com/8252
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-09 00:51:02 +00:00
Michael Hudson-Doyle
6f6512bd60 cmd/internal/gc, etc: remove dead code
Found with https://github.com/opennota/check.

Change-Id: I50c173382782fb16b15100e02c1c85610bc233a0
Reviewed-on: https://go-review.googlesource.com/7130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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: Minux Ma <minux@golang.org>
2015-04-08 22:36:44 +00:00
David Crawshaw
b1d1564f1a cmd/internal/ld: clean up hostlink I/O
Change-Id: I6c3a62403941d357ffd9d0025289c2180139b0bd
Reviewed-on: https://go-review.googlesource.com/8664
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-08 21:58:48 +00:00
David Crawshaw
b0a85f5d93 runtime: darwin/amd64 library entry point
This is a practice run for darwin/arm.

Similar to the linux/amd64 shared library entry point. With several
pending linker changes I am successfully using this to implement
-buildmode=c-archive on darwin/amd64 with external linking.

The same entry point can be reused to implement -buildmode=c-shared
on darwin/amd64, however that will require further ld changes to
remove all text relocations.

One extra runtime change will follow this. According to the Go
execution modes document, -buildmode=c-archive should ignore the Go
main function. Right now it is being executed (and the process exits
if it doesn't block). I'm still searching for the right way to do
this.

Change-Id: Id97901ddd4d46970996f222bd79731dabff66a3d
Reviewed-on: https://go-review.googlesource.com/8652
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-08 21:53:52 +00:00
Michael Hudson-Doyle
2a5f88d850 cmd/internal/ld: add -buildmode=c-shared as an alternative to -shared
The linker currently (on some platforms) takes a -shared flag, which means
approximately what -buildmode=c-shared means in the in the proposed "Go
Execution Modes" document. As part of implementing other modes, the term
"shared" becomes horribly overloaded, so this replaces -shared with a
-buildmode argument instead (which currently only handles -buildmode=c-shared
and the default -buildmode=exe -- no new behaviour here).

As the linker support for -shared was in 1.4 this retains it as an alias.

Change-Id: Id2ebb8e05ee07f46208a554bc2622d0e67b47082
Reviewed-on: https://go-review.googlesource.com/8304
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-08 21:51:14 +00:00
David Crawshaw
47746f10fe cmd/internal/ld: emit macho .init_array section
Change-Id: Ie75a01e899e68f4f9643410f5e161152a81b8ba0
Reviewed-on: https://go-review.googlesource.com/8655
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-08 21:36:26 +00:00
Håvard Haugen
8e6cf5f70c encoding/gob: clean up decoderMap after errBadType
When decoding an invalid typeId the associated *decEngine was not
removed from decoderMap. If the decoder was run again on the same input
a nil *decEngine was found in the map and assumed to be initialized,
resulting in a panic.

Fixes #9649

Change-Id: I5bb51808362a21c09228c2705a658f073e5b59b3
Reviewed-on: https://go-review.googlesource.com/3509
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 21:28:24 +00:00
Robert Griesemer
b28802d2f1 math/big: make ErrNaN actually implement the error interface (oversight)
There was no way to get to the error message before.

Change-Id: I4aa9d3d9f468c33f9996295bafcbed097de0389f
Reviewed-on: https://go-review.googlesource.com/8660
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-08 19:47:39 +00:00
Rob Pike
514eb4aa54 net/rpc: document that the type must be exported, not just the methods
Fixes #10379.

Change-Id: Ia4cdda36ed57a06371f9ace7365ce9e215228487
Reviewed-on: https://go-review.googlesource.com/8654
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 18:34:35 +00:00
Rob Pike
3b1d0d0f07 cmd/asm: remove object file if assembly fails.
Just an oversight. Plus the code had an unnecessary call to os.Exit
that now has a purpose.

Fixes #10372.

Change-Id: I456018f3a01ca05b4501c7f8a4961d48ab8c5e16
Reviewed-on: https://go-review.googlesource.com/8651
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-08 18:29:17 +00:00
Shenghou Ma
3cfae34943 go/types/internal/gcimporter: update for 7g and 9g
Change-Id: Ied1582d8aabee2eb346e1c23bfd7781e4a091264
Reviewed-on: https://go-review.googlesource.com/8621
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-08 17:55:51 +00:00
Robert Griesemer
ad266b9605 go/types: more selective disabling of tests
Disable importer-dependent tests on platforms for which the
respective builders don't have access to importable packages.

Fixes #10368.

Change-Id: I8072c59d2bbbc24a43d771fd04fd0b1a678d765a
Reviewed-on: https://go-review.googlesource.com/8611
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-08 17:54:17 +00:00
Ian Lance Taylor
7ac67b5568 cmd/internal/ld: change elf64 from int to bool
Change-Id: Iaf2dba7d699a8d52f91ce10222ab0d1a0f1f21fc
Reviewed-on: https://go-review.googlesource.com/8625
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-08 16:54:18 +00:00
Michael Hudson-Doyle
3a84e3305b runtime, cmd/internal/ld: initialize themoduledata slices directly
This CL is quite conservative in some ways.  It continues to define
symbols that have no real purpose (e.g. epclntab).  These could be
deleted if there is no concern that external tools might look for them.

It would also now be possible to make some changes to the pcln data but
I get the impression that would definitely require some thought and
discussion.

Change-Id: Ib33cde07e4ec38ecc1d6c319a10138c9347933a3
Reviewed-on: https://go-review.googlesource.com/7616
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-08 16:20:57 +00:00
Marko Tiikkaja
c468f94672 database/sql: Retry with a fresh connection after maxBadConnRetries
Previously if the connection pool was larger than maxBadConnRetries
and there were a lot of bad connections in the pool (for example if
the database server was restarted), a query might have failed with an
ErrBadConn unnecessarily.  Instead of trying to guess how many times
to retry, try maxBadConnRetries times and then force a fresh
connection to be used for the last attempt.  At the same time, lower
maxBadConnRetries to a smaller value now that it's not that important
to retry so many times from the free connection list.

Fixes #8834

Change-Id: I6542f151a766a658980fb396fa4880ecf5874e3d
Reviewed-on: https://go-review.googlesource.com/2034
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 16:18:36 +00:00
Martin Möhrmann
d5ef698142 time: unify formatting of decimals for timestamps
Change function appendUint to appendInt with variable-width 0-padding.

This allows the decimal for the year to be generated without extra code
to handle the wider padding and directly handles negative numbers.

Removes the special casing for numbers with one and two digits.
The special case for 0 was unreachable.

The new version is slightly slower.

benchmark              old ns/op     new ns/op     delta
BenchmarkFormat        444           454           +2.25%
BenchmarkFormatNow     398           415           +4.27%

Change-Id: I4ddef96bf07ad35dca76053321d510441ec6d4f5
Reviewed-on: https://go-review.googlesource.com/2751
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-08 16:17:22 +00:00
Dave Cheney
5c22a4a2e1 cmd/7g: reactivate componentgen
Update #10203

When the portable componentgen was introduced in b960263 it
produced broken code on arm64 and was deactivated. In the month since
it looks like the underlying issues have been fixed so componentgen
produces working binaries that are slightly smaller, ~3kb reduction in
size for godoc binary.

Benchmarks are underwhelming, but where visible, trending towards
an improvement (this is with Minux's peep optimiser CL).

benchmark                          old ns/op       new ns/op       delta
BenchmarkBinaryTree17              15336842000     15002766000     -2.18%
BenchmarkFannkuch11                10848984000     10896931000     +0.44%
BenchmarkFmtFprintfEmpty           203             188             -7.39%
BenchmarkFmtFprintfString          753             720             -4.38%
BenchmarkFmtFprintfInt             667             670             +0.45%
BenchmarkFmtFprintfIntInt          1103            1102            -0.09%
BenchmarkFmtFprintfPrefixedInt     981             969             -1.22%
BenchmarkFmtFprintfFloat           1396            1348            -3.44%
BenchmarkFmtManyArgs               4151            4102            -1.18%
BenchmarkGobDecode                 34202360        32933020        -3.71%
BenchmarkGobEncode                 27579180        27438820        -0.51%
BenchmarkGzip                      1296119000      1285096000      -0.85%
BenchmarkGunzip                    291099800       289727200       -0.47%
BenchmarkHTTPClientServer          169476          169803          +0.19%
BenchmarkJSONEncode                70313600        69973400        -0.48%
BenchmarkJSONDecode                227811800       232875200       +2.22%
BenchmarkMandelbrot200             12985600        12996430        +0.08%
BenchmarkGoParse                   14708930        14507320        -1.37%
BenchmarkRegexpMatchEasy0_32       464             460             -0.86%
BenchmarkRegexpMatchEasy0_1K       4516            4517            +0.02%
BenchmarkRegexpMatchEasy1_32       452             454             +0.44%
BenchmarkRegexpMatchEasy1_1K       4664            4669            +0.11%
BenchmarkRegexpMatchMedium_32      602             602             +0.00%
BenchmarkRegexpMatchMedium_1K      172939          172494          -0.26%
BenchmarkRegexpMatchHard_32        9733            9577            -1.60%
BenchmarkRegexpMatchHard_1K        301356          298143          -1.07%
BenchmarkRevcomp                   2754334000      2753874000      -0.02%
BenchmarkTemplate                  315664000       311810800       -1.22%
BenchmarkTimeParse                 1034            989             -4.35%
BenchmarkTimeFormat                1118            1137            +1.70%

benchmark                         old MB/s     new MB/s     speedup
BenchmarkGobDecode                22.44        23.31        1.04x
BenchmarkGobEncode                27.83        27.97        1.01x
BenchmarkGzip                     14.97        15.10        1.01x
BenchmarkGunzip                   66.66        66.98        1.00x
BenchmarkJSONEncode               27.60        27.73        1.00x
BenchmarkJSONDecode               8.52         8.33         0.98x
BenchmarkGoParse                  3.94         3.99         1.01x
BenchmarkRegexpMatchEasy0_32      68.92        69.47        1.01x
BenchmarkRegexpMatchEasy0_1K      226.71       226.65       1.00x
BenchmarkRegexpMatchEasy1_32      70.75        70.42        1.00x
BenchmarkRegexpMatchEasy1_1K      219.55       219.28       1.00x
BenchmarkRegexpMatchMedium_32     1.66         1.66         1.00x
BenchmarkRegexpMatchMedium_1K     5.92         5.94         1.00x
BenchmarkRegexpMatchHard_32       3.29         3.34         1.02x
BenchmarkRegexpMatchHard_1K       3.40         3.43         1.01x
BenchmarkRevcomp                  92.28        92.29        1.00x
BenchmarkTemplate                 6.15         6.22         1.01x

Change-Id: I0b7d95388d6920fcbd7fe305df0c7c630a407726
Reviewed-on: https://go-review.googlesource.com/8636
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 15:52:47 +00:00
Dave Cheney
fb919e3a60 cmd/asm/internal/asm: add arm64 end to end tests
Add end to end tests for arm64 to support CL 8405.

There are several instruction forms commented out at the moment
they will be addressed in CL 8405 or later followups.

Change-Id: I6eeeb810c1e03cd49bb3c881bc46a29cdb817822
Reviewed-on: https://go-review.googlesource.com/8631
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 14:42:51 +00:00
David Crawshaw
68f57c8327 androidtest.bash: copy pkg for gcimporter tests
The tests for go/types depend on reading gc export data from the
$GOROOT/pkg directory. This is the first use of these files as
testdata, so previously they were not copied to the android device.
Now they are used, copy them.

Fixes android/arm build.

Change-Id: If13bbe603ce0aff697a73a97ae9a7d6b3ea800f9
Reviewed-on: https://go-review.googlesource.com/8624
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 14:39:07 +00:00
Michael Matloob
a173357cd5 runtime: fix return type for bsdthread_register in comments
The return type for bsdthread_register is int32. See
runtime/os_darwin.go.

This change also rewrites declaration comments for go functions to
use go syntax and fixes vet errors in sys_darwin_amd64.s.

Change-Id: I7482105f7562929e0ede30099efac9e76babd8a3
Reviewed-on: https://go-review.googlesource.com/3260
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 14:13:53 +00:00
Péter Surányi
a814c05eba io: clarify Copy docs regarding error handling
"returns ... the first error" was misleading or at least confusing:
in case a Read results in an error with non-zero bytes read, and the
subsequent Write also results in an error, the error from Write is
returned, which is the second one (in the temporal dimension).

Fixes #9744

Change-Id: If8925a701e4fae820cd9df7446503403fc0785d4
Reviewed-on: https://go-review.googlesource.com/3686
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 13:39:33 +00:00
Shenghou Ma
8ac129e530 doc/go1.5: mention cgo is supported on linux/arm64 (ext. link only)
Change-Id: I1dcca264d9cc900aad2d7737073cc01fe574bf55
Reviewed-on: https://go-review.googlesource.com/8623
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-08 09:09:29 +00:00
Shenghou Ma
bc2860f3d8 go/build: cgo is supported on linux/arm64 (external linking only)
Fixes #10107.

Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f6
Reviewed-on: https://go-review.googlesource.com/8453
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-04-08 09:09:08 +00:00
Shenghou Ma
7a96ecde4d cmd/internal/ld: force external linking on linux/arm64 with cgo
Update #10373.

Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f5
Reviewed-on: https://go-review.googlesource.com/8452
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-08 09:08:52 +00:00
Shenghou Ma
6508518849 misc/cgo/test/issue9400: add arm64 implementation
Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f4
Reviewed-on: https://go-review.googlesource.com/8451
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-04-08 09:08:40 +00:00
Shenghou Ma
d0b62d8bfa runtime: linux/arm64 cgo support
Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f3
Reviewed-on: https://go-review.googlesource.com/8450
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-04-08 09:08:27 +00:00
Shenghou Ma
0accc80fbb runtime/cgo: linux/arm64 cgo support
Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f2
Reviewed-on: https://go-review.googlesource.com/8439
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-04-08 09:08:12 +00:00
Shenghou Ma
6e3a2a3f9f cmd/internal/obj/arm64, cmd/internal/ld, cmd/7l: remove absolute addressing in .text
This CL introduces R_ADDRARM64, which is similar to R_ADDRPOWER.

Fixes #10112.

Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f1
Reviewed-on: https://go-review.googlesource.com/8438
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-08 09:07:48 +00:00
Shenghou Ma
f55b2a11f4 cmd/internal/ld, cmd/7l: external linking support for linux/arm64
Based on Michael Hudson-Doyle's patch:
b735215ee4

Change-Id: I309e3df7608b9eef9339196fdc50dedf5f9439f0
Reviewed-on: https://go-review.googlesource.com/8437
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-08 09:07:32 +00:00
Shenghou Ma
a50b24c649 cmd/api: make the test more robust
Previously, the TestCompareAPI test would fail if runtime.Version()
is "dev", or, more importantly, "go1.5"; because compareAPI depends
on runtime.Version and -allow_new flag. Move that logic out make
its test more robust.

Change-Id: I8f40daa1838b8acd26adac8848762d95315053b0
Reviewed-on: https://go-review.googlesource.com/8622
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 08:46:42 +00:00
Shenghou Ma
63d72f6901 cmd/7g: enable peephole optimizer
Based on cmd/9g/peep.go.

Go 1 benchmark comparison:
benchmark                          old ns/op       new ns/op       delta
BenchmarkBinaryTree17              24328574000     18351639000     -24.57%
BenchmarkFannkuch11                17029365000     10817758000     -36.48%
BenchmarkFmtFprintfEmpty           291             223             -23.37%
BenchmarkFmtFprintfString          1073            799             -25.54%
BenchmarkFmtFprintfInt             1024            778             -24.02%
BenchmarkFmtFprintfIntInt          1654            1277            -22.79%
BenchmarkFmtFprintfPrefixedInt     1360            1083            -20.37%
BenchmarkFmtFprintfFloat           2272            1415            -37.72%
BenchmarkFmtManyArgs               5933            4742            -20.07%
BenchmarkGobDecode                 53166003        38584736        -27.43%
BenchmarkGobEncode                 37930156        30074874        -20.71%
BenchmarkGzip                      1880638900      1286832100      -31.57%
BenchmarkGunzip                    386343633       292194480       -24.37%
BenchmarkHTTPClientServer          237077          179776          -24.17%
BenchmarkJSONEncode                101731690       73116925        -28.13%
BenchmarkJSONDecode                344655360       241277600       -29.99%
BenchmarkMandelbrot200             28329778        12950809        -54.29%
BenchmarkGoParse                   21670755        16554244        -23.61%
BenchmarkRegexpMatchEasy0_32       557             484             -13.11%
BenchmarkRegexpMatchEasy0_1K       4687            4832            +3.09%
BenchmarkRegexpMatchEasy1_32       539             483             -10.39%
BenchmarkRegexpMatchEasy1_1K       5100            5080            -0.39%
BenchmarkRegexpMatchMedium_32      796             651             -18.22%
BenchmarkRegexpMatchMedium_1K      233099          182047          -21.90%
BenchmarkRegexpMatchHard_32        13202           9897            -25.03%
BenchmarkRegexpMatchHard_1K        401027          303602          -24.29%
BenchmarkRevcomp                   3837679666      2816546600      -26.61%
BenchmarkTemplate                  440608300       324831040       -26.28%
BenchmarkTimeParse                 1460            1019            -30.21%
BenchmarkTimeFormat                1609            1174            -27.04%

benchmark                         old MB/s     new MB/s     speedup
BenchmarkGobDecode                14.44        19.89        1.38x
BenchmarkGobEncode                20.24        25.52        1.26x
BenchmarkGzip                     10.32        15.08        1.46x
BenchmarkGunzip                   50.23        66.41        1.32x
BenchmarkJSONEncode               19.07        26.54        1.39x
BenchmarkJSONDecode               5.63         8.04         1.43x
BenchmarkGoParse                  2.67         3.50         1.31x
BenchmarkRegexpMatchEasy0_32      57.38        66.05        1.15x
BenchmarkRegexpMatchEasy0_1K      218.47       211.91       0.97x
BenchmarkRegexpMatchEasy1_32      59.29        66.21        1.12x
BenchmarkRegexpMatchEasy1_1K      200.76       201.54       1.00x
BenchmarkRegexpMatchMedium_32     1.26         1.53         1.21x
BenchmarkRegexpMatchMedium_1K     4.39         5.62         1.28x
BenchmarkRegexpMatchHard_32       2.42         3.23         1.33x
BenchmarkRegexpMatchHard_1K       2.55         3.37         1.32x
BenchmarkRevcomp                  66.23        90.24        1.36x
BenchmarkTemplate                 4.40         5.97         1.36x

Fixes #10105.

Change-Id: I353cc9fdf922e431821508c9dbbe4d9a85d64bd4
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8471
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-04-08 08:16:54 +00:00
Shenghou Ma
84b690fee1 cmd/api: re-enable TestGolden on nacl
Fixes #10369.

Change-Id: If0a6d2b33c6862c9f7f862bdc997f2204072c6dc
Reviewed-on: https://go-review.googlesource.com/8620
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 06:36:36 +00:00
Shenghou Ma
a175fa3bc3 cmd/asm/internal/asm: parse arm64 register pairs for LDP/STP
Add test, and while we're at here, also add a test for ARM.

Fixes #10343.

Change-Id: Ic914df8233d4f1f495e2cc0743fbd37b7671bc91
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8472
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 05:22:41 +00:00
Robert Griesemer
35599e281b go/types: enable disabled test
Change-Id: I58de76c49de6e43befb30b2bf677934e7952b5ab
Reviewed-on: https://go-review.googlesource.com/8610
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 04:57:16 +00:00
Robert Griesemer
b2a1fb74f4 cmd/api: update api checker to use go/types from std repo
The old code checked out a specific version of go/types from the
x/tools repo. With go/types being part of the std repo, this is
not necessary anymore.

Also, for the same reason, the api tool is now built like any
other regular command. There's no need to build it for each run.
Removed the respective +build tags.

Change-Id: I5088e4867223d676957084c24651ec05452ac495
Reviewed-on: https://go-review.googlesource.com/8564
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-08 04:09:34 +00:00
Robert Griesemer
5a97747c40 go/types: skip failing tests (fix build)
Temporary work-around so we can start using go/types in the std repo.

Change-Id: I661465af791171b01cd23abf34dcb7eea6e26173
Reviewed-on: https://go-review.googlesource.com/8594
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 03:45:49 +00:00
Robert Griesemer
254964074f go/types, go/exact: "vendor" go/types into std repo
This is a first step towards moving go/types from the tools
repo into the std repo. The files were brought over via the
added src/go/types.bash script for reproducability. The
script can be removed once all dependencies on go/types
have moved to the std repo go/types.

The script moved packages as follows:

- x/tools/go/types => go/types (type-checker)
- x/tools/go/exact => go/exact (constants)
- x/tools/go/gcimporter => go/types/internal/gcimporter

The gcimporter is needed to be able to run tests. go/types
should probably have some factory function to provide an
appropriate importer.

Some of the go/types tests fail for a handful of platforms
(windows and nacl). In order to keep this change "clean"
from manual changes, the next change will disable those
tests for now so we can move forward.

Change-Id: I448d8f7faa39ad2e04811911b699f7682627c224
Reviewed-on: https://go-review.googlesource.com/8530
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 03:40:04 +00:00
Nigel Tao
0def13ac3f image/color: have CMYK.RGBA work in 16-bit color, per the Color interface.
Change-Id: I3621527c924a43724032f80a072505c60d929ab3
Reviewed-on: https://go-review.googlesource.com/8180
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 03:39:11 +00:00
Alex Brainman
32e75bace0 all: fix race when allocating buffer for some windows syscalls
Fixes #9753

Change-Id: I6c641ed7ef4f687a108e7d937ab4b9c24d5baf5d
Reviewed-on: https://go-review.googlesource.com/4940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 02:06:31 +00:00
Robert Griesemer
2f16ddc580 doc: update go1.5.txt (gc constant arithmetic now based on math/big)
Change-Id: Iff943d15e83e7db1f3c77f509a60e00ee2041d69
Reviewed-on: https://go-review.googlesource.com/8592
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-07 23:22:12 +00:00