]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocmd/...: fix vet issues and cull dead code
Josh Bleecher Snyder [Sat, 18 Apr 2015 00:23:51 +0000 (17:23 -0700)]
cmd/...: fix vet issues and cull dead code

Change-Id: Ied0eab872950793b34dd2268055b29c702b07e99
Reviewed-on: https://go-review.googlesource.com/9081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

10 years agonet: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error
Mikio Hara [Fri, 17 Apr 2015 05:55:07 +0000 (14:55 +0900)]
net: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error

Change-Id: I7c6c91a0551aacb49e1beb4a39215b93c8c7fcfa
Reviewed-on: https://go-review.googlesource.com/8997
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/cgo: more robust detection of clang
Matthew Dempsky [Sat, 18 Apr 2015 00:05:47 +0000 (17:05 -0700)]
cmd/cgo: more robust detection of clang

Fixes #10453.

Change-Id: I77470279865d4c954df615d6594c69edf68c28ca
Reviewed-on: https://go-review.googlesource.com/9090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6g, etc: cleanup, moving code out of near-empty gg.go files
Brad Fitzpatrick [Mon, 13 Apr 2015 23:26:08 +0000 (18:26 -0500)]
cmd/6g, etc: cleanup, moving code out of near-empty gg.go files

Clear out gg.go files, and move things into consistent places between
the cmd/?g directories.

Change-Id: I81e04180613b806e0bfbb88519e66111ce9f74a3
Reviewed-on: https://go-review.googlesource.com/9080
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: clean up cgo
Mikio Hara [Fri, 17 Apr 2015 08:56:58 +0000 (17:56 +0900)]
net: clean up cgo

This change adds a type addrinfoErrno to represent getaddrinfo,
getnameinfo-specific errors, and uses it in cgo-based lookup functions.

Also retags cgo files for clarification and does minor cleanup.

Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828
Reviewed-on: https://go-review.googlesource.com/9020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: replace Diag;Errorexit with Exitf
David Crawshaw [Thu, 9 Apr 2015 11:37:17 +0000 (07:37 -0400)]
cmd/internal/ld: replace Diag;Errorexit with Exitf

I have left the Diag calls in place where I believe Ctxt.Cursym != nil
which means this CL is not the improvement I had hoped for. However
it is now safe to call Exitf whereever you are in the linker, which
makes it easier to reason about some code.

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

10 years agomisc/cgo/testcarchive: check that os.Args is set
David Crawshaw [Fri, 17 Apr 2015 20:42:16 +0000 (16:42 -0400)]
misc/cgo/testcarchive: check that os.Args is set

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

10 years agoencoding/gob: fix hang from skipping large slices
Matthew Dempsky [Fri, 17 Apr 2015 21:45:51 +0000 (14:45 -0700)]
encoding/gob: fix hang from skipping large slices

Change-Id: I4e59b5b1702e08d7c6191d0a70fb0a555f3340c8
Reviewed-on: https://go-review.googlesource.com/9061
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc/go1.5.txt: go generate: add $GOLINE
Rob Pike [Fri, 17 Apr 2015 20:34:55 +0000 (13:34 -0700)]
doc/go1.5.txt: go generate: add $GOLINE

Change-Id: I9968ce162996e71843eeaf9764d216c401427fed
Reviewed-on: https://go-review.googlesource.com/9040
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc/articles/go_command.html: mention go generate
Rob Pike [Fri, 17 Apr 2015 18:37:08 +0000 (11:37 -0700)]
doc/articles/go_command.html: mention go generate

Fix some out-of-date remarks.

Fixes #10489.

Change-Id: I8f0cce2588828052a5d013e7bac6bcfeb220579d
Reviewed-on: https://go-review.googlesource.com/9008
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/go: add $GOLINE to generate
Rob Pike [Fri, 17 Apr 2015 18:21:02 +0000 (11:21 -0700)]
cmd/go: add $GOLINE to generate

Also use os.Expand for variable substitution so ${x}y works.

Fixes #9960.

Change-Id: Ic8239b2e737d1f41910dde8ee9524ac48907cb03
Reviewed-on: https://go-review.googlesource.com/9007
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc, cmd/6g: generate boolean values without jumps
Josh Bleecher Snyder [Wed, 8 Apr 2015 16:54:15 +0000 (09:54 -0700)]
cmd/internal/gc, cmd/6g: generate boolean values without jumps

Use SETcc instructions instead of Jcc to generate boolean values.
This generates shorter, jump-free code, which may in turn enable other
peephole optimizations.

For example, given

func f(i, j int) bool {
return i == j
}

Before

"".f t=1 size=32 value=0 args=0x18 locals=0x0
0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24
0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB)
0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX
0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP
0x000a 00010 (x.go:4) CMPQ BX, BP
0x000d 00013 (x.go:4) JEQ 21
0x000f 00015 (x.go:4) MOVB $0, "".~r2+24(FP)
0x0014 00020 (x.go:4) RET
0x0015 00021 (x.go:4) MOVB $1, "".~r2+24(FP)
0x001a 00026 (x.go:4) JMP 20

After

"".f t=1 size=32 value=0 args=0x18 locals=0x0
0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24
0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB)
0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX
0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP
0x000a 00010 (x.go:4) CMPQ BX, BP
0x000d 00013 (x.go:4) SETEQ "".~r2+24(FP)
0x0012 00018 (x.go:4) RET

regexp benchmarks, best of 12 runs:

benchmark                                 old ns/op      new ns/op      delta
BenchmarkNotOnePassShortB                 782            733            -6.27%
BenchmarkLiteral                          180            171            -5.00%
BenchmarkNotLiteral                       2855           2721           -4.69%
BenchmarkMatchHard_32                     2672           2557           -4.30%
BenchmarkMatchHard_1K                     80182          76732          -4.30%
BenchmarkMatchEasy1_32M                   76440180       73304748       -4.10%
BenchmarkMatchEasy1_32K                   68798          66350          -3.56%
BenchmarkAnchoredLongMatch                482            465            -3.53%
BenchmarkMatchEasy1_1M                    2373042        2292692        -3.39%
BenchmarkReplaceAll                       2776           2690           -3.10%
BenchmarkNotOnePassShortA                 1397           1360           -2.65%
BenchmarkMatchClass_InRange               3842           3742           -2.60%
BenchmarkMatchEasy0_32                    125            122            -2.40%
BenchmarkMatchEasy0_32K                   11414          11164          -2.19%
BenchmarkMatchEasy0_1K                    668            654            -2.10%
BenchmarkAnchoredShortMatch               260            255            -1.92%
BenchmarkAnchoredLiteralShortNonMatch     164            161            -1.83%
BenchmarkOnePassShortB                    623            612            -1.77%
BenchmarkOnePassShortA                    801            788            -1.62%
BenchmarkMatchClass                       4094           4033           -1.49%
BenchmarkMatchEasy0_32M                   14078800       13890704       -1.34%
BenchmarkMatchHard_32K                    4095844        4045820        -1.22%
BenchmarkMatchEasy1_1K                    1663           1643           -1.20%
BenchmarkMatchHard_1M                     131261708      129708215      -1.18%
BenchmarkMatchHard_32M                    4210112412     4169292003     -0.97%
BenchmarkMatchMedium_32K                  2460752        2438611        -0.90%
BenchmarkMatchEasy0_1M                    422914         419672         -0.77%
BenchmarkMatchMedium_1M                   78581121       78040160       -0.69%
BenchmarkMatchMedium_32M                  2515287278     2498464906     -0.67%
BenchmarkMatchMedium_32                   1754           1746           -0.46%
BenchmarkMatchMedium_1K                   52105          52106          +0.00%
BenchmarkAnchoredLiteralLongNonMatch      185            185            +0.00%
BenchmarkMatchEasy1_32                    107            107            +0.00%
BenchmarkOnePassLongNotPrefix             505            505            +0.00%
BenchmarkOnePassLongPrefix                147            147            +0.00%

The godoc binary is ~0.12% smaller after this CL.

Updates #5729.

toolstash -cmp passes for all architectures other than amd64 and amd64p32.

Other architectures can be done in follow-up CLs.

Change-Id: I0e167e259274b722958567fc0af83a17ca002da7
Reviewed-on: https://go-review.googlesource.com/2284
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: add -buildmode=c-archive/c-shared support for linux/386
Ian Lance Taylor [Fri, 17 Apr 2015 18:38:58 +0000 (11:38 -0700)]
runtime: add -buildmode=c-archive/c-shared support for linux/386

Change-Id: I87147ca6bb53e3121cc4245449c519509f107638
Reviewed-on: https://go-review.googlesource.com/9009
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: make use of new String methods in prints
Russ Cox [Fri, 17 Apr 2015 16:03:22 +0000 (12:03 -0400)]
cmd/internal/gc: make use of new String methods in prints

$ sam -d cmd/internal/gc/*.{go,y} cmd/?g/*.go
X ,s/, (gc\.)?[BFHNST]conv\(([^()]+), 0\)/, \2/g
X/'/w
q
$

Change-Id: Ic28a4807d237b8ae53ceca1e4e7fdb43580ab560
Reviewed-on: https://go-review.googlesource.com/9032
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type
Russ Cox [Fri, 17 Apr 2015 15:56:29 +0000 (11:56 -0400)]
cmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type

The next CL will remove unnecessary conv calls.

Change-Id: I0e8dbd1756cdec1ef6095ae67629cd3fae0fb4a4
Reviewed-on: https://go-review.googlesource.com/9031
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: leave gccheckmark testing off by default
Russ Cox [Fri, 17 Apr 2015 14:11:44 +0000 (10:11 -0400)]
runtime: leave gccheckmark testing off by default

It's not helping anymore, and it's fooling people who try to
understand performance (like me).

Change-Id: I133a644acae0ddf1bfa17c654cdc01e2089da963
Reviewed-on: https://go-review.googlesource.com/9018
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux
Ian Lance Taylor [Thu, 16 Apr 2015 17:08:20 +0000 (10:08 -0700)]
cmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux

Change-Id: I8c97751a79b57197428b0f0b66fc9575708a2eb0
Reviewed-on: https://go-review.googlesource.com/8979
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoruntime: fix dangling pointer in readyExecute
Austin Clements [Mon, 13 Apr 2015 20:50:20 +0000 (16:50 -0400)]
runtime: fix dangling pointer in readyExecute

readyExecute passes a closure to mcall that captures an argument to
readyExecute. Since mcall is marked noescape, this closure lives on
the stack of the calling goroutine. However, the closure puts the
calling goroutine on the run queue (and switches to a new
goroutine). If the calling goroutine gets scheduled before the mcall
returns, this stack-allocated closure will become invalid while it's
still executing. One consequence of this we've observed is that the
captured gp variable can get overwritten before the call to
execute(gp), causing execute(gp) to segfault.

Fix this by passing the currently captured gp variable through a field
in the calling goroutine's g struct so that the func is no longer a
closure.

To prevent problems like this in the future, this change also removes
the go:noescape annotation from mcall. Due to a compiler bug, this
will currently cause a func closure passed to mcall to be implicitly
allocated rather than refusing the implicit allocation. However, this
is okay because there are no other closures passed to mcall right now
and the compiler bug will be fixed shortly.

Fixes #10428.

Change-Id: I49b48b85de5643323b89e9eaa4df63854e968c32
Reviewed-on: https://go-review.googlesource.com/8866
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agodoc/go1.5.txt: go generate -run
Rob Pike [Fri, 17 Apr 2015 17:50:56 +0000 (10:50 -0700)]
doc/go1.5.txt: go generate -run

Change-Id: I8029640fe74731d7847390f371af37b85dec96cc
Reviewed-on: https://go-review.googlesource.com/9006
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: implement the long-promised -run flag for go generate
Rob Pike [Fri, 17 Apr 2015 17:27:05 +0000 (10:27 -0700)]
cmd/go: implement the long-promised -run flag for go generate

Trivial to do, but overlooked for 1.4, which is good because I prefer
the new design, which is just to match against the source code of
the line rather than the command word alone.

Change-Id: Idcf7c4479e97bb7cd732f0d058012321b6057628
Reviewed-on: https://go-review.googlesource.com/9005
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj: cleanups from C transition and delete dead code
Brad Fitzpatrick [Fri, 17 Apr 2015 16:36:19 +0000 (09:36 -0700)]
cmd/internal/obj: cleanups from C transition and delete dead code

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

10 years agoregexp: set b.cap[0] and b.cap[1] only when captures requested
Michael Matloob [Mon, 6 Apr 2015 20:33:47 +0000 (13:33 -0700)]
regexp: set b.cap[0] and b.cap[1] only when captures requested

Fixes #10319

Change-Id: I96015b0e1dff30a72de11fea3837638b5c672891
Reviewed-on: https://go-review.googlesource.com/8501
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agomisc/cgo/testcshared: test -buildmode=c-shared
Hyang-Ah Hana Kim [Thu, 16 Apr 2015 17:46:58 +0000 (13:46 -0400)]
misc/cgo/testcshared: test -buildmode=c-shared

Followed the same test pattern in misc/cgo/testcarchive.

Change-Id: I2f863b5c24a28f0b38b0128ed3e8a92c17fb5b9f
Reviewed-on: https://go-review.googlesource.com/8985
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: fix node print
Russ Cox [Fri, 17 Apr 2015 05:50:16 +0000 (01:50 -0400)]
cmd/internal/gc: fix node print

Change-Id: I0d2b909ceeba9da86c77de4ce23d7c6063f8f10f
Reviewed-on: https://go-review.googlesource.com/9017
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime/pprof: disable TestTraceStressStartStop
Dave Cheney [Thu, 16 Apr 2015 11:32:48 +0000 (21:32 +1000)]
runtime/pprof: disable TestTraceStressStartStop

Updates #10476

Change-Id: Ic4414f669104905c6004835be5cf0fa873553ea6
Reviewed-on: https://go-review.googlesource.com/8962
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agofmt: adjust formatting of invalid reflect.Value, add more tests
Russ Cox [Thu, 16 Apr 2015 19:18:27 +0000 (15:18 -0400)]
fmt: adjust formatting of invalid reflect.Value, add more tests

Repeat of CL 8951.

Change-Id: I5430e4a9eb5d8b7d0e3963657092bede67439056
Reviewed-on: https://go-review.googlesource.com/9003
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: export main.main for android
David Crawshaw [Fri, 17 Apr 2015 02:01:20 +0000 (22:01 -0400)]
runtime: export main.main for android

Previously we started the Go runtime from a JNI function call, which
eventually called the program's main function. Now the runtime is
initialized by an ELF initialization function as a c-shared library,
and the program's main function is not called. So now we export main
so it can be called from JNI.

This is necessary for all-Go apps because unlike a normal shared
library, the program loading the library is not written by or known
to the programmer. As far as they are concerned, the .so is
everything. In fact the same code is compiled for iOS as a normal Go
program.

Change-Id: I61c6a92243240ed229342362231b1bfc7ca526ba
Reviewed-on: https://go-review.googlesource.com/9015
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: do not run main when buildmode=c-shared
David Crawshaw [Thu, 16 Apr 2015 20:05:52 +0000 (16:05 -0400)]
runtime: do not run main when buildmode=c-shared

Change-Id: Ie7f85873978adf3fd5c739176f501ca219592824
Reviewed-on: https://go-review.googlesource.com/9011
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: deps check all std packages
Matthew Dempsky [Thu, 16 Apr 2015 19:03:10 +0000 (12:03 -0700)]
go/build: deps check all std packages

Instead of only checking packages that are already listed in pkgDeps,
apply deps checks to all standard library packages.

To avoid slowing testing down too much, instead of running "go list
std" in a subprocess like cmd/api or cmd/dist, this test manually
walks the GOROOT src directory to enumerate packages.

Timings on an HP Z620 using linux/amd64:

     short full
before 0.092s 4.880s
after 0.137s 5.104s

Additionally, a handful of packages that were previously unchecked are
now listed, along with their current dependencies.  These should
probably eventually be moved elsewhere and assigned appropriate
allowable-dependency sets.  For now, they've been grandfathered in by
simply assigning them their current dependencies, so that followup CLs
can review them individually as appropriate.

Fixes #10475.

Change-Id: I83ffd8ff329092f664bf3e3f2c9e3dad8e77ac02
Reviewed-on: https://go-review.googlesource.com/9001
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocompress/flate: simplify the TestDegenerateHuffmanCoding data.
Nigel Tao [Fri, 17 Apr 2015 04:11:22 +0000 (14:11 +1000)]
compress/flate: simplify the TestDegenerateHuffmanCoding data.

Change-Id: I223a4bd6e3ee31324b46ac79a4022e40f1868491
Reviewed-on: https://go-review.googlesource.com/8995
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
10 years agocmd/internal/gc: clean up bgen
Josh Bleecher Snyder [Tue, 7 Apr 2015 02:36:36 +0000 (19:36 -0700)]
cmd/internal/gc: clean up bgen

This cleanup is in anticipation of implementing
jump-free booleans (CL 2284) and zero-aware
comparisons (issue 10381).

No functional changes. Passes toolstash -cmp.

Change-Id: I50f394c60fa2927e177d7fc85b75085060a9e912
Reviewed-on: https://go-review.googlesource.com/8738
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: delete cgo_allocate
Russ Cox [Wed, 15 Apr 2015 19:00:42 +0000 (15:00 -0400)]
runtime: delete cgo_allocate

This memory is untyped and can't be used anymore.
The next version of SWIG won't need it.

Change-Id: I592b287c5f5186975ee09a9b28d8efe3b57134e7
Reviewed-on: https://go-review.googlesource.com/8956
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix inconsistent error values on Dial, Listen partially
Mikio Hara [Mon, 13 Apr 2015 14:45:00 +0000 (23:45 +0900)]
net: fix inconsistent error values on Dial, Listen partially

This change makes TestDialError, TestListenError work without any
external dependency, enables them by default, and removes unnecessary
-run_error_test flag for fixing #4856.

Also fixes inconsistent error values on Dial, Listen partially as a
first stab.

Updates #4856.

Change-Id: Ie10c151ae06759085f352c7db2ca45107a81914f
Reviewed-on: https://go-review.googlesource.com/8903
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: rename netFD.proto to netFD.net on Plan 9
Mikio Hara [Thu, 16 Apr 2015 07:24:45 +0000 (16:24 +0900)]
net: rename netFD.proto to netFD.net on Plan 9

In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing #4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.

Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoimage/color: have Palette.Index honor alpha for closest match, not just
Nigel Tao [Thu, 16 Apr 2015 01:08:05 +0000 (11:08 +1000)]
image/color: have Palette.Index honor alpha for closest match, not just
red, green and blue.

Fixes #9902

Change-Id: Ibffd0aa2f98996170e39a919296f69e9d5c71545
Reviewed-on: https://go-review.googlesource.com/8907
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc: mention darwin/arm64 port in go1.5.txt
Shenghou Ma [Sat, 11 Apr 2015 10:01:54 +0000 (06:01 -0400)]
doc: mention darwin/arm64 port in go1.5.txt

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f08
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8787
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/ld: use usual flooding for c-archive
David Crawshaw [Thu, 16 Apr 2015 19:53:05 +0000 (15:53 -0400)]
cmd/internal/ld: use usual flooding for c-archive

I said I removed this from cl/8711 in response to your comment, but
apparently I did not.

misc/cgo/testcarchive continues to pass on darwin/amd64.

Change-Id: I6410782f2a78bf117741628fb71cac56e289b590
Reviewed-on: https://go-review.googlesource.com/9010
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: aeshash stubs for arm64
David Crawshaw [Thu, 16 Apr 2015 19:23:17 +0000 (15:23 -0400)]
runtime: aeshash stubs for arm64

For some reason the absense of an implementation does not stop arm64
binaries being built. However it comes up with -buildmode=c-archive.

Change-Id: Ic0db5fd8fb4fe8252b5aa320818df0c7aec3db8f
Reviewed-on: https://go-review.googlesource.com/8989
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/go: have go run, go list respect -buildmode/-linkshared
Michael Hudson-Doyle [Wed, 1 Apr 2015 02:53:52 +0000 (15:53 +1300)]
cmd/go: have go run, go list respect -buildmode/-linkshared

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

10 years agoruntime: darwin/arm64 c-archive entry point
David Crawshaw [Thu, 16 Apr 2015 17:49:36 +0000 (13:49 -0400)]
runtime: darwin/arm64 c-archive entry point

Change-Id: Ib227aa3e14d01a0ab1ad9e53d107858e045d1c42
Reviewed-on: https://go-review.googlesource.com/8984
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix typo in comment
David du Colombier [Thu, 16 Apr 2015 18:42:21 +0000 (20:42 +0200)]
net: fix typo in comment

Change-Id: I8b2063e65d3454a694a789c1682dacfe0bea2e19
Reviewed-on: https://go-review.googlesource.com/8965
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/tls: fix test data generation
Jonathan Rudenberg [Wed, 15 Apr 2015 19:00:53 +0000 (15:00 -0400)]
crypto/tls: fix test data generation

- Multiple GetCertificate tests shared the same name and were
  overwriting each other, each test now has a unique name.
- expectAlert was not implemented in the data updater, the single
  test that used it has been replaced with a ClientHello failure
  test.

Fixes #10470

Change-Id: I500738f6302ffa863d7ee45d85fa8773155e0614
Reviewed-on: https://go-review.googlesource.com/8959
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agoruntime/cgo: enable arm64 EXC_BAD_ACCESS handler
David Crawshaw [Thu, 16 Apr 2015 17:39:16 +0000 (13:39 -0400)]
runtime/cgo: enable arm64 EXC_BAD_ACCESS handler

Change-Id: I8e912ff9327a4163b63b8c628aa3546e86ddcc02
Reviewed-on: https://go-review.googlesource.com/8983
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoRevert "fmt: add a few more reflect.Value tests"
Brad Fitzpatrick [Thu, 16 Apr 2015 16:58:16 +0000 (16:58 +0000)]
Revert "fmt: add a few more reflect.Value tests"

This reverts commit 3e6b7f35de96414a3a393f0ad25326f411101776.

Change-Id: Icad2b235b9880729fbdf80d7dfd71e56df4b1231
Reviewed-on: https://go-review.googlesource.com/8944
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/x509: build the builtin root certs also for darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 09:09:12 +0000 (05:09 -0400)]
crypto/x509: build the builtin root certs also for darwin/arm64

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f06
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8785
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoos: clarify that ModePerm permission bits are the Unix ones
Brad Fitzpatrick [Tue, 14 Apr 2015 22:22:02 +0000 (15:22 -0700)]
os: clarify that ModePerm permission bits are the Unix ones

Fixes #7075

Change-Id: I57fcebaaef768b00263b6b91211b1434f6a4b229
Reviewed-on: https://go-review.googlesource.com/8919
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agofmt: add a few more reflect.Value tests
Russ Cox [Wed, 15 Apr 2015 17:49:32 +0000 (13:49 -0400)]
fmt: add a few more reflect.Value tests

Change-Id: I86530a4fd240f3e056e3277355d2965f6863b852
Reviewed-on: https://go-review.googlesource.com/8951
Reviewed-by: Rob Pike <r@golang.org>
10 years agomime/quotedprintable: Return a Reader instead of an io.Reader
Alexandre Cesaro [Thu, 16 Apr 2015 14:08:09 +0000 (16:08 +0200)]
mime/quotedprintable: Return a Reader instead of an io.Reader

It is not needed right now, but it will allow more flexibility in
the future.

Fixes #10472

Change-Id: I2eaea70abeca5ed10f89b0b2dfdabdac376a0a41
Reviewed-on: https://go-review.googlesource.com/8964
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoreflect, cmd/internal/gc: look for pointer types by string before synthesizing
Michael Hudson-Doyle [Sun, 29 Mar 2015 23:11:47 +0000 (23:11 +0000)]
reflect, cmd/internal/gc: look for pointer types by string before synthesizing

The ptrto field of the type data cannot be relied on when dynamic linking: a
type T may be defined in a module that makes no use of pointers to that type,
but another module can contain a package that imports the first one and does use
*T pointers.  The second module will end up defining type data for *T and a
type.*T symbol pointing at it. It's important that calling .PtrTo() on the
refect.Type for T returns this type data and not some synthesized object, so we
need reflect to be able to find it!

Fortunately, the reflect package already has a mechanism for doing this sort of
thing: ChanOf/MapOf/etc look for pre-existing type data by name.  So this change
just extends PtrTo() to consult this too, and changes the compiler to include
pointer types in the data consulted when compiling for dynamic linking.

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

10 years agomisc/ios: fix teamID and appID use in entitlements
Josh Bleecher Snyder [Thu, 16 Apr 2015 00:00:05 +0000 (17:00 -0700)]
misc/ios: fix teamID and appID use in entitlements

This is a follow-up to CL 8910.
This is the version that I have tested and which works
when appID and teamID are not the same (which they appear
to be for the builder).

I am unsure how I submitted it with the wrong code.

Change-Id: I186e34e91953d082b507390c1cd2042e5419c4c9
Reviewed-on: https://go-review.googlesource.com/8943
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: registerize more in 7g and 9g
Josh Bleecher Snyder [Fri, 10 Apr 2015 00:58:52 +0000 (17:58 -0700)]
cmd/internal/gc: registerize more in 7g and 9g

7g and 9g disagree with componentgen
about what type len and cap have.

This results in an etype mismatch,
which inhibits registerization.

Fixing this results in 7406 more registerizations
while building the stdlib.
There are still 1512 missed opportunities.

This should improve the performance benefit
to 7g of enabling componentgen (CL 8636).

This CL reduces the size of godoc by 203k (-1.177%).

This was discovered by using the diagnostics
added in CL 8732 and running:

GOARCH=arm64 GOOS=linux go build -gcflags="-d registerization" std

See CL 91850043 for similar earlier fixes for 6g and 8g.

Change-Id: I57f478228a000ad7529d4136bad94a51343c4daa
Reviewed-on: https://go-review.googlesource.com/8733
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/7g: change CHECKNIL sequence
Aram Hăvărneanu [Wed, 8 Apr 2015 13:39:25 +0000 (15:39 +0200)]
cmd/7g: change CHECKNIL sequence

We can use CBNZ instruction and make it one instruction shorter.

Saves 66kB in godoc.

Change-Id: Ie71fe7cf31e7f73644ee926f4f9624c009c3eb1a
Reviewed-on: https://go-review.googlesource.com/8634
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/7g: remove loads that only load an immediate to be later used by ADD/SUB
Aram Hăvărneanu [Wed, 8 Apr 2015 11:14:15 +0000 (13:14 +0200)]
cmd/7g: remove loads that only load an immediate to be later used by ADD/SUB

Optimize the sequence:
MOV $imm, Rt
ADD Rt, Rs, Rd

into:
ADD $imm, Rs, Rd

Saves 66k in godoc.

Change-Id: I27b4aaa0ec80a59472fe2e5816efdf3db9c901ee
Reviewed-on: https://go-review.googlesource.com/8632
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:14:43 +0000 (22:14 -0400)]
runtime: darwin/arm64 support

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f03
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8782
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agomisc/cgo/test: skip issue3261 test on darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 09:57:15 +0000 (05:57 -0400)]
misc/cgo/test: skip issue3261 test on darwin/arm64

Because there is no libgcc.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f07
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8786
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoiostest.bash: run detect.go as part of iostest
David Crawshaw [Wed, 15 Apr 2015 19:03:41 +0000 (15:03 -0400)]
iostest.bash: run detect.go as part of iostest

Change-Id: I402629b154ae36c879a8d5088cb0f71b075f31dc
Reviewed-on: https://go-review.googlesource.com/8958
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agoruntime/cgo: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:16:11 +0000 (22:16 -0400)]
runtime/cgo: darwin/arm64 support

Fixes #10116.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f05
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8784
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agosyscall: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:15:31 +0000 (22:15 -0400)]
syscall: darwin/arm64 support

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f04
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8783
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agomisc/ios: adjust exec script for iOS 8.3
David Crawshaw [Wed, 15 Apr 2015 18:59:46 +0000 (14:59 -0400)]
misc/ios: adjust exec script for iOS 8.3

We no longer need the EXC_BAD_ACCESS watcher as runtime/cgo contains
a mach exception handler that catches it. And now lldb only
intermittently reports process connection and exiting, so instead
just look for the PASS from Go.

Change-Id: I403266558f5a900e0b87ec1019d9baec88148d23
Reviewed-on: https://go-review.googlesource.com/8957
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocompress/flate: reject invalid Huffman bit sizes
Matthew Dempsky [Mon, 13 Apr 2015 22:31:28 +0000 (15:31 -0700)]
compress/flate: reject invalid Huffman bit sizes

If the requested coding bit sizes don't result in a full binary tree,
then reject the input as invalid.

Exception: We still need to allow degenerate Huffman codings with a
single 1-bit code to be compatible with zlib and files compressed with
Go's compress/flate package.

Update #10426.

Change-Id: I171b98d12e65b4deb9f4031cd802407ebb5e266c
Reviewed-on: https://go-review.googlesource.com/8922
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoAdd reflect.FuncOf to docs/go1.5.text
Dave Day [Thu, 16 Apr 2015 05:37:51 +0000 (15:37 +1000)]
Add reflect.FuncOf to docs/go1.5.text

Change-Id: I6089cebf7de73ce9c4e53ad3e8ef2673d970bda2
Reviewed-on: https://go-review.googlesource.com/8908
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj, cmd/internal/ld, cmd/7l: external linking for darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 01:28:09 +0000 (21:28 -0400)]
cmd/internal/obj, cmd/internal/ld, cmd/7l: external linking for darwin/arm64

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f02
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8781
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/7g: disable duff's device on darwin
Shenghou Ma [Sat, 11 Apr 2015 00:08:22 +0000 (20:08 -0400)]
cmd/7g: disable duff's device on darwin

ld64 cannot handle BR26 reloc with non-zero addend. It incorrectly
thinks that non-zero addend for BR26 means the code is not PIC, but
those BR26 relocs should be fully resolved at link time.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f01
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8780
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/obj/arm64: add SVC to unary destination list
Shenghou Ma [Sat, 11 Apr 2015 02:16:32 +0000 (22:16 -0400)]
cmd/internal/obj/arm64: add SVC to unary destination list

To support "SVC $0x80", which is needed for darwin/arm64.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f00
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8769
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocompress/flate: add optional runtime sanity checks
Matthew Dempsky [Wed, 15 Apr 2015 23:46:58 +0000 (16:46 -0700)]
compress/flate: add optional runtime sanity checks

This code's test coverage is ad hoc at best, and it's easy to make
changes that accidentally regress invariants.  This CL adds a "sanity"
constant that can be changed to "true" during development to add extra
runtime checking that the Huffman decoder tables are sane.

Change-Id: I0d0ca53ad7c9566be18046d9b255e1a30059f28b
Reviewed-on: https://go-review.googlesource.com/8974
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agocompress/flate: reject invalid Huffman encoding sequences
Matthew Dempsky [Mon, 13 Apr 2015 22:31:28 +0000 (15:31 -0700)]
compress/flate: reject invalid Huffman encoding sequences

When decoding Huffman codes, if an invalid bit sequence is discovered,
reject the input instead of treating it as a 0-length code.

Fixes #10426.

Change-Id: Ie2f1a3a718afd7c6bee73a67480d4b84936c21c9
Reviewed-on: https://go-review.googlesource.com/8893
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoreflect: add FuncOf function
Dave Day [Tue, 23 Dec 2014 04:19:30 +0000 (15:19 +1100)]
reflect: add FuncOf function

This also involves adding functions to typelinks along with a minor
change to ensure they are sorted correctly.

Change-Id: I054a79b6498a634cbccce17579f52c299733c2cf
Reviewed-on: https://go-review.googlesource.com/1996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoimage: spell coordinate consistently, without the hyphen.
Nigel Tao [Thu, 16 Apr 2015 00:13:23 +0000 (10:13 +1000)]
image: spell coordinate consistently, without the hyphen.

Change-Id: I211c0d33dc292c6a703d788f6d4d286107bcb6b0
Reviewed-on: https://go-review.googlesource.com/8906
Reviewed-by: Rob Pike <r@golang.org>
10 years agonet: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0
Mikio Hara [Fri, 10 Apr 2015 08:24:43 +0000 (17:24 +0900)]
net: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0

Under some dial tests that require external network connectivity, we
must prevent application traffic but must not interfere with control
plane traffic such as DNS message exchange. But test helper function
disableSocketConnect prevents both application and control plane traffic
unconditionally and makes some dial tests with -ipv6 fail when
CGO_ENABLED=0.

This change makes disableSocketConnect take a look at not only address
family but socket type for fixing some dial tests with -ipv6 when
CGO_ENBALED=0.

Change-Id: I32241d9592d31483424bb5e69cb4d56f3fc20312
Reviewed-on: https://go-review.googlesource.com/8743
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6l: call runtime.addmoduledata from .init_array
Michael Hudson-Doyle [Wed, 1 Apr 2015 01:17:43 +0000 (14:17 +1300)]
cmd/6l: call runtime.addmoduledata from .init_array

Change-Id: I09e84161d106960a69972f5fc845a1e40c28e58f
Reviewed-on: https://go-review.googlesource.com/8331
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 agocmd/go: support -buildmode=shared
Michael Hudson-Doyle [Sun, 22 Mar 2015 23:30:18 +0000 (12:30 +1300)]
cmd/go: support -buildmode=shared

You can now do 'go install -buildmode=shared std' and get yourself
a nice (33 meg) libstd.so (which is not useful until there is -linkshared
support as well, of course).

Change-Id: Ie9b7e7f72abc7d369a6e3ecc98903a9d197bd6e6
Reviewed-on: https://go-review.googlesource.com/8300
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 agointernal/syscall: move to unix subdirectory
Ian Lance Taylor [Wed, 15 Apr 2015 23:28:00 +0000 (16:28 -0700)]
internal/syscall: move to unix subdirectory

Move the single file from internal/syscall to internal/syscall/unix,
to match the golang.org/x/sys layout.

Change-Id: I2fb2832b4cb22efc7666bd276f5401ac3e73dc40
Reviewed-on: https://go-review.googlesource.com/8972
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/test: require external linking for c-archive
David Crawshaw [Wed, 15 Apr 2015 18:47:08 +0000 (14:47 -0400)]
cmd/test: require external linking for c-archive

Change-Id: I9ceceb29291ea9f5d7b675dfabd665c5e3618471
Reviewed-on: https://go-review.googlesource.com/8955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: support -installsuffix with gccgo
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:22:23 +0000 (10:22 +0200)]
go/build: support -installsuffix with gccgo

Fixes #10449

Change-Id: I1dc2d0213e6a46f3609222d5460c1a54081e2471
Reviewed-on: https://go-review.googlesource.com/8931
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/go, go/build: add build.Package.PkgTargetRoot
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:20:18 +0000 (10:20 +0200)]
cmd/go, go/build: add build.Package.PkgTargetRoot

This is $GOPATH/pkg/linux_amd64 or similar.  cmd/go already had a grotty calculation
of this and I need to add another one for -buildmode=shared.

Change-Id: Ied28c9b7cce671da8d45920e124a3e0c2501258a
Reviewed-on: https://go-review.googlesource.com/8930
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/ld: allow -r to override rpath when -linkshared
Michael Hudson-Doyle [Sun, 12 Apr 2015 00:31:28 +0000 (02:31 +0200)]
cmd/internal/ld: allow -r to override rpath when -linkshared

Including having -r "" preventing rpath from being set at all.

Change-Id: Ib40d7bf93a6e9ef21985c4a05b5703e4fbd1cd1b
Reviewed-on: https://go-review.googlesource.com/8806
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6g, runtime: improve duffzero throughput
Josh Bleecher Snyder [Wed, 15 Apr 2015 18:05:01 +0000 (11:05 -0700)]
cmd/6g, runtime: improve duffzero throughput

It is faster to execute

MOVQ AX,(DI)
MOVQ AX,8(DI)
MOVQ AX,16(DI)
MOVQ AX,24(DI)
ADDQ $32,DI

than

STOSQ
STOSQ
STOSQ
STOSQ

However, in order to be able to jump into
the middle of a block of MOVQs, the call
site needs to pre-adjust DI.

If we're clearing a small area, the cost
of that DI pre-adjustment isn't repaid.

This CL switches the DUFFZERO implementation
to use a hybrid strategy, in which small
clears use STOSQ as before, but large clears
use mostly MOVQ/ADDQ blocks.

benchmark                 old ns/op     new ns/op     delta
BenchmarkClearFat8        0.55          0.55          +0.00%
BenchmarkClearFat12       0.82          0.83          +1.22%
BenchmarkClearFat16       0.55          0.55          +0.00%
BenchmarkClearFat24       0.82          0.82          +0.00%
BenchmarkClearFat32       2.20          1.94          -11.82%
BenchmarkClearFat40       1.92          1.66          -13.54%
BenchmarkClearFat48       2.21          1.93          -12.67%
BenchmarkClearFat56       3.03          2.20          -27.39%
BenchmarkClearFat64       3.26          2.48          -23.93%
BenchmarkClearFat72       3.57          2.76          -22.69%
BenchmarkClearFat80       3.83          3.05          -20.37%
BenchmarkClearFat88       4.14          3.30          -20.29%
BenchmarkClearFat128      5.54          4.69          -15.34%
BenchmarkClearFat256      9.95          9.09          -8.64%
BenchmarkClearFat512      18.7          17.9          -4.28%
BenchmarkClearFat1024     36.2          35.4          -2.21%

Change-Id: Ic786406d9b3cab68d5a231688f9e66fcd1bd7103
Reviewed-on: https://go-review.googlesource.com/2585
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/gc, cmd/gc: move Reg from Val to Node
Josh Bleecher Snyder [Mon, 13 Apr 2015 17:28:57 +0000 (10:28 -0700)]
cmd/internal/gc, cmd/gc: move Reg from Val to Node

Val is used to hold constant values.
Reg was the odd duck out.

Generated using eg.

No functional changes. Passes toolstash -cmp.

Change-Id: Ic1de769a1f92bb02e09a4428d998b716f307e2f6
Reviewed-on: https://go-review.googlesource.com/8912
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: merge slice and sliceStruct
Michael Hudson-Doyle [Fri, 10 Apr 2015 22:01:54 +0000 (10:01 +1200)]
runtime: merge slice and sliceStruct

By removing type slice, renaming type sliceStruct to type slice and
whacking until it compiles.

Has a pleasing net reduction of conversions.

Fixes #10188

Change-Id: I77202b8df637185b632fd7875a1fdd8d52c7a83c
Reviewed-on: https://go-review.googlesource.com/8770
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/dist: fix bootstrapping with gccgo on 386
Michael Hudson-Doyle [Wed, 15 Apr 2015 13:18:00 +0000 (15:18 +0200)]
cmd/dist: fix bootstrapping with gccgo on 386

We forgot to add the !gccgo tag to cpuid_386.s.

Change-Id: I2de2ed92ac9686c9365cb37cd29121fa98c2bf37
Reviewed-on: https://go-review.googlesource.com/8960
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodoc/go1.5.txt: io.CopyBuffer and new reflect.Value handling in fmt
Rob Pike [Wed, 15 Apr 2015 16:01:38 +0000 (09:01 -0700)]
doc/go1.5.txt: io.CopyBuffer and new reflect.Value handling in fmt

Change-Id: Ia0d7c2f08f8f124bcd62c7f9744227812d68903d
Reviewed-on: https://go-review.googlesource.com/8941
Reviewed-by: Rob Pike <r@golang.org>
10 years agofmt: treat reflect.Value specially - as the value it holds
Rob Pike [Thu, 9 Apr 2015 23:30:48 +0000 (16:30 -0700)]
fmt: treat reflect.Value specially - as the value it holds

When a reflect.Value is passed to Printf (etc.), fmt called the
String method, which does not disclose its contents. To get the
contents, one could call Value.Interface(), but that is illegal
if the Value is not exported or otherwise forbidden.

This CL improves the situation with a trivial change to the
fmt package: when we see a reflect.Value as an argument,
we treat it exactly as we treat a reflect.Value we make inside
the package. This means that we always print the
contents of the Value as if _that_ was the argument to Printf.

This is arguably a breaking change but I think it is a genuine
improvement and no greater a break than many other tweaks
we have made to formatted output from this package.

Fixes #8965.

Change-Id: Ifc2a4ce3c1134ad5160e101d2196c22f1542faab
Reviewed-on: https://go-review.googlesource.com/8731
Reviewed-by: roger peppe <rogpeppe@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoio: add CopyBuffer, a version of Copy in which the user provides a buffer
Rob Pike [Thu, 9 Apr 2015 23:03:12 +0000 (16:03 -0700)]
io: add CopyBuffer, a version of Copy in which the user provides a buffer

This trivial addition to the io package makes it easy to control the
buffer size and allocation properties of io.Copy.

Change-Id: Ica1a6bd015e429d4e655bc0c6f66cea21c454acf
Reviewed-on: https://go-review.googlesource.com/8730
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc, cmd/7g: use zero register in Componentgen
Dave Cheney [Thu, 9 Apr 2015 11:25:48 +0000 (21:25 +1000)]
cmd/internal/gc, cmd/7g: use zero register in Componentgen

Fixes #9855

Use an architectural zero register as the source for zeroing, if available.

Change-Id: Ie5b4ba4e3d356c6f892bfd1cebd14d5152bdeeb0
Reviewed-on: https://go-review.googlesource.com/8722
Reviewed-by: Keith Randall <khr@golang.org>
10 years agonet: add Listen system call hook for testing
Mikio Hara [Wed, 8 Apr 2015 11:21:24 +0000 (20:21 +0900)]
net: add Listen system call hook for testing

Change-Id: I63053c45081f47ba736720a78d85c31c13767891
Reviewed-on: https://go-review.googlesource.com/8642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agonet/internal/socktest: add hook for Listen, failed system call counters
Mikio Hara [Wed, 8 Apr 2015 11:13:36 +0000 (20:13 +0900)]
net/internal/socktest: add hook for Listen, failed system call counters

Change-Id: Icaac9a48a3b9a3c5542235162e21ab8303592965
Reviewed-on: https://go-review.googlesource.com/8641
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: mark all runtime.cputicks implementations NOSPLIT
Dave Cheney [Wed, 15 Apr 2015 09:11:47 +0000 (19:11 +1000)]
runtime: mark all runtime.cputicks implementations NOSPLIT

Fixes #10450

runtime.cputicks is called from runtime.exitsyscall and must not
split the stack. cputicks is implemented in several ways and the
NOSPLIT annotation was missing from a few of these.

Change-Id: I5cbbb4e5888c5d298fe2fef240782d0e49f59af8
Reviewed-on: https://go-review.googlesource.com/8939
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
10 years agoruntime: really pass return value to Windows in externalthreadhandler
Alex Brainman [Tue, 14 Apr 2015 00:48:05 +0000 (10:48 +1000)]
runtime: really pass return value to Windows in externalthreadhandler

When Windows calls externalthreadhandler it expects to receive
return value in AX. We don't set AX anywhere. Change that.
Store ctrlhandler1 and profileloop1 return values into AX before
returning from externalthreadhandler.

Fixes #10215.

Change-Id: Ied04542cc3ebe7d4a26660e970f9f78098143591
Reviewed-on: https://go-review.googlesource.com/8901
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoimage/png: reject multiple tRNS chunks.
Nigel Tao [Wed, 15 Apr 2015 03:03:24 +0000 (13:03 +1000)]
image/png: reject multiple tRNS chunks.

http://www.w3.org/TR/PNG/#5ChunkOrdering disallows them.

Fixes #10423

Change-Id: I3399ce53dc8b41b1b5f0b906a5912e6efd80418f
Reviewed-on: https://go-review.googlesource.com/8905
Reviewed-by: Rob Pike <r@golang.org>
10 years agogo/importer: added go/importer package, adjusted go/types
Robert Griesemer [Sat, 11 Apr 2015 00:50:06 +0000 (17:50 -0700)]
go/importer: added go/importer package, adjusted go/types

- The go/importer package provides access to compiler-specific importers.
- Adjusted go/internal/gcimporter and go/types as needed.
- types.Check was removed - not much simpler than calling types.Config.Check.
- Package "unsafe" is now handled by the type checker; importers are not
  called for it anymore.
- In std lib tests, re-use importer for faster testing
  (no need to re-import previously imported packages).
- Minor cleanups.

The code still needs cleanups before submitting.

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

10 years agomisc/ios: read codesign info from environment variables
Josh Bleecher Snyder [Mon, 13 Apr 2015 18:31:41 +0000 (11:31 -0700)]
misc/ios: read codesign info from environment variables

Use environment variables to allow set-and-forget.

Add a script to attempt to autodetect codesign info.

Change-Id: Ic56b9c5f097b1a4117ebb89c408bc333d91f581d
Reviewed-on: https://go-review.googlesource.com/8910
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: convert Bval to bool
Josh Bleecher Snyder [Mon, 13 Apr 2015 16:52:02 +0000 (09:52 -0700)]
cmd/internal/gc: convert Bval to bool

No functional changes. Passes toolstash -cmp.

Change-Id: I4fba0c248645c3910ee3f7fc99dacafb676c5dc2
Reviewed-on: https://go-review.googlesource.com/8911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: make time slice a const
Austin Clements [Mon, 23 Mar 2015 17:27:24 +0000 (13:27 -0400)]
runtime: make time slice a const

A G will be preempted if it runs for 10ms without blocking. Currently
this constant is hard-coded in retake. Move it to a global const.
We'll use the time slice length in scheduling background GC.

Change-Id: I79a979948af2fad3afe5df9d4af4062f166554b7
Reviewed-on: https://go-review.googlesource.com/8838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: fix freed page accounting in mHeap_ReclaimList
Austin Clements [Tue, 14 Apr 2015 02:43:05 +0000 (22:43 -0400)]
runtime: fix freed page accounting in mHeap_ReclaimList

mHeap_ReclaimList is asked to reclaim at least npages pages, but it
counts the number of spans reclaimed, not the number of pages
reclaimed. The number of spans reclaimed is strictly larger than the
number of pages, so this is not strictly wrong, but it is forcing more
reclamation than was intended by the caller, which delays large
allocations.

Fix this by increasing the count by the number of pages in the swept
span, rather than just increasing it by 1.

Fixes #9048.

Change-Id: I5ae364a9837a6012e68fcd431bba000340cfd50c
Reviewed-on: https://go-review.googlesource.com/8920
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove unnecessary traceNextGC
Austin Clements [Mon, 13 Apr 2015 22:38:16 +0000 (18:38 -0400)]
runtime: remove unnecessary traceNextGC

Commit d7e0ad4 removed the next_gc manipulation from mSpan_Sweep, but
left in the traceNextGC() for recording the updated next_gc
value. Remove this now unnecessary call.

Change-Id: I28e0de071661199be9810d7bdcc81ce50b5a58ae
Reviewed-on: https://go-review.googlesource.com/8894
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoio/ioutil: fix locking of the tempfile random state
Marius Nuennerich [Tue, 14 Apr 2015 10:30:54 +0000 (11:30 +0100)]
io/ioutil: fix locking of the tempfile random state

Fixes #10451

Change-Id: I15ed777e9a4a4e1ba1178d07fcbe0ab4bf0d9e50
Reviewed-on: https://go-review.googlesource.com/8936
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoreflect: document reflect.TypeOf((*Foo)(nil)).Elem() idiom
Matthew Dempsky [Tue, 14 Apr 2015 16:56:05 +0000 (09:56 -0700)]
reflect: document reflect.TypeOf((*Foo)(nil)).Elem() idiom

See also golang-dev discussion:
https://groups.google.com/d/msg/golang-dev/Nk9gnTINlTg/SV8rBt-2__kJ

Change-Id: I49edd98d73400c1757b6085dec86752de569c01a
Reviewed-on: https://go-review.googlesource.com/8923
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: do not cover package unsafe
Rob Pike [Mon, 13 Apr 2015 21:58:44 +0000 (14:58 -0700)]
cmd/go: do not cover package unsafe

Even if requested, there is no .go file for unsafe - it comes from the
compiler - so referencing its cover variables will break the compilation
in a command like
go test -coverpkg=all fmt

Fixes #10408.

Change-Id: If92658ef6c29dc020f66ba30b02eaa796f7205e0
Reviewed-on: https://go-review.googlesource.com/8891
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/gc: fix crash during escape analysis
Dmitry Vyukov [Tue, 14 Apr 2015 09:46:15 +0000 (12:46 +0300)]
cmd/gc: fix crash during escape analysis

Fixes #10441

Compiler crashed as:

panic: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
cmd/internal/gc.haspointers(0x0, 0xffffffffffffffff)
    src/cmd/internal/gc/reflect.go:623 +0x1f
cmd/internal/gc.escwalk(0x20c82dc00, 0xffffffffffffffff, 0x20c82dda0, 0x20c835520)
    src/cmd/internal/gc/esc.go:1291 +0x14aa
cmd/internal/gc.escwalk(0x20c82dc00, 0xffffffffffffffff, 0x20c82dda0, 0x20beac340)
    src/cmd/internal/gc/esc.go:1386 +0x836

while evaluating haspointers of the fake OADDR node here:

leaks = level <= 0 && dst.Escloopdepth < src.Escloopdepth || level < 0 && dst == &e.funcParam && haspointers(src.Type)

Change-Id: I13c23fced52e8fcd0ae1df81b374df8632eb7790
Reviewed-on: https://go-review.googlesource.com/8932
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoruntime: make cgocallback wait on package init
David Crawshaw [Mon, 13 Apr 2015 23:31:39 +0000 (19:31 -0400)]
runtime: make cgocallback wait on package init

With the new buildmodes c-archive and c-shared, it is possible for a
cgo call to come in early in the lifecycle of a Go program. Calls
before the runtime has been initialized are caught by
_cgo_wait_runtime_init_done. However a call can come in after the
runtime has initialized, but before the program's package init
functions have finished running.

To avoid this cgocallback checks m.ncgo to see if we are on a thread
running Go. If not, we may be a foreign thread and it blocks until
main_init is complete.

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