]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
8 years ago[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge
Keith Randall [Mon, 29 Feb 2016 21:31:48 +0000 (13:31 -0800)]
[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge

(Last?) Semi-regular merge from tip to dev.ssa.

Conflicts:
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go
src/cmd/internal/obj/pass.go

Change-Id: Ib5ea8bf74d420f4902a9c6208761be9f22371ae7

8 years ago[dev.ssa] cmd/compile: add max arg length to opcodes
Todd Neal [Sat, 27 Feb 2016 14:04:48 +0000 (08:04 -0600)]
[dev.ssa] cmd/compile: add max arg length to opcodes

Add the max arg length to opcodes and use it in zcse.  Doesn't affect
speed, but allows better checking in checkFunc and removes the need
to keep a list of zero arg opcodes up to date.

Change-Id: I157c6587154604119720ec6228b767b6e52bb5c7
Reviewed-on: https://go-review.googlesource.com/19994
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/cgo: recognize known C typedefs as types
Ian Lance Taylor [Wed, 24 Feb 2016 00:11:46 +0000 (16:11 -0800)]
cmd/cgo: recognize known C typedefs as types

Fixes #14483.

Change-Id: I0cddfe27fd8d00ba85659d0b618410e39ebf45cb
Reviewed-on: https://go-review.googlesource.com/19860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: change Func.Cvars to the new Nodes type
Ian Lance Taylor [Sat, 27 Feb 2016 01:03:58 +0000 (17:03 -0800)]
cmd/compile: change Func.Cvars to the new Nodes type

Update #14473.

Change-Id: Iba1ecf42d9ab5a93144941439d5cc6b0b4f4a3ac
Reviewed-on: https://go-review.googlesource.com/19992
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agofmt: simplify buffer write methods and adjust calls to them
Martin Möhrmann [Sun, 21 Feb 2016 15:05:44 +0000 (16:05 +0100)]
fmt: simplify buffer write methods and adjust calls to them

Once upon a time fmt did use bytes.Buffer for its buffer.
The buffer write methods still mimic the bytes.Buffer signatures.
The current code depends on manipulating the buffer []bytes array directly
which makes going back to bytes.Buffer by only changing the type of buffer
impossible. Since type buffer is not exported the methods can be simplified
to the needs of fmt. This saves space and avoids unnecessary overhead.

Use WriteString instead of Write for known inputs since
WriteString is faster than Write to append the same data.
This also saves space in the binary.

Remove the add method from Printer and depending on the data to be written
use WriteRune or WriteByte directly instead.

In total makes the go binary around 4 kilobyte smaller.

name                  old time/op  new time/op  delta
SprintfEmpty-2        24.1ns ± 3%  23.8ns ± 1%  -1.14%  (p=0.000 n=20+20)
SprintfString-2        114ns ± 2%   114ns ± 4%    ~     (p=0.558 n=20+19)
SprintfInt-2           116ns ± 9%   118ns ± 7%    ~     (p=0.086 n=20+20)
SprintfIntInt-2        195ns ± 6%   193ns ± 5%    ~     (p=0.345 n=20+19)
SprintfPrefixedInt-2   251ns ±16%   241ns ± 9%  -3.69%  (p=0.024 n=20+19)
SprintfFloat-2         203ns ± 4%   205ns ± 5%    ~     (p=0.153 n=20+20)
SprintfBoolean-2       101ns ± 7%    96ns ±11%  -5.23%  (p=0.005 n=19+20)
ManyArgs-2             651ns ± 7%   628ns ± 7%  -3.44%  (p=0.002 n=20+20)
FprintInt-2            164ns ± 2%   158ns ± 2%  -3.62%  (p=0.000 n=20+18)
FprintfBytes-2         215ns ± 1%   216ns ± 1%  +0.58%  (p=0.000 n=20+20)
FprintIntNoAlloc-2     115ns ± 0%   112ns ± 0%  -2.61%  (p=0.000 n=20+20)
ScanInts-2             700µs ± 0%   702µs ± 1%  +0.38%  (p=0.000 n=18+20)
ScanRecursiveInt-2    82.7ms ± 0%  82.7ms ± 0%    ~     (p=0.820 n=20+20)

Change-Id: I0409eb170b8a26d9f4eb271f6292e5d39faf2d8b
Reviewed-on: https://go-review.googlesource.com/19955
Reviewed-by: Rob Pike <r@golang.org>
8 years agostrconv: Avoid allocation in AppendQuote*
Justin Nuß [Tue, 26 Jan 2016 20:14:35 +0000 (21:14 +0100)]
strconv: Avoid allocation in AppendQuote*

The current implementations of the AppendQuote functions use quoteWith
(through Quote) for quoting the given value and appends the returned
string to the dst byte slice. quoteWith internally creates a byte slice
on each call which gets converted to a string in Quote.

This means the AppendQuote functions always allocates a new byte slice
and a string only to append them to an existing byte slice. In the case
of (Append)QuoteRune the string passed to quoteWith will also needs to
be allocated from a rune first.

Split quoteWith into two functions (quoteWith and appendQuotedWith) and
replace the call to Quote inside AppendQuote with appendQuotedWith,
which appends directly to the byte slice passed to AppendQuote and also
avoids the []byte->string conversion.

Also introduce the 2 functions quoteRuneWith and appendQuotedRuneWith
that work the same way as quoteWith and appendQuotedWith, but take a
single rune instead of a string, to avoid allocating a new string when
appending a single rune, and use them in (Append)QuoteRune.

Also update the ToASCII and ToGraphic variants to use the new functions.

Benchmark results:

benchmark                      old ns/op     new ns/op     delta
BenchmarkQuote-8               428           503           +17.52%
BenchmarkQuoteRune-8           148           105           -29.05%
BenchmarkAppendQuote-8         435           307           -29.43%
BenchmarkAppendQuoteRune-8     158           23.5          -85.13%

benchmark                      old allocs     new allocs     delta
BenchmarkQuote-8               3              3              +0.00%
BenchmarkQuoteRune-8           3              2              -33.33%
BenchmarkAppendQuote-8         3              0              -100.00%
BenchmarkAppendQuoteRune-8     3              0              -100.00%

benchmark                      old bytes     new bytes     delta
BenchmarkQuote-8               144           144           +0.00%
BenchmarkQuoteRune-8           16            16            +0.00%
BenchmarkAppendQuote-8         144           0             -100.00%
BenchmarkAppendQuoteRune-8     16            0             -100.00%

Change-Id: I77c148d5c7242f1b0edbbeeea184878abb51a522
Reviewed-on: https://go-review.googlesource.com/18962
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocrypto/tls: don't send IPv6 literals and absolute FQDNs as SNI values
Mikio Hara [Fri, 19 Feb 2016 07:25:52 +0000 (16:25 +0900)]
crypto/tls: don't send IPv6 literals and absolute FQDNs as SNI values

This is a followup change to #13111 for filtering out IPv6 literals and
absolute FQDNs from being as the SNI values.

Updates #13111.
Fixes #14404.

Change-Id: I09ab8d2a9153d9a92147e57ca141f2e97ddcef6e
Reviewed-on: https://go-review.googlesource.com/19704
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agofmt: change padding functions to avoid package init
Martin Möhrmann [Sat, 20 Feb 2016 00:51:32 +0000 (01:51 +0100)]
fmt: change padding functions to avoid package init

Move the decision if zero padding is allowed to doPrintf
where the other formatting decisions are made.

Removes some dead code for negative f.wid that was never used
due to f.wid always being positive and f.minus deciding if left
or right padding should be used.

New padding code writes directly into the buffer and is as fast
as the old version but avoids the cost of needing package init.

name              old time/op  new time/op  delta
SprintfPadding-2   246ns ± 5%   245ns ± 4%   ~     (p=0.345 n=50+47)

Change-Id: I7dfddbac8e328f4ef0cdee8fafc0d06c784b2711
Reviewed-on: https://go-review.googlesource.com/19957
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile: remove unneeded test binary
Matthew Dempsky [Sat, 27 Feb 2016 05:50:44 +0000 (21:50 -0800)]
cmd/compile: remove unneeded test binary

Accidentally added in https://golang.org/cl/19968.

Change-Id: Id70917c4d1f69db149688d797c90a19557d16f72
Reviewed-on: https://go-review.googlesource.com/19985
Reviewed-by: Minux Ma <minux@golang.org>
8 years agodebug/gosym: fix TestPCLine on Plan 9
David du Colombier [Fri, 26 Feb 2016 23:49:08 +0000 (00:49 +0100)]
debug/gosym: fix TestPCLine on Plan 9

Plan 9 doesn't define main, so the INITENTRY
symbol remains with the SXREF type, which leads
Entryvalue to fail on "entry not text: main".

Fixes #14536.

Change-Id: Id9b7d61e5c2202aba3ec9cd52f5b56e0a38f7c47
Reviewed-on: https://go-review.googlesource.com/19973
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years ago[dev.ssa] cmd/compile: with -N, don't put JMPs after calls
Keith Randall [Sat, 27 Feb 2016 00:32:01 +0000 (16:32 -0800)]
[dev.ssa] cmd/compile: with -N, don't put JMPs after calls

plive doesn't like the fact that we put JMPs right
after CALL ops to select{send,recv}.

Fixes SSA -N build.

Change-Id: I9b3c9e5293196094fd5a6206dd2f99784951f7a9
Reviewed-on: https://go-review.googlesource.com/19982
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agodoc: go1.7.txt updates
Brad Fitzpatrick [Sat, 27 Feb 2016 01:22:53 +0000 (01:22 +0000)]
doc: go1.7.txt updates

Change-Id: I6ac3d11ee8896f636235fe10c2556f93584019b5
Reviewed-on: https://go-review.googlesource.com/19984
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: simplify lexinit and lexfini
Matthew Dempsky [Fri, 26 Feb 2016 10:10:29 +0000 (02:10 -0800)]
cmd/compile: simplify lexinit and lexfini

Split the syms array into separate basicTypes and builtinFuncs arrays.

Also, in lexfini, instead of duplicating the code from lexinit to
declare the builtin identifiers in the user package, just import them
from builtinpkg like how importdot works.

Change-Id: Ic3b3b454627a46f7bd5f290d0e31443e659d431f
Reviewed-on: https://go-review.googlesource.com/19936
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agocmd/compile: change Func.{Enter,Exit} from NodeList to slice
Ian Lance Taylor [Fri, 26 Feb 2016 22:28:48 +0000 (14:28 -0800)]
cmd/compile: change Func.{Enter,Exit} from NodeList to slice

Introduces a new types Nodes that can be used to replace NodeList.

Update #14473.

Change-Id: Id77c5dcae0cbeb898ba12dd46bd400aad408871c
Reviewed-on: https://go-review.googlesource.com/19969
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agofmt: use public io.RuneScanner interface for ScanState reader
Martin Möhrmann [Wed, 24 Feb 2016 22:22:40 +0000 (23:22 +0100)]
fmt: use public io.RuneScanner interface for ScanState reader

All io.Reader that are passed to newScanState in all the standard
library tests that implement io.RuneReader also implement io.RuneScanner.

Do not check on each call ScanState's UnreadRune that the used RuneReader
also implements the UnreadRune method by using a private interface.
Instead require the used Reader to implement the public RuneScanner
interface.

The extra implementation logic for UnreadRune is removed from ScanState.
Instead the readRune wrapper is extended to implement UnreadRune for the
RuneScanner interface. If the Reader passed to newScanstate does not
implement RuneScanner the readRune wrapper is used to implement the
missing functionality.

Note that a RuneReader that does not implement RuneScanner will also
be wrapped by runeRead which was not the case before.
Performance with the readRune wrapper is better than without before.

Add benchmark to compare performance with and without using the
readRune wrapper.

name                             old time/op  new time/op  delta
ScanInts-2                        704µs ± 0%   615µs ± 1%  -12.73%  (p=0.000 n=20+20)
ScanRecursiveInt-2               82.6ms ± 0%  51.4ms ± 0%  -37.71%  (p=0.000 n=20+20)
ScanRecursiveIntReaderWrapper-2  85.1ms ± 0%  52.4ms ± 0%  -38.36%  (p=0.000 n=20+20)

Change-Id: I8c6e85db9b87a8171caab12f020b6e256b498e81
Reviewed-on: https://go-review.googlesource.com/19895
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile: consolidate alg code
Josh Bleecher Snyder [Fri, 26 Feb 2016 22:56:31 +0000 (14:56 -0800)]
cmd/compile: consolidate alg code

Pull all alg-related code into its own file.
subr.go is a Hobbesian Leviathan.

100% code movement. Cleanup and improvements to follow.

Change-Id: Ib9c8f66563fdda90c6e8cf646d366a9487a4648d
Reviewed-on: https://go-review.googlesource.com/19980
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile: eliminate prectab
Matthew Dempsky [Fri, 26 Feb 2016 01:27:10 +0000 (17:27 -0800)]
cmd/compile: eliminate prectab

While here, merge LINC and LDEC into LINCOP.

Fixes #13244.

Change-Id: I8ea426f986d60d35c3b1a80c056a7aa49d22d802
Reviewed-on: https://go-review.googlesource.com/19928
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agocmd/compile: change Func.Inldcl from []*Node to *[]*Node
Ian Lance Taylor [Fri, 26 Feb 2016 21:48:24 +0000 (13:48 -0800)]
cmd/compile: change Func.Inldcl from []*Node to *[]*Node

Save a few bytes in Func.

Passes toolstash -cmp.

Update #14473.

Change-Id: I824fa7d5cb2d93f6f59938ccd86114abcbea0043
Reviewed-on: https://go-review.googlesource.com/19968
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: convert Func.Cvars from *NodeList to *[]*Node
Ian Lance Taylor [Fri, 26 Feb 2016 21:33:48 +0000 (13:33 -0800)]
cmd/compile: convert Func.Cvars from *NodeList to *[]*Node

Passes toolstash -cmp.

Update #14473.

Change-Id: I7285175b1992a29033fdc9e81d6f30545e5cc30d
Reviewed-on: https://go-review.googlesource.com/19967
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: recognize more memory runs in generated algs
Josh Bleecher Snyder [Mon, 22 Feb 2016 05:12:36 +0000 (21:12 -0800)]
cmd/compile: recognize more memory runs in generated algs

The old implementation assumed that all memory runs
were terminated by non-memory fields.
This isn't necessarily so.
They might be terminated by padding or blank fields.

For example, given

type T struct {
a int64
b byte
c, d, e int64
}

the old implementation did a memory comparison on a+b, on c, and on d+e.

Instead, check for memory runs at the beginning of every round.
This now generates a memory comparison on a+b and on c+d+e.

Also, delete some now-dead code.

Change-Id: I66bffb111420adf6919bd708e4fb3a1e1f07fadd
Reviewed-on: https://go-review.googlesource.com/19841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agocmd/compile: factor shared code from geneq and genhash
Josh Bleecher Snyder [Sun, 21 Feb 2016 23:49:52 +0000 (15:49 -0800)]
cmd/compile: factor shared code from geneq and genhash

Passes toolstash -cmp.

Change-Id: Ifae69e5ba673f01da3dfc1fd30cdc51873481623
Reviewed-on: https://go-review.googlesource.com/19840
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agocmd/compile: track pragmas in lexer rather than global variables
Robert Griesemer [Fri, 26 Feb 2016 21:32:28 +0000 (13:32 -0800)]
cmd/compile: track pragmas in lexer rather than global variables

By using a Pragma bit set (8 bits) rather than 8 booleans, also
reduce Func type size by 8 bytes (208B -> 200B on 64bit platforms,
116B -> 108B on 32bit platforms).

Change-Id: Ibb7e1f8c418a0b5bc6ff813cbdde7bc6f0013b5a
Reviewed-on: https://go-review.googlesource.com/19966
Reviewed-by: Dave Cheney <dave@cheney.net>
8 years agocmd/compile: stop representing keywords as Syms
Matthew Dempsky [Fri, 26 Feb 2016 09:37:28 +0000 (01:37 -0800)]
cmd/compile: stop representing keywords as Syms

Instead add a dedicated keywords map for use in lexer.ident and drop
Sym's Lexical field.

Change-Id: Ia668e65499035ff7167fabbbd0cd027102b21231
Reviewed-on: https://go-review.googlesource.com/19935
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile: fix contrived line number errors
Matthew Dempsky [Fri, 26 Feb 2016 06:10:48 +0000 (22:10 -0800)]
cmd/compile: fix contrived line number errors

If a general comment contains multiple newline characters, we can't
simply unread one and then re-lex it via the general whitespace lexing
phase, because then we'll reset lineno to the line before the "*/"
marker, rather than keeping it where we found the "/*" marker.

Also, for processing imports, call importfile before advancing the
lexer with p.next(), so that lineno reflects the line where we found
the import path, and not the token afterwards.

Fixes #14520.

Change-Id: I785a2d83d632280113d4b757de0d57c88ba2caf4
Reviewed-on: https://go-review.googlesource.com/19934
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile: create test binary in temp directory
Ian Lance Taylor [Fri, 26 Feb 2016 21:05:35 +0000 (13:05 -0800)]
cmd/compile: create test binary in temp directory

The new TestDashS was leaving a dreg "test" file in
cmd/compile/internal/gc.  Create it in the temporary directory instead.

Also change path.Join to filepath.Join throughout global_test.go.

Change-Id: Ib7707fada2b3ab5e8abc2ba74e4c402821c1408b
Reviewed-on: https://go-review.googlesource.com/19965
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agocmd/compile: change Func.{Dcl,Inldcl} from NodeList to slice
Ian Lance Taylor [Thu, 25 Feb 2016 18:35:19 +0000 (10:35 -0800)]
cmd/compile: change Func.{Dcl,Inldcl} from NodeList to slice

A slice uses less memory than a NodeList, and has better memory locality
when walking the list.

This uncovered a tricky case involving closures: the escape analysis
pass when run on a closure was appending to the Dcl list of the OCLOSURE
rather than the ODCLFUNC.  This happened to work because they shared the
same NodeList.  Fixed with a change to addrescapes, and a check to
Tempname to catch any recurrences.

This removes the last use of the listsort function outside of tests.
I'll send a separate CL to remove it.

Unfortunately, while this passes all tests, it does not pass toolstash
-cmp.  The problem is that cmpstackvarlt does not fully determine the
sort order, and the change from listsort to sort.Sort, while generally
desirable, produces a different ordering.  I could stage this by first
making cmpstackvarlt fully determined, but no matter what toolstash -cmp
is going to break at some point.

In my casual testing the compiler is 2.2% faster.

Update #14473.

Change-Id: I367d66daa4ec73ed95c14c66ccda3a2133ad95d5
Reviewed-on: https://go-review.googlesource.com/19919
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd: stop looking for __.(GO)?SYMDEF entries in archives
Matthew Dempsky [Thu, 25 Feb 2016 22:58:03 +0000 (14:58 -0800)]
cmd: stop looking for __.(GO)?SYMDEF entries in archives

The Go toolchain stopped creating them before Go 1.3, so no point in
worrying about them today.

History:

- Git commit 250a091 added cmd/ar, which wrote Plan 9 __.SYMDEF
entries into archive files.

- golang.org/cl/6500117 renamed __.SYMDEF to __.GOSYMDEF.  (Notably,
the commit message suggests users need to use Go nm to read symbols,
but even back then the toolchain did nothing with __.(GO)?SYMDEF files
except skip over them.)

- golang.org/cl/42880043 added the -pack flag to cmd/gc to directly
produce archives by the Go compiler, and did not write __.GOSYMDEF
entries.

- golang.org/cl/52310044 rewrote cmd/pack in Go, and removed support
for producing __.GOSYMDEF entries.

Change-Id: I255edf40d0d3690e3447e488039fcdef73c6d6b1
Reviewed-on: https://go-review.googlesource.com/19924
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosync/atomic: new file for plan9_arm support
Richard Miller [Wed, 27 Jan 2016 16:18:34 +0000 (16:18 +0000)]
sync/atomic: new file for plan9_arm support

Atomic load/store/add/swap routines, as for other ARM platforms, but with DMB inserted
for load/store (assuming that "atomic" also implies acquire/release memory ordering).

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

8 years agocmd/go: show position in error for wrong signature in test functions
Caio Marcelo de Oliveira Filho [Fri, 26 Feb 2016 19:09:54 +0000 (16:09 -0300)]
cmd/go: show position in error for wrong signature in test functions

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

8 years agotesting/quick: generate more map and slice states
Matt T. Proud [Thu, 29 Oct 2015 10:14:05 +0000 (11:14 +0100)]
testing/quick: generate more map and slice states

This change adds support in testing/quick to generate maps and slices
in additional states:

  (1.) nil maps

  (2.) nil slices

  (3.) empty slice occupancy: `len(s) == 0 && s != nil`

  (4.) partial slice occupancy: `len(s) < cap(s) && s != nil`

  (5.) full slice occupancy: `len(s) == cap(s) && s != nil`

Prior to this, only #5 was ever generated, thereby not sufficiently
exercising all of the fuzzable code path outcomes.

This change depends on https://go-review.googlesource.com/#/c/17499/.

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

8 years agosyscall: new files for plan_arm support
Richard Miller [Wed, 27 Jan 2016 16:36:31 +0000 (16:36 +0000)]
syscall: new files for plan_arm support

Implementation closely follows plan9_386 version.

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

8 years agocrypto/rand: use the getentropy syscall on OpenBSD
Michael McConville [Sun, 3 Jan 2016 01:50:57 +0000 (20:50 -0500)]
crypto/rand: use the getentropy syscall on OpenBSD

Go already supports Linux's getrandom, which is a slightly modified
version of getentropy.

getentropy was added in OpenBSD 5.6. All supported versions of OpenBSD
include it so, unlike with Linux and getrandom, we don't need to test
for its presence.

Fixes #13785.

Change-Id: Ib536b96675f257cd8c5de1e3a36165e15c9abac9
Reviewed-on: https://go-review.googlesource.com/18219
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agomisc/cgo: fix wrong quote character
Jeff R. Allen [Sun, 16 Aug 2015 12:59:23 +0000 (14:59 +0200)]
misc/cgo: fix wrong quote character

Single quotes to not expand variables inside of them.

Change-Id: I4a0622c0aebfc1c3f9d299f93f7a8253893b5858
Reviewed-on: https://go-review.googlesource.com/13661
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/internal/obj: Fix generation of assembly with -S
Keith Randall [Fri, 26 Feb 2016 03:17:55 +0000 (19:17 -0800)]
cmd/internal/obj: Fix generation of assembly with -S

We can't drop Prog entries when we want to print disassembly.

Added a test for -S.

Fixes #14515

Change-Id: I44c72f70f7a3919acc01c559d30335d26669e76f
Reviewed-on: https://go-review.googlesource.com/19930
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: more deflaking of TestCgoCheckBytes
Ian Lance Taylor [Fri, 26 Feb 2016 05:16:45 +0000 (21:16 -0800)]
runtime: more deflaking of TestCgoCheckBytes

Fixes #14519.

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

8 years ago[dev.ssa] test: remove extra tests from non-SSA builds
Keith Randall [Fri, 26 Feb 2016 19:01:14 +0000 (11:01 -0800)]
[dev.ssa] test: remove extra tests from non-SSA builds

non-SSA backends are all over the map as to whether nil checks
get removed or not.  amd64, 386, 386/387, arm are all subtly different.
Remove these extra checks for now, they are in nilptr3_ssa.go so they
won't get lost.

Change-Id: I2e0051f488fb2cb7278c6fdd44cb9d68b5778345
Reviewed-on: https://go-review.googlesource.com/19961
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agomisc/git: Fix non-literal period in pre-commit grep
Derek Shockey [Wed, 24 Feb 2016 05:17:25 +0000 (21:17 -0800)]
misc/git: Fix non-literal period in pre-commit grep

Looks like this was intended to match a literal period to restrict
this to `.go` files, but in POSIX grep, the unescaped period matches
any character.

Change-Id: I20e00323baa9e9631792eff5035966297665bbee
Reviewed-on: https://go-review.googlesource.com/19880
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/go: better error for test functions with wrong signature
Caio Marcelo de Oliveira Filho [Sat, 20 Feb 2016 20:36:03 +0000 (18:36 -0200)]
cmd/go: better error for test functions with wrong signature

Check the function types before compiling the tests. Extend the same
approach taken by the type check used for TestMain function.

To keep existing behavior, wrong arguments for TestMain are ignored
instead of causing an error.

Fixes #14226.

Change-Id: I488a2555cddb273d35c1a8c4645bb5435c9eb91d
Reviewed-on: https://go-review.googlesource.com/19763
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosync/atomic: reduce test in short mode
Dmitry Vyukov [Fri, 26 Feb 2016 15:14:31 +0000 (16:14 +0100)]
sync/atomic: reduce test in short mode

In normal mode the test runs for 9+ seconds on my machine (48 cores).
But the real problem is race mode, in race mode it hits 10m test timeout.
Reduce test size in short mode. Now it runs for 100ms without race.

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

8 years agonet/url: support query string without values
Rick Arnold [Fri, 26 Feb 2016 03:24:07 +0000 (22:24 -0500)]
net/url: support query string without values

Previously, RawQuery was used to indicate the presence of a query
string in url.URL. However, this approach was not able to differentiate
between URLs that have no query string at all (http://foo.bar/) and
those that have a query with no values (http://foo.bar/?).

Add a ForceQuery field to indicate the latter form of URL and use it
in URL.String to create a matching URL with a trailing '?'.

Fixes #13488

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

8 years agoruntime: unwire g/m in dropg always
Dmitry Vyukov [Fri, 26 Feb 2016 09:43:09 +0000 (10:43 +0100)]
runtime: unwire g/m in dropg always

Currently dropg does not unwire locked g/m.
This is unnecessary distiction between locked and non-locked g/m.
We always restart goroutines with execute which re-wires g/m.

First, this produces false sense that this distinction is necessary.
Second, it can confuse some sanity and cross checks. For example,
if we check that g/m are unwired before we wire them in execute,
the check will fail for locked g/m. I've hit this while doing some
race detector changes, When we deschedule a goroutine and run
scheduler code, m.curg is generally nil, but not for locked ms.

Remove the distinction.

Change-Id: I3b87a28ff343baa1d564aab1f821b582a84dee07
Reviewed-on: https://go-review.googlesource.com/19950
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: remove workbuf logging
Austin Clements [Fri, 26 Feb 2016 02:01:16 +0000 (21:01 -0500)]
runtime: remove workbuf logging

Early in Go 1.5 we had bugs with ownership of workbufs, so we added a
system for tracing their ownership to help debug these issues.
However, this system has both CPU and space overhead even when
disabled, it clutters up the workbuf API, the higher level gcWork
abstraction makes it very difficult to mess up the ownership of
workbufs in practice, and the tracing hasn't been enabled or needed
since 5b66e5d nine months ago. Hence, remove it.

Benchmarks show the usual noise from changes at this level, but little
overall movement.

name              old time/op  new time/op  delta
XBenchGarbage-12  2.48ms ± 1%  2.47ms ± 0%  -0.68%  (p=0.000 n=21+21)

name                      old time/op    new time/op    delta
BinaryTree17-12              2.98s ± 7%     2.98s ± 6%    ~     (p=0.799 n=20+20)
Fannkuch11-12                2.61s ± 3%     2.55s ± 5%  -2.55%  (p=0.003 n=20+20)
FmtFprintfEmpty-12          52.8ns ± 6%    53.6ns ± 6%    ~     (p=0.228 n=20+20)
FmtFprintfString-12          177ns ± 4%     177ns ± 4%    ~     (p=0.280 n=20+20)
FmtFprintfInt-12             162ns ± 5%     162ns ± 3%    ~     (p=0.347 n=20+20)
FmtFprintfIntInt-12          277ns ± 7%     273ns ± 4%  -1.62%  (p=0.005 n=20+20)
FmtFprintfPrefixedInt-12     237ns ± 4%     242ns ± 4%  +2.13%  (p=0.005 n=20+20)
FmtFprintfFloat-12           315ns ± 4%     312ns ± 4%  -0.97%  (p=0.001 n=20+20)
FmtManyArgs-12              1.11µs ± 3%    1.15µs ± 4%  +3.41%  (p=0.004 n=20+20)
GobDecode-12                8.50ms ± 7%    8.53ms ± 7%    ~     (p=0.429 n=20+20)
GobEncode-12                6.86ms ± 9%    6.93ms ± 7%  +0.93%  (p=0.030 n=20+20)
Gzip-12                      326ms ± 4%     329ms ± 4%  +0.98%  (p=0.020 n=20+20)
Gunzip-12                   43.3ms ± 3%    43.8ms ± 9%  +1.25%  (p=0.003 n=20+20)
HTTPClientServer-12         72.0µs ± 3%    71.5µs ± 3%    ~     (p=0.053 n=20+20)
JSONEncode-12               17.0ms ± 6%    17.3ms ± 7%  +1.32%  (p=0.006 n=20+20)
JSONDecode-12               64.2ms ± 4%    63.5ms ± 3%  -1.05%  (p=0.005 n=20+20)
Mandelbrot200-12            4.00ms ± 3%    3.99ms ± 3%    ~     (p=0.121 n=20+20)
GoParse-12                  3.74ms ± 5%    3.75ms ± 9%    ~     (p=0.383 n=20+20)
RegexpMatchEasy0_32-12       104ns ± 4%     104ns ± 6%    ~     (p=0.392 n=20+20)
RegexpMatchEasy0_1K-12       358ns ± 3%     361ns ± 4%  +0.95%  (p=0.003 n=20+20)
RegexpMatchEasy1_32-12      86.3ns ± 5%    86.1ns ± 6%    ~     (p=0.614 n=20+20)
RegexpMatchEasy1_1K-12       523ns ± 4%     518ns ± 3%  -1.14%  (p=0.008 n=20+20)
RegexpMatchMedium_32-12      137ns ± 3%     134ns ± 4%  -1.90%  (p=0.005 n=20+20)
RegexpMatchMedium_1K-12     41.0µs ± 3%    40.6µs ± 4%  -1.11%  (p=0.004 n=20+20)
RegexpMatchHard_32-12       2.13µs ± 4%    2.11µs ± 5%  -1.31%  (p=0.014 n=20+20)
RegexpMatchHard_1K-12       64.1µs ± 3%    63.2µs ± 5%  -1.38%  (p=0.005 n=20+20)
Revcomp-12                   555ms ±10%     548ms ± 7%  -1.17%  (p=0.011 n=20+20)
Template-12                 84.2ms ± 5%    88.2ms ± 4%  +4.73%  (p=0.000 n=20+20)
TimeParse-12                 365ns ± 4%     371ns ± 5%  +1.77%  (p=0.002 n=20+20)
TimeFormat-12                361ns ± 4%     365ns ± 3%  +1.08%  (p=0.002 n=20+20)
[Geo mean]                  64.7µs         64.8µs       +0.19%

Change-Id: Ib043a7a0d18b588b298873d60913d44cd19f3b44
Reviewed-on: https://go-review.googlesource.com/19887
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agocmd/compile: remove uncommonType.name
David Crawshaw [Wed, 17 Feb 2016 18:03:21 +0000 (13:03 -0500)]
cmd/compile: remove uncommonType.name

Reduces binary size of cmd/go by 0.5%.
For #6853.

Change-Id: I5a4b814049580ab5098ad252d979f80b70d8a5f9
Reviewed-on: https://go-review.googlesource.com/19694
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocrypto/x509: better documentation for ParsePKIXPublicKey
Datong Sun [Sat, 20 Feb 2016 08:39:07 +0000 (02:39 -0600)]
crypto/x509: better documentation for ParsePKIXPublicKey

The existing documentation for ParsePKIXPublicKey is difficult to understand
and the return type of the parsed public key are not mentioned explicitly.

Descriptions about types of public key supported, as well as an example on
how to use type assertions to determine return type of a parsed public key
has been added.

Fixes #14355

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

8 years agocmd/compile, go/parser: simpler binary expression parsing
Matthew Dempsky [Fri, 26 Feb 2016 01:16:42 +0000 (17:16 -0800)]
cmd/compile, go/parser: simpler binary expression parsing

The existing nested loops are too tricky for me to grok and don't seem
necessary.

Change-Id: I75c65c8470b799d6f4cfb05bb1b4796c5d7d32e7
Reviewed-on: https://go-review.googlesource.com/19927
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years ago[dev.ssa] cmd/compile: get rid of nil checks before float loads/stores
Keith Randall [Thu, 25 Feb 2016 21:45:22 +0000 (13:45 -0800)]
[dev.ssa] cmd/compile: get rid of nil checks before float loads/stores

Just like we do for integer loads/stores.

Update #14511

Change-Id: Ic6ca6b54301438a5701ea5fb0be755451cb24d45
Reviewed-on: https://go-review.googlesource.com/19923
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>

8 years agobuild: use go tool dist list
Shenghou Ma [Thu, 25 Feb 2016 05:52:16 +0000 (00:52 -0500)]
build: use go tool dist list

Change-Id: I9b79bd301d0b75ca1f16d4a05e3cb687a8428c14
Reviewed-on: https://go-review.googlesource.com/19884
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: add issue and pull request templates
Andrew Gerrand [Fri, 26 Feb 2016 03:05:16 +0000 (14:05 +1100)]
doc: add issue and pull request templates

Fixes #14365

Change-Id: I082329fe7a1e06c774a32e0e24e5c8736bb5a037
Reviewed-on: https://go-review.googlesource.com/19877
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: simplify error sorting
Matthew Dempsky [Fri, 26 Feb 2016 02:17:31 +0000 (18:17 -0800)]
cmd/compile: simplify error sorting

Errors have unique seq values (their index within the errors slice),
so errcmp never needs to fallback to sorting by message text.
Moreover, comparing by original index is exactly the purpose of using
a stable sort algorithm (and sort.Stable was added in Go 1.2), so we
really only need to compare by lineno.

Change-Id: I7f534b72a05d899ae9788dc7ef0541dd92a8b578
Reviewed-on: https://go-review.googlesource.com/19929
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: rationalize (lex)?lineno handling
Matthew Dempsky [Fri, 26 Feb 2016 00:07:04 +0000 (16:07 -0800)]
cmd/compile: rationalize (lex)?lineno handling

Previously, many error messages inconsistantly used either lexlineno
and lineno.  In general this works out okay because they're almost
always the same.  The only exceptional case is after lexing a
multi-line raw string literal, where lineno will be the line number of
the opening quote and lexlineno is the line number of the closing
quote.

This CL makes the compiler's error message more consistent:

- Lexer error messages related to invalid byte sequences (i.e., NUL
bytes, bad UTF-8 sequences, and non-initial BOMs) are emitted at
lexlineno (i.e., the source line that contains the invalid byte
sequence).

- All other error messages (notably the parser's "syntax errors") now
use lineno.  The minor change from this is that bogus input like:

    package `
    bogus`

will emit "syntax error: unexpected string literal, expecting name"
error at line 1, instead of line 2.

- Instead of maintaining prevlineno all the time, just record it
when/where actually needed and not already available elsewhere (which
turns out to be just one function).

- Lastly, we remove the legacy "syntax error near ..." fallback in
Yerror, now that the parser always emits more detailed syntax error
messages.

Change-Id: Iaf5f784223d0385fa3a5b09ef2b2ad447feab02f
Reviewed-on: https://go-review.googlesource.com/19925
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime: avoid using REP prefix for IndexByte
Keith Randall [Sat, 16 Jan 2016 02:17:09 +0000 (18:17 -0800)]
runtime: avoid using REP prefix for IndexByte

REP-prefixed instructions have a large startup cost.
Avoid them like the plague.

benchmark                  old ns/op     new ns/op     delta
BenchmarkIndexByte10-8     22.4          5.34          -76.16%

Fixes #13983

Change-Id: I857e956e240fc9681d053f2584ccf24c1b272bb3
Reviewed-on: https://go-review.googlesource.com/18703
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/dist: don't run fortran test if fortran compilation fails
kortschak [Thu, 25 Feb 2016 07:09:45 +0000 (17:39 +1030)]
cmd/dist: don't run fortran test if fortran compilation fails

Fixes #14498.

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

8 years agoruntime: eliminate unused _Genqueue state
Austin Clements [Thu, 18 Feb 2016 14:38:49 +0000 (09:38 -0500)]
runtime: eliminate unused _Genqueue state

_Genqueue and _Gscanenqueue were introduced as part of the GC quiesce
code. The quiesce code was removed by 197aa9e, but these states and
some associated code stuck around. Remove them.

Change-Id: I69df81881602d4a431556513dac2959668d27c20
Reviewed-on: https://go-review.googlesource.com/19638
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: eliminate a conditional branch from heapBits.bits
Austin Clements [Thu, 21 Jan 2016 18:44:16 +0000 (13:44 -0500)]
runtime: eliminate a conditional branch from heapBits.bits

Change-Id: I1fa5e629b2890a8509559ce4ea17b74f47d71925
Reviewed-on: https://go-review.googlesource.com/19637
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: use only per-P gcWork
Austin Clements [Mon, 23 Nov 2015 23:45:18 +0000 (18:45 -0500)]
runtime: use only per-P gcWork

Currently most uses of gcWork use the per-P gcWork, but there are two
places that still use a stack-based gcWork. Simplify things by making
these instead use the per-P gcWork.

Change-Id: I712d012cce9dd5757c8541824e9641ac1c2a329c
Reviewed-on: https://go-review.googlesource.com/19636
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: pass gcWork to markroot
Austin Clements [Mon, 23 Nov 2015 23:44:03 +0000 (18:44 -0500)]
runtime: pass gcWork to markroot

Currently markroot uses a gcWork on the stack and disposes of it
immediately after marking one root. This used to be necessary because
markroot was called from the depths of parfor, but now that we call it
directly and have ready access to a gcWork at the call site, pass the
gcWork in, use it directly in markroot, and share it across calls to
markroot from the same P.

Change-Id: Id7c3b811bfb944153760e01873c07c8d18909be1
Reviewed-on: https://go-review.googlesource.com/19635
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

8 years agoruntime: remove noescape hacks from gcWork
Austin Clements [Tue, 9 Feb 2016 23:37:41 +0000 (18:37 -0500)]
runtime: remove noescape hacks from gcWork

When gcWork was first introduced, the compiler's escape analysis
wasn't good enough to detect that that method receiver didn't escape,
so we had to hack around this.

Now that the compiler can figure out this for itself, remove these
hacks.

Change-Id: I9f73fab721e272410b8b6905b564e7abc03c0dfe
Reviewed-on: https://go-review.googlesource.com/19634
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: remove unnecessary clears of the heap bitmap
Austin Clements [Tue, 9 Feb 2016 23:30:38 +0000 (18:30 -0500)]
runtime: remove unnecessary clears of the heap bitmap

Currently we clear the heap bitmap of a span both when we allocate
that span *and* when we free it. There's no point in doing both, and
we definitely have to write the heap bitmap when we allocate a span
for pointer-sized objects, so switch to clearing only when we allocate
a span.

This results in a slight overall performance improvement; however,
most of the benchmarks that get slower are very short, while the
longer benchmarks generally got faster.

name              old time/op  new time/op  delta
XBenchGarbage-12  2.48ms ± 1%  2.47ms ± 1%  -0.58%  (p=0.000 n=91+91)

name                      old time/op    new time/op    delta
BinaryTree17-12              2.85s ± 2%     2.85s ± 2%    ~     (p=0.550 n=20+19)
Fannkuch11-12                2.54s ± 0%     2.47s ± 1%  -2.72%  (p=0.000 n=19+18)
FmtFprintfEmpty-12          51.3ns ± 4%    51.0ns ± 3%    ~     (p=0.223 n=20+20)
FmtFprintfString-12          169ns ± 0%     167ns ± 0%  -1.18%  (p=0.000 n=17+16)
FmtFprintfInt-12             160ns ± 0%     161ns ± 0%  +0.63%  (p=0.000 n=16+15)
FmtFprintfIntInt-12          267ns ± 0%     269ns ± 1%  +0.62%  (p=0.000 n=17+20)
FmtFprintfPrefixedInt-12     234ns ± 1%     240ns ± 0%  +2.80%  (p=0.000 n=20+20)
FmtFprintfFloat-12           316ns ± 0%     313ns ± 0%  -0.76%  (p=0.000 n=20+19)
FmtManyArgs-12              1.04µs ± 0%    1.05µs ± 0%  +0.45%  (p=0.000 n=19+16)
GobDecode-12                7.90ms ± 1%    7.81ms ± 0%  -1.10%  (p=0.000 n=18+18)
GobEncode-12                6.61ms ± 1%    6.58ms ± 0%  -0.46%  (p=0.000 n=20+15)
Gzip-12                      320ms ± 1%     322ms ± 1%  +0.47%  (p=0.030 n=20+20)
Gunzip-12                   42.4ms ± 1%    42.6ms ± 0%  +0.37%  (p=0.000 n=20+20)
HTTPClientServer-12         70.7µs ± 1%    70.6µs ± 2%    ~     (p=0.784 n=18+20)
JSONEncode-12               16.9ms ± 1%    16.8ms ± 0%  -0.64%  (p=0.000 n=20+20)
JSONDecode-12               60.8ms ± 0%    58.6ms ± 1%  -3.50%  (p=0.000 n=17+18)
Mandelbrot200-12            3.92ms ± 0%    3.91ms ± 0%  -0.25%  (p=0.000 n=19+19)
GoParse-12                  3.65ms ± 0%    3.68ms ± 1%  +0.67%  (p=0.000 n=17+16)
RegexpMatchEasy0_32-12       102ns ± 1%     102ns ± 2%  +0.67%  (p=0.009 n=19+19)
RegexpMatchEasy0_1K-12       350ns ± 0%     351ns ± 1%  +0.34%  (p=0.002 n=20+20)
RegexpMatchEasy1_32-12      84.1ns ± 2%    84.2ns ± 2%    ~     (p=0.799 n=20+18)
RegexpMatchEasy1_1K-12       510ns ± 1%     508ns ± 1%  -0.45%  (p=0.000 n=20+17)
RegexpMatchMedium_32-12      132ns ± 1%     134ns ± 1%  +0.85%  (p=0.000 n=20+19)
RegexpMatchMedium_1K-12     40.0µs ± 1%    39.9µs ± 1%  -0.29%  (p=0.014 n=19+18)
RegexpMatchHard_32-12       2.09µs ± 1%    2.05µs ± 0%  -1.76%  (p=0.000 n=20+18)
RegexpMatchHard_1K-12       62.7µs ± 1%    61.8µs ± 1%  -1.39%  (p=0.000 n=20+19)
Revcomp-12                   541ms ± 1%     534ms ± 0%  -1.16%  (p=0.000 n=19+20)
Template-12                 71.1ms ± 0%    69.1ms ± 0%  -2.83%  (p=0.000 n=18+19)
TimeParse-12                 356ns ± 0%     357ns ± 0%  +0.36%  (p=0.000 n=17+19)
TimeFormat-12                358ns ± 0%     372ns ± 1%  +3.74%  (p=0.000 n=15+18)
[Geo mean]                  62.6µs         62.5µs       -0.25%

Change-Id: Ied190b77c7a4d91ec7b2218c592fc31cf7acf362
Reviewed-on: https://go-review.googlesource.com/19633
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: document non-obvious requirement on sudog.elem
Austin Clements [Mon, 15 Feb 2016 21:50:12 +0000 (16:50 -0500)]
runtime: document non-obvious requirement on sudog.elem

The channel code must not allow stack splits between when it assigns a
potential stack pointer to sudog.elem (or sudog.selectdone) and when
it makes the sudog visible to copystack by putting it on the g.waiting
list. We do get this right everywhere, but add a comment about this
subtlety for future eyes.

Change-Id: I941da150437167acff37b0e56983c793f40fcf79
Reviewed-on: https://go-review.googlesource.com/19632
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: improve initSpan documentation
Austin Clements [Tue, 9 Feb 2016 22:34:14 +0000 (17:34 -0500)]
runtime: improve initSpan documentation

Change-Id: I9c45aad1c35a99da4c3b8990649dcd962fd23b81
Reviewed-on: https://go-review.googlesource.com/19631
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: fix heapBitsSweepSpan comment
Austin Clements [Tue, 9 Feb 2016 22:24:26 +0000 (17:24 -0500)]
runtime: fix heapBitsSweepSpan comment

Currently the heapBitsSweepSpan comment claims that heapBitsSweepSpan
sets the heap bitmap for the first two words to dead. In fact, it sets
the first *four* words to scalar/dead. This is important because first
two words don't actually have a dead bit, so for objects larger than
two words it *must* set a dead bit in third word to reset the object
to a "noscan" state. For example, we use this in heapBits.hasPointers
to detect that an object larger than two words is noscan.

Change-Id: Ie166a628bed5060851db083475c7377adb349d6c
Reviewed-on: https://go-review.googlesource.com/19630
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] cmd/compile: shrink stack guard
Keith Randall [Thu, 25 Feb 2016 19:40:51 +0000 (11:40 -0800)]
[dev.ssa] cmd/compile: shrink stack guard

Our stack frame sizes look pretty good now.  Lower the stack
guard from 1024 to 720.
Tip is currently using 720.
We could go lower (to 640 at least) except PPC doesn't like that.

Change-Id: Ie5f96c0e822435638223f1e8a2bd1a1eed68e6aa
Reviewed-on: https://go-review.googlesource.com/19922
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/go: clear cmd cache to avoid duplicate loads errors
Dmitriy Dudkin [Thu, 25 Feb 2016 19:48:57 +0000 (21:48 +0200)]
cmd/go: clear cmd cache to avoid duplicate loads errors

go get -u all command updates all packages including standard
commands. We need to get commands evicted from their cache to
avoid loading old versions of the packages evicted from the
packages cache.

Fixes #14444

Change-Id: Icd581a26e1db34ca634aba595fed62b097094c2f
Reviewed-on: https://go-review.googlesource.com/19899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/textproto: permit all valid token chars in CanonicalMIMEHeaderKey input
Brad Fitzpatrick [Wed, 20 Jan 2016 06:19:38 +0000 (06:19 +0000)]
net/textproto: permit all valid token chars in CanonicalMIMEHeaderKey input

Fixes #13767

Change-Id: Ib743db7d9d72022ea911bc5ac535243489425642
Reviewed-on: https://go-review.googlesource.com/18725
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] cmd/compile: enhance command line option processing for SSA
David Chase [Thu, 25 Feb 2016 18:10:51 +0000 (13:10 -0500)]
[dev.ssa] cmd/compile: enhance command line option processing for SSA

The -d compiler flag can also specify ssa phase and flag,
for example -d=ssa/generic_cse/time,ssa/generic_cse/stats

Spaces in the phase names can be specified with an
underscore.  Flags currently parsed (not necessarily
recognized by the phases yet) are:

   on, off, mem, time, debug, stats, and test

On, off and time are handled in the harness,
debug, stats, and test are interpreted by the phase itself.

The pass is now attached to the Func being compiled, and a
new method logStats(key, ...value) on *Func to encourage a
semi-standardized format for that output.  Output fields
are separated by tabs to ease digestion by awk and
spreadsheets.  For example,
if f.pass.stats > 0 {
f.logStat("CSE REWRITES", rewrites)
}

Change-Id: I16db2b5af64c50ca9a47efeb51d961147a903abc
Reviewed-on: https://go-review.googlesource.com/19885
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
8 years agodoc/go1.7: mention CallersFrames and Frames
Ian Lance Taylor [Thu, 25 Feb 2016 19:43:45 +0000 (11:43 -0800)]
doc/go1.7: mention CallersFrames and Frames

Change-Id: I73ae6a6837a6dcf75b3b8f431d97a18348e01a42
Reviewed-on: https://go-review.googlesource.com/19921
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime, runtime/pprof: add Frames to get file/line for Callers
Ian Lance Taylor [Sun, 21 Feb 2016 20:50:35 +0000 (12:50 -0800)]
runtime, runtime/pprof: add Frames to get file/line for Callers

This indirectly implements a small fix for runtime/pprof: it used to
look for runtime.gopanic when it should have been looking for
runtime.sigpanic.

Update #11432.

Change-Id: I5e3f5203b2ac5463efd85adf6636e64174aacb1d
Reviewed-on: https://go-review.googlesource.com/19869
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/internal/obj: don't crash on nil in Prog.String
Ian Lance Taylor [Thu, 25 Feb 2016 18:44:31 +0000 (10:44 -0800)]
cmd/internal/obj: don't crash on nil in Prog.String

I can't remember just how this happened to me, but I got an unfortunate
crash with some set of cmd/compile debug options and source code.

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

8 years agonet/http: refactored internal shouldClose for readability
Emmanuel Odeke [Fri, 19 Feb 2016 10:10:56 +0000 (02:10 -0800)]
net/http: refactored internal shouldClose for readability

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

8 years agoruntime: fix getcallerpc args
Dmitry Vyukov [Thu, 25 Feb 2016 18:16:18 +0000 (19:16 +0100)]
runtime: fix getcallerpc args

Change-Id: I6b14b8eecf125dd74bd40f4e7fff6b49de150e42
Reviewed-on: https://go-review.googlesource.com/19897
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agocmd/compile: remove rtype.ptrToThis
David Crawshaw [Thu, 18 Feb 2016 11:31:57 +0000 (06:31 -0500)]
cmd/compile: remove rtype.ptrToThis

Simplifies some code as ptrToThis was unreliable under dynamic
linking. Now the same type lookup is used regardless of execution
mode.

A synthetic relocation, R_USETYPE, is introduced to make sure the
linker includes *T on use of T, if *T is carrying methods.

Changes the heap dump format. Anything reading the format needs to
look at the last bool of a type of an interface value to determine
if the type should be the pointer-to type.

Reduces binary size of cmd/go by 0.2%.
For #6853.

Change-Id: I79fcb19a97402bdb0193f3c7f6d94ddf061ee7b2
Reviewed-on: https://go-review.googlesource.com/19695
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoexpvar: document that Get returns nil for non-existent vars
Rick Arnold [Thu, 25 Feb 2016 00:25:38 +0000 (19:25 -0500)]
expvar: document that Get returns nil for non-existent vars

Also added a test to ensure the behavior.

Fixes #14150

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

8 years ago[dev.ssa] cmd/compile: small improvements
Keith Randall [Thu, 25 Feb 2016 00:19:20 +0000 (16:19 -0800)]
[dev.ssa] cmd/compile: small improvements

Found looking at mapaccess1_faststr.

runtime.throw never returns.
Do x+y+c with an LEA.

Change-Id: I27ea6669324242a6302397cbdc73230891d97591
Reviewed-on: https://go-review.googlesource.com/19911
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agonet: re-enable TestDualStack{TCP,UDP}Listener on dragonfly
Mikio Hara [Fri, 19 Feb 2016 08:39:27 +0000 (17:39 +0900)]
net: re-enable TestDualStack{TCP,UDP}Listener on dragonfly

It looks like the latest DragonFly BSD kernels, at least 4.4 and above,
have finished working on handling of shared IP control blocks. Let's
re-enbale test cases referring to IP control blocks and see what
happens.

Updates #13146.

Change-Id: Icbe2250e788f6a445a648541272c99b598c3013d
Reviewed-on: https://go-review.googlesource.com/19406
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: make TestGoLookupIPWithResolverConfig robust
Mikio Hara [Wed, 24 Feb 2016 02:59:49 +0000 (11:59 +0900)]
net: make TestGoLookupIPWithResolverConfig robust

It crashes when the node under the test is shaken up.

-- FAIL: TestGoLookupIPWithResolverConfig (11.73s)
panic: interface conversion: error is nil, not *net.DNSError [recovered]
panic: interface conversion: error is nil, not *net.DNSError

goroutine 23 [running]:
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:483 +0x3f3
testing.tRunner.func1(0xc820136d80)
/go/src/testing/testing.go:467 +0x192
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:441 +0x4f6
net.TestGoLookupIPWithResolverConfig(0xc820136d80)
/go/src/net/dnsclient_unix_test.go:358 +0x7ca
testing.tRunner(0xc820136d80, 0x49ddc0)
/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
/go/src/testing/testing.go:582 +0x892
exit status 2

Change-Id: I9631f41a3c73f3269c7e30d679c025ae64d71a98
Reviewed-on: https://go-review.googlesource.com/19870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: fix typo
Mikio Hara [Thu, 25 Feb 2016 00:55:40 +0000 (09:55 +0900)]
net: fix typo

Change-Id: Ic828256efe0f50a3e11a25d85092d7531b342d2e
Reviewed-on: https://go-review.googlesource.com/19873
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: adjust starting token value
Robert Griesemer [Thu, 25 Feb 2016 00:17:49 +0000 (16:17 -0800)]
cmd/compile: adjust starting token value

The actual values assigned to tokens was inherited from the yacc-based
grammar. With the most recent cleanups, all single-char tokens such as
commas, semis, parens, etc., that get returned from lexer.next simply
as their Unicode values are below utf8.RuneSelf (i.e., 7bit ASCII).
Lower the initial starting value for named token constants accordingly.

Change-Id: I7eb8e584dbb3bc7f9dab849d1b68a91320cffebd
Reviewed-on: https://go-review.googlesource.com/19913
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocmd/compile: fix off-by-1 in getr
Matthew Dempsky [Thu, 25 Feb 2016 00:20:59 +0000 (16:20 -0800)]
cmd/compile: fix off-by-1 in getr

Introduced by (and missed during code review of) golang.org/cl/19847.

Change-Id: I03b76f36e5da69c31730380592dfa1c32570e17f
Reviewed-on: https://go-review.googlesource.com/19912
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: add android/arm as a valid GOOS/GOARCH combination
Burcu Dogan [Wed, 24 Feb 2016 23:06:03 +0000 (15:06 -0800)]
doc: add android/arm as a valid GOOS/GOARCH combination

Fixes #14497.

Change-Id: Ibdd55acf9e416873c64f8751c2f65f7ccdb1d500
Reviewed-on: https://go-review.googlesource.com/19914
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agocmd/asm: fix EOF message on operand parsing errors.
Tal Shprecher [Sat, 20 Feb 2016 00:02:54 +0000 (16:02 -0800)]
cmd/asm: fix EOF message on operand parsing errors.

If the parsing of an operand completes but the parser thinks there
is more to read, return an "expected end of operand" error message
instead of "expected EOF." This also removes extra "asm: " prefixes
in error strings since "asm: " is already set as the global log
prefix.

Fixes #14071

Change-Id: I7d621c1aea529a0eca3bcba032359bd25b3e1080
Reviewed-on: https://go-review.googlesource.com/19731
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile: cleanup escape sequence lexing
Matthew Dempsky [Wed, 24 Feb 2016 19:49:31 +0000 (11:49 -0800)]
cmd/compile: cleanup escape sequence lexing

Change-Id: I7fe4d0cdcc284d5319c130ee3c351f23489af273
Reviewed-on: https://go-review.googlesource.com/19902
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/go: skip consistent cgo build test on Solaris.
Damien Neil [Wed, 24 Feb 2016 23:18:41 +0000 (15:18 -0800)]
cmd/go: skip consistent cgo build test on Solaris.

See #13247.

Change-Id: I06636157028d98430eb29277c822270592907856
Reviewed-on: https://go-review.googlesource.com/19910
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: clean up getlinepragma
Josh Bleecher Snyder [Mon, 8 Jun 2015 17:17:38 +0000 (10:17 -0700)]
cmd/compile: clean up getlinepragma

Passes toolstash -cmp.

Change-Id: Ia497b51c74a9c760a873e1ed690e4408fd0fe596
Reviewed-on: https://go-review.googlesource.com/19844
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] cmd/compile: identical values are the same pointer
Keith Randall [Wed, 24 Feb 2016 20:58:47 +0000 (12:58 -0800)]
[dev.ssa] cmd/compile: identical values are the same pointer

Forgot the obvious case.  Allows us to remove the load in:

func f(p *int, x int) int {
*p = x + 5
return *p
}

Change-Id: I93686d8240bab3a1d166b88e224cf71e3d947aef
Reviewed-on: https://go-review.googlesource.com/19905
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] cmd/compile: fix @ rewrite rules
Keith Randall [Wed, 24 Feb 2016 18:29:27 +0000 (10:29 -0800)]
[dev.ssa] cmd/compile: fix @ rewrite rules

The @ directive used to read the target block after some value
structure had already changed.  I don't think it was ever really
a bug, but it's confusing.

It might fail like this:

(Foo x y) -> @v.Args[0].Block (Bar y (Baz ...))

v.Op = Bar
v.Args[0] = y
v.Args[1] = v.Args[0].Block.NewValue(Baz, ...)

That new value is allocated in the block of y, not the
block of x.

Anyway, read the destination block first so this
potential bug can't happen.

Change-Id: Ie41d2fc349b35cefaa319fa9327808bcb781b4e2
Reviewed-on: https://go-review.googlesource.com/19900
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
8 years ago[dev.ssa] cmd/compile: update TODO
Keith Randall [Wed, 24 Feb 2016 21:08:00 +0000 (13:08 -0800)]
[dev.ssa] cmd/compile: update TODO

Remove the stuff that's already done.

Change-Id: I3b4fc827240d45dd051dc36897883532d8900a0c
Reviewed-on: https://go-review.googlesource.com/19906
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/compile: don't free the Prog list if we look at it after flush
Keith Randall [Wed, 24 Feb 2016 22:07:25 +0000 (14:07 -0800)]
cmd/compile: don't free the Prog list if we look at it after flush

Only tests do this, provide them a hook to disable freeing
after flush.

Change-Id: I810c6c51414a93f476a18ba07b807e16092bf8cf
Reviewed-on: https://go-review.googlesource.com/19907
Reviewed-by: Keith Randall <khr@golang.org>
8 years agounicode/utf16: speed up and clean up Encode and EncodeRune
Alberto Donizetti [Tue, 23 Feb 2016 21:54:38 +0000 (22:54 +0100)]
unicode/utf16: speed up and clean up Encode and EncodeRune

name                        old time/op  new time/op  delta
EncodeValidASCII-4          74.1ns ± 1%  70.1ns ± 1%   -5.46%  (p=0.000 n=10+10)
EncodeValidJapaneseChars-4  61.3ns ± 0%  58.9ns ± 0%   -3.82%  (p=0.000 n=10+10)
EncodeRune-4                13.1ns ± 1%   9.8ns ± 0%  -25.24%   (p=0.000 n=10+9)

Fixes #6957

Change-Id: I9dde6d77420c34c6e2ef3e6213bb6be9b58a3074
Reviewed-on: https://go-review.googlesource.com/19891
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoos: fix tests on brillo
Burcu Dogan [Wed, 24 Feb 2016 19:58:57 +0000 (11:58 -0800)]
os: fix tests on brillo

Not every Android contains the /system/framework directory, e.g. Brillo.
Test against other Android-only system files.

Fixes #14489.

Change-Id: I6d9ec1c4d4ceba3803798015e6917d59cf515de8
Reviewed-on: https://go-review.googlesource.com/19904
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile: reuseable cache of Prog structs
Keith Randall [Wed, 24 Feb 2016 17:53:27 +0000 (09:53 -0800)]
cmd/compile: reuseable cache of Prog structs

Reuseable cache of Prog entries.

Improves compiler speed by ~10%.

Update #13646

Change-Id: I01bd8606540d989ea8b8ba5131d1275ba380d976
Reviewed-on: https://go-review.googlesource.com/19868
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: Drop references to Prog structs after each function
Keith Randall [Wed, 24 Feb 2016 17:12:51 +0000 (09:12 -0800)]
cmd/compile: Drop references to Prog structs after each function

Don't accumulate a massive list of Prog structs during
compilation and write them all out at the end of compilation.
Instead, convert them to code+relocs (or data+relocs) after each
function is compiled.

Track down a few other places that were keeping Progs alive
and nil them out so the Progs get GCd promptly.

Saves ~20% in peak memory usage for the compiler.  Surprisingly not much
help speed-wise (only because we end up doing more GCs.  With a
compensating GOGC=120, it does help a bit), but this provides a base for
more changes (e.g. reusing a cache of Progs).

Change-Id: I838e01017c228995a687a8110d0cd67bf8596407
Reviewed-on: https://go-review.googlesource.com/19867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoall: fix typos and spelling
Martin Möhrmann [Wed, 24 Feb 2016 10:55:20 +0000 (11:55 +0100)]
all: fix typos and spelling

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

8 years agoencoding/csv: clarify that TrimLeadingSpace can trim the delimiter
Eric Lagergren [Wed, 24 Feb 2016 02:19:52 +0000 (18:19 -0800)]
encoding/csv: clarify that TrimLeadingSpace can trim the delimiter

Fixes #14464

Change-Id: Iafc21641cca7d35b7a5631cfc94742ee8e7d5042
Reviewed-on: https://go-review.googlesource.com/19861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: don't use duffzero on Plan 9
David du Colombier [Wed, 24 Feb 2016 18:00:10 +0000 (19:00 +0100)]
cmd/compile: don't use duffzero on Plan 9

In CL 14408, the implementation of duffzero on amd64
was changed to replace the use of the MOVQ instructions
by MOVUPS.

However, it broke the build on plan9/amd64, since
Plan 9 doesn't allow floating point in note handler.

This change disables the use of duffzero on Plan 9.
We also take care to not use the MOVUPS instruction.

Fixes #14471.

Change-Id: I8277b485dfe65a68d7d8338e52a048c5d45069bf
Reviewed-on: https://go-review.googlesource.com/19890
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: embed type string header in rtype
David Crawshaw [Wed, 17 Feb 2016 03:23:14 +0000 (22:23 -0500)]
cmd/compile: embed type string header in rtype

Reduces binary size of cmd/go by 1%.

For #6853.

Change-Id: I6f2992a4dd3699db1b532ab08683e82741b9c2e4
Reviewed-on: https://go-review.googlesource.com/19692
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] cmd/compile: reduce line number churn in generated code
David Chase [Wed, 24 Feb 2016 02:09:39 +0000 (21:09 -0500)]
[dev.ssa] cmd/compile: reduce line number churn in generated code

In regalloc, make LoadReg instructions use the line number
of their *use*, not their *source*.  This reduces the
tendency of debugger stepping to "jump around" the program.

Change-Id: I59e2eeac4dca9168d8af3a93effbc5bdacac2881
Reviewed-on: https://go-review.googlesource.com/19836
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: speed up cse
Todd Neal [Tue, 23 Feb 2016 23:52:17 +0000 (17:52 -0600)]
[dev.ssa] cmd/compile: speed up cse

Construct better initial partitions by recursively comparing values and
their arguments.  This saves one second on compile of arithConst_ssa.go
(4.3s to 3.3s) and shows a 3-5% increase with compilebench.

name       old time/op     new time/op     delta
Template       266ms ± 3%      253ms ± 4%  -5.08%          (p=0.032 n=5+5)
GoTypes        927ms ± 3%      885ms ± 2%  -4.55%          (p=0.016 n=5+5)
Compiler       3.91s ± 3%      3.73s ± 2%  -4.49%          (p=0.008 n=5+5)
MakeBash       31.6s ± 1%      30.5s ± 3%  -3.51%          (p=0.016 n=5+5)

Change-Id: I6ede31ff459131ccfed69531acfbd06b19837700
Reviewed-on: https://go-review.googlesource.com/19838
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/compile: factor our literal lexing from main lexer function
Robert Griesemer [Wed, 24 Feb 2016 06:04:20 +0000 (22:04 -0800)]
cmd/compile: factor our literal lexing from main lexer function

Further reduces complexity of lexer.next which is now readable.
Also removes the need to initialize various local variables in
each next call even if they are not used for the current token.

No measurable performance change for `time go build -a net/http`
(best of 5 runs): difference < 0.3% (in the noise).

Change-Id: I0d74caa2768920af1ceee027e0f46595119d4210
Reviewed-on: https://go-review.googlesource.com/19865
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years ago[dev.ssa] cmd/compile: leave JMPs in when using -N
Keith Randall [Tue, 23 Feb 2016 07:19:00 +0000 (23:19 -0800)]
[dev.ssa] cmd/compile: leave JMPs in when using -N

Helps keep line numbers around for debugging, particularly
for break and continue statements (which often compile
down to nothing).

Update #14379

Change-Id: I6ea06aa887b0450d9ba4f11e319e5c263f5a98ba
Reviewed-on: https://go-review.googlesource.com/19848
Reviewed-by: David Chase <drchase@google.com>
8 years agosort: fix for nondeterministic less function in quicksort pivot
Jure Ham [Tue, 23 Feb 2016 10:41:27 +0000 (11:41 +0100)]
sort: fix for nondeterministic less function in quicksort pivot

Fixes #14377

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