1
0
mirror of https://github.com/golang/go synced 2024-10-01 22:18:32 -06:00
Commit Graph

27198 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
4f753e77f1 cmd/all: stop generating ADATA Progs
The only remaining place that generated ADATA
Prog was the assembler. Stop, and delete some
now-dead code.

Passes toolstash -cmp.

Change-Id: I26578ff1b4868e98562b44f69d909c083e96f8d5
Reviewed-on: https://go-review.googlesource.com/20646
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-14 02:22:49 +00:00
Josh Bleecher Snyder
7c18f8cdc3 cmd/compile: write some static data directly
Instead of generating ADATA instructions for
static data, write that static data directly
into the linker sym.
This is considerably more efficient.
The assembler still generates
ADATA instructions, so the ADATA machinery
cannot be dismantled yet. (Future work.)
Skipping ADATA has a significant impact
compiling the unicode package, which has lots
of static data.

name     old time/op    new time/op    delta
Unicode     227ms ±10%     192ms ± 4%  -15.61%  (p=0.000 n=29+30)

name     old alloc/op   new alloc/op   delta
Unicode    51.0MB ± 0%    45.8MB ± 0%  -10.29%  (p=0.000 n=30+30)

name     old allocs/op  new allocs/op  delta
Unicode      610k ± 0%      578k ± 0%   -5.29%  (p=0.000 n=30+30)

This does not pass toolstash -cmp, because
this changes the order in which some relocations
get added, and thus it changes the output from
the compiler. It is not worth the execution time
to sort the relocs in the normal case.

However, compiling with -S -v generates identical
output if (1) you suppress printing of ADATA progs
in flushplist and (2) you suppress printing of
cpu timing. It is reasonable to suppress printing
the ADATA progs, since the data itself is dumped
later. I am therefore fairly confident that all
changes are superficial and non-functional.

Fixes #14786, although there's more to do
in general.

Change-Id: I8dfabe7b423b31a30e516cfdf005b62a2e9ccd82
Reviewed-on: https://go-review.googlesource.com/20645
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-14 02:21:43 +00:00
Dominik Honnef
368507bb6f reflect: use SelectDir instead of uintptr in runtimeSelect
And fix the wrong comment.

Initially found this because the comment was wrong about the possible
values. Then noticed that there doesn't seem to be any reason to use
uintptr over SelectDir.

Change-Id: I4f9f9640e49d89e558ed00bd99e57dab890785f5
Reviewed-on: https://go-review.googlesource.com/20655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 01:55:31 +00:00
Martin Möhrmann
43ed65f869 runtime: speed up growslice by avoiding divisions
Only compute the number of maximum allowed elements per slice once.
Special case newcap computation for slices with byte sized elements.

name              old time/op  new time/op  delta
GrowSliceBytes-2  61.1ns ± 1%  43.4ns ± 1%  -29.00%  (p=0.000 n=20+20)
GrowSliceInts-2   85.9ns ± 1%  75.7ns ± 1%  -11.80%  (p=0.000 n=20+20)

Change-Id: I5d9c0d5987cdd108ac29dc32e31912dcefa2324d
Reviewed-on: https://go-review.googlesource.com/20653
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 00:45:57 +00:00
Brad Fitzpatrick
b55a5dbb8a os/user: fix formatting of error group lookup message
It was failing like "unknown groupid ᎈ|" instead of "unknown groupid
5000" due to the conversion from int to string.

Updates #14806

Change-Id: I83e4b478ff628ad4053573a9f32b3fadce22e847
Reviewed-on: https://go-review.googlesource.com/20642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-14 00:45:25 +00:00
Matthew Dempsky
d1341d6cf3 cmd/compile, runtime: eliminate growslice_n
Fixes #11419.

Change-Id: I7935a253e3e96191a33f5041bab203ecc5f0c976
Reviewed-on: https://go-review.googlesource.com/20647
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-13 23:34:31 +00:00
Alexandru Moșoi
8ec80176d4 cmd/compile: move decompose builtin closer to late opt
* Shaves about 10k from pkg/tools/linux_amd64.
* Was suggested by drchase before
* Found by looking at ssa output of #14758

Change-Id: If2c4ddf3b2603d4dfd8fb4d9199b9a3dcb05b17d
Reviewed-on: https://go-review.googlesource.com/20570
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 22:12:01 +00:00
Josh Bleecher Snyder
fdc04223c5 cmd/compile: clean up savedata
Simplify function signature.
Remove unused Ctxt field Enforce_data_order.

Passes toolstash -cmp.

Change-Id: I5caa270ca9ae725708fe415b2c978b5f40780255
Reviewed-on: https://go-review.googlesource.com/20644
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 21:11:27 +00:00
Josh Bleecher Snyder
e8fab405cb cmd/compile: minor cleanup
Passes toolstash -cmp.

Change-Id: Ib8c76081956e1d4eecef16b82bc8d527d7849d7e
Reviewed-on: https://go-review.googlesource.com/20643
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 21:06:25 +00:00
Egon Elbre
69f49e1cbc cmd/pprof: fix crash with invalid source
pprof crashed when running with:

     go tool pprof %INVALID

Change-Id: I47c2a4da7273e3a97a833f320a650b8c6b59d6b9
Reviewed-on: https://go-review.googlesource.com/20632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 20:38:16 +00:00
Josh Bleecher Snyder
af1c29c1c1 cmd/internal/obj: sort relocs by off when printing
This makes the output of compiling with -S more
stable in the face of unimportant variation in the
order in which relocs are generated.
It is also more pleasant to read the relocs when
they are sorted.

Also, do some minor cleanup.

For #14786

Change-Id: Id92020b13fd21777dfb5b29c2722c3b2eb27001b
Reviewed-on: https://go-review.googlesource.com/20641
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-13 20:31:40 +00:00
Matthew Dempsky
a2a48069fe cmd/compile: rework how fieldtrack is implemented
Shrinks gc.Type and gc.Func slightly.

Passes "GOEXPERIMENT=fieldtrack ./all.bash" and "go test -a
-toolexec='toolstash -cmp' -ldflags=-k=rsc.io/tmp/fieldtrack.tracked
rsc.io/tmp/fieldtrack".

Change-Id: I785fe8a18eb830d9867d34247e4cd41a6a7921d4
Reviewed-on: https://go-review.googlesource.com/20557
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 16:58:00 +00:00
Todd Neal
f6ceed2cab cmd/compile: const folding for float32/64
Split the auxFloat type into 32/64 bit versions and perform checking for
exactly representable float32 values.  Perform const folding on
float32/64.  Comment out some const negation rules that the frontend
already performs.

Change-Id: Ib3f8d59fa8b30e50fe0267786cfb3c50a06169d2
Reviewed-on: https://go-review.googlesource.com/20568
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-13 13:32:41 +00:00
Alexandru Moșoi
cd798dcb88 cmd/compile/internal/ssa: generalize prove to all booleans
* Refacts a bit saving and restoring parents restrictions
* Shaves ~100k from pkg/tools/linux_amd64,
but most of the savings come from the rewrite rules.
* Improves on the following artificial test case:
func f1(a4 bool, a6 bool) bool {
  return a6 || (a6 || (a6 || a4)) || (a6 || (a4 || a6 || (false || a6)))
}

Change-Id: I714000f75a37a3a6617c6e6834c75bd23674215f
Reviewed-on: https://go-review.googlesource.com/20306
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 12:05:41 +00:00
Emmanuel Odeke
6dfcc336c5 runtime: move testSchedLocalQueue* to export_test
Move functions testSchedLocalQueueLocal and testSchedLocalQueueSteal
from proc.go to export_test.go, the only site that they are used.

Fixes #14796

Change-Id: I16b6fa4a13835eab33f66a2c2e87a5f5c79b7bd3
Reviewed-on: https://go-review.googlesource.com/20640
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 00:34:58 +00:00
Dominik Honnef
ab5cbc672b net/http: delete unused type readClose
readClose hasn't been used in years.

Change-Id: Ia963c082e049ef856c2a637fec15204efe48b3b6
Reviewed-on: https://go-review.googlesource.com/20631
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-12 22:13:32 +00:00
Emmanuel Odeke
2a7c446f98 net/http: make ParseMultipartForm also populate Request.PostForm
Ensures that after request.ParseMultipartForm has been invoked,
Request.PostForm and Request.Form are both populated with the
same formValues read in, instead of only populating Request.Form.

Fixes #9305

Change-Id: I3d4a11b006fc7dffaa35360014fe15b8c74d00a3
Reviewed-on: https://go-review.googlesource.com/19986
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-12 19:01:47 +00:00
Todd Neal
40bfec0022 cmd/compile: reuse auto symbols during ssa construction
Reuse auto symbols so cse can eliminate OpAddrs that refer to
them.

Change-Id: I69e6a3f77a3a33946459cf8c6eccf223f6125048
Reviewed-on: https://go-review.googlesource.com/20569
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-12 13:44:49 +00:00
Shahar Kohanim
eb57a1dd75 cmd/link: use string map for symbols with single version
Reduces link time by ~3%

Results with gc on:
name       old s/op   new s/op   delta
LinkCmdGo  0.82 ± 2%  0.78 ± 2%  -3.90%  (p=0.000 n=17+17)
LinkJuju   7.11 ± 7%  6.87 ± 6%  -3.41%  (p=0.012 n=20+19)

Less noisy results with gc turned off:
name       old s/op   new s/op   delta
LinkCmdGo  0.66 ± 2%  0.64 ± 2%  -3.14%  (p=0.000 n=18+20)
LinkJuju   5.91 ± 1%  5.72 ± 2%  -3.17%  (p=0.000 n=20+20)

Change-Id: I4cac7933b0b22d0aee18255e1ab54550ad364593
Reviewed-on: https://go-review.googlesource.com/20478
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2016-03-12 11:11:10 +00:00
Alex Brainman
bb48b864b1 cmd/link: rewrite pe symbol table generating code
Every go executable has COFF symbol table appended at the end. The table is
used by nm and addr2line and contains all symbols present in the executable.
The table is quite large. For example, my go.exe has 11736 records.

To generate symbol table:
1) we walk "all symbols" list to count symbols we want for the table;
2) we allocate large global array of COFFSym structs (32 bytes each)
   to fit our symbols;
3) we walk "all symbols" list again to fill our array with contents;
4) we iterate over our global array to write all records to the file.

This CL changes all these steps with single step:
- walk "all symbols" list and write each COFF symbol table record to
  the file as we go.

I hope new version is faster and uses less garbage, but I don't know
how to benchmark this.

Change-Id: Ie4870583250131ea4428e0e83a0696c9df1794e0
Reviewed-on: https://go-review.googlesource.com/20580
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2016-03-12 07:07:48 +00:00
Keith Randall
77b527e283 cmd/compile: strength reduce *24
We use *24 a lot for pointer arithmetic when accessing slices
of slices ([][]T).  Rewrite to use an LEA and a shift.
The shift will likely be free, as it often gets folded into
an indexed load/store.

Update #14606

Change-Id: Ie0bf6dc1093876efd57e88ce5f62c26a9bf21cec
Reviewed-on: https://go-review.googlesource.com/20567
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-12 02:58:45 +00:00
Robert Griesemer
68c86a0096 cmd/compile: remove structpkg global variable
The structpkg global variable was only used to verify internal
consistency when declaring methods during import. Track the
value in the parser and binary importer directly and pass it
to the relevant function as an argument.

Change-Id: I7e5e006f9046d84f9a3959616f073798fda36c97
Reviewed-on: https://go-review.googlesource.com/20606
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-12 01:39:40 +00:00
David Crawshaw
7c546566c3 cmd/compile: compute number of arguments correctly
The outCount value includes a flag bit for dotdotdot.

If we have this count incorrect, then the offset for the
methodset *rtype are in the wrong place.

Fixes #14783

Change-Id: If5acb16af08d4ffe36c8c9ee389c32f2712ce757
Reviewed-on: https://go-review.googlesource.com/20566
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-12 01:23:25 +00:00
Tom Bergan
ae00df128d crypto/tls: implement dynamic record sizing
Currently, if a client of crypto/tls (e.g., net/http, http2) calls
tls.Conn.Write with a 33KB buffer, that ends up writing three TLS
records: 16KB, 16KB, and 1KB. Slow clients (such as 2G phones) must
download the first 16KB record before they can decrypt the first byte.
To improve latency, it's better to send smaller TLS records. However,
sending smaller records adds overhead (more overhead bytes and more
crypto calls), which slightly hurts throughput.

A simple heuristic, implemented in this change, is to send small
records for new connections, then boost to large records after the
first 1MB has been written on the connection.

Fixes #14376

Change-Id: Ice0f6279325be6775aa55351809f88e07dd700cd
Reviewed-on: https://go-review.googlesource.com/19591
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2016-03-12 00:47:13 +00:00
Ian Lance Taylor
1220ac27ce cmd/compile: don't copy all type nodes for builtin functions
Only copy the ones that actually change.  Also combine deep and substAny
functions into one.  The Type.Copyany field is now unused, so remove it.

Passes toolstash -cmp.

Change-Id: Id28a9bf144ecf3e522aad00496f8a21ae2b74680
Reviewed-on: https://go-review.googlesource.com/20600
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-12 00:30:44 +00:00
Adam Langley
055dcb7566 crypto/tls: document that the cipher suite list is non-exhaustive.
Fixes #14370.

Change-Id: Ieb95ee3494f592fb5fc74aa4b803479671816927
Reviewed-on: https://go-review.googlesource.com/20551
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-12 00:20:51 +00:00
Adam Langley
ec158cebd9 crypto/x509: correct OID for DSA-with-SHA-256.
I copied this down incorrectly. See
https://tools.ietf.org/html/rfc5758#section-3.1.

Thankfully it's incredibly obscure.

Fixes #14663.

Change-Id: I4792ee979916cc15aa2e300c8bc989bc4f9c63ac
Reviewed-on: https://go-review.googlesource.com/20549
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
2016-03-12 00:13:26 +00:00
Adam Langley
88849736b2 crypto/tls: better error for oversized handshake messages.
This change improves the error message when encountering a TLS handshake
message that is larger than our limit (64KB). Previously the error was
just “local error: internal error”.

Updates #13401.

Change-Id: I86127112045ae33e51079e3bc047dd7386ddc71a
Reviewed-on: https://go-review.googlesource.com/20547
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-12 00:13:02 +00:00
Matthew Dempsky
9d7b2b7b10 cmd/compile: move universe block code into new universe.go
Move lexinit, typeinit, lexinit1, and lexfini into new universe.go
file, and give them a more idiomatic and descriptive API. No code
changes.

Change-Id: I0e9b25dcc86ad10f4b990dc02bd33477b488cc85
Reviewed-on: https://go-review.googlesource.com/20604
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-11 23:56:56 +00:00
Robert Griesemer
76461c93a1 cmd/compile: move lexn and lexname into lex.go (cleanup)
Missed these two declarations in the previous cleanup.

Change-Id: I54ff3accd387dd90e12847daccf4477169797f81
Reviewed-on: https://go-review.googlesource.com/20603
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 23:26:59 +00:00
Robert Griesemer
998b6dd75c cmd/compile: move lexer into separate file (cleanup)
This is really moving all the non-lexer pieces out of lex.go
into main.go. It's always been confusing that the top-most
compiler entry point (Main) is in the same file with the
lexer. Both files remain of substantial size (> 1000 lines),
which justifies this even more.

No other changes.

Change-Id: I03895589d5e3cc2340580350bbc1420539893dfc
Reviewed-on: https://go-review.googlesource.com/20601
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:59:57 +00:00
Robert Griesemer
e78ff3823e cmd/compile: simplify lexer.ungetr
Change-Id: Id041c1b2d364aecd7a6613a53237f7de2c650a7e
Reviewed-on: https://go-review.googlesource.com/20599
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:17:01 +00:00
David Crawshaw
e2836935bb cmd/link: treat reflect.Value.Method like Call
Fixes #14740

Change-Id: Iad8d971c21977b0a1f4ef55a08bb180a8125e976
Reviewed-on: https://go-review.googlesource.com/20562
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:07:02 +00:00
David Crawshaw
5aa5db7593 cmd/compile: use bufio.Reader directly in lexer
Removes an intermediate layer of functions that was clogging up a
corner of the compiler's profile graph.

I can't measure a performance improvement running a large build
like jujud, but the profile reports less total time spent in
gc.(*lexer).getr.

Change-Id: I3000585cfcb0f9729d3a3859e9023690a6528591
Reviewed-on: https://go-review.googlesource.com/20565
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 21:27:23 +00:00
David Crawshaw
cc158403d6 cmd/compile: track reflect.Type.Method in deadcode
In addition to reflect.Value.Call, exported methods can be invoked
by the Func value in the reflect.Method struct. This CL has the
compiler track what functions get access to a legitimate reflect.Method
struct by looking for interface calls to either of:

	Method(int) reflect.Method
	MethodByName(string) (reflect.Method, bool)

This is a little overly conservative. If a user implements a type
with one of these methods without using the underlying calls on
reflect.Type, the linker will assume the worst and include all
exported methods. But it's cheap.

No change to any of the binary sizes reported in cl/20483.

For #14740

Change-Id: Ie17786395d0453ce0384d8b240ecb043b7726137
Reviewed-on: https://go-review.googlesource.com/20489
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-11 21:19:20 +00:00
Josh Bleecher Snyder
4112f0f7e6 cmd/compile: improve go.importpath.* docs
While we're here, remove a bit of dead code.

Change-Id: I1344bb41e5d368825ca5748189382f9e7023c59a
Reviewed-on: https://go-review.googlesource.com/20596
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 20:50:10 +00:00
Josh Bleecher Snyder
2ac8555d57 cmd/link: tidy up rdsym
Use an early return. Check errors. Deduplicate.

Change-Id: Iabefd563b5ef82a16fab4791277630804fd09003
Reviewed-on: https://go-review.googlesource.com/20597
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 20:49:53 +00:00
Matthew Dempsky
de4317cbd7 cmd/compile: eliminate uses of Type.Down in bexport.go
Change-Id: I298b9d389ac33a24365f4c06a122c3af989906c0
Reviewed-on: https://go-review.googlesource.com/20594
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-11 18:25:52 +00:00
Matthew Dempsky
d9bb693960 cmd/compile: sort interface methods in tointerface0
Might as well sort them while they're still in a slice.

Change-Id: I40c25ddc5c054dcb4da2aeefa79947967609d599
Reviewed-on: https://go-review.googlesource.com/20591
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 18:25:42 +00:00
Klaus Post
53984e5be2 compress/flate: optimize huffman bit encoder
Part 1 of optimizing the deflater. This optimizes the bitwriter by:

* Removing allocations.
* Storing compound values for bit codes instead of 2 separate tables.
* Accumulate 48 bits between writes instead of 24.
* Inline bit flushing.

This also contains code that will be used in later CL's
(writeBlockDynamic, writeBlockHuff).

Tests for Huffman bit writer encoding regressions has been added.

name                       old speed      new speed      delta
EncodeDigitsSpeed1e4-4     19.3MB/s ± 1%  21.6MB/s ± 1%  +11.77%
EncodeDigitsSpeed1e5-4     25.0MB/s ± 6%  30.7MB/s ± 1%  +22.70%
EncodeDigitsSpeed1e6-4     28.2MB/s ± 1%  32.3MB/s ± 1%  +14.64%
EncodeDigitsDefault1e4-4   13.3MB/s ± 0%  14.2MB/s ± 1%   +7.07%
EncodeDigitsDefault1e5-4   6.43MB/s ± 1%  6.64MB/s ± 1%   +3.27%
EncodeDigitsDefault1e6-4   5.81MB/s ± 0%  5.85MB/s ± 1%   +0.69%
EncodeDigitsCompress1e4-4  13.2MB/s ± 0%  14.4MB/s ± 0%   +9.10%
EncodeDigitsCompress1e5-4  6.40MB/s ± 1%  6.61MB/s ± 0%   +3.20%
EncodeDigitsCompress1e6-4  5.80MB/s ± 1%  5.90MB/s ± 1%   +1.64%
EncodeTwainSpeed1e4-4      18.4MB/s ± 1%  20.7MB/s ± 1%  +12.72%
EncodeTwainSpeed1e5-4      27.7MB/s ± 1%  31.0MB/s ± 1%  +11.78%
EncodeTwainSpeed1e6-4      29.1MB/s ± 0%  32.9MB/s ± 2%  +13.25%
EncodeTwainDefault1e4-4    12.4MB/s ± 0%  13.1MB/s ± 1%   +5.88%
EncodeTwainDefault1e5-4    7.52MB/s ± 1%  7.83MB/s ± 0%   +4.19%
EncodeTwainDefault1e6-4    7.08MB/s ± 1%  7.26MB/s ± 0%   +2.54%
EncodeTwainCompress1e4-4   12.0MB/s ± 1%  12.8MB/s ± 1%   +6.70%
EncodeTwainCompress1e5-4   5.96MB/s ± 1%  6.16MB/s ± 0%   +3.27%
EncodeTwainCompress1e6-4   5.37MB/s ± 0%  5.39MB/s ± 1%   +0.47%

>Allocations:

benchmark                              old allocs     new allocs     delta
BenchmarkEncodeDigitsSpeed1e4-4        50             0              -100.00%
BenchmarkEncodeDigitsSpeed1e5-4        110            0              -100.00%
BenchmarkEncodeDigitsSpeed1e6-4        1032           0              -100.00%
BenchmarkEncodeDigitsDefault1e4-4      56             0              -100.00%
BenchmarkEncodeDigitsDefault1e5-4      120            0              -100.00%
BenchmarkEncodeDigitsDefault1e6-4      966            0              -100.00%
BenchmarkEncodeDigitsCompress1e4-4     56             0              -100.00%
BenchmarkEncodeDigitsCompress1e5-4     120            0              -100.00%
BenchmarkEncodeDigitsCompress1e6-4     966            0              -100.00%
BenchmarkEncodeTwainSpeed1e4-4         58             0              -100.00%
BenchmarkEncodeTwainSpeed1e5-4         132            0              -100.00%
BenchmarkEncodeTwainSpeed1e6-4         1082           0              -100.00%
BenchmarkEncodeTwainDefault1e4-4       52             0              -100.00%
BenchmarkEncodeTwainDefault1e5-4       126            0              -100.00%
BenchmarkEncodeTwainDefault1e6-4       886            0              -100.00%
BenchmarkEncodeTwainCompress1e4-4      52             0              -100.00%
BenchmarkEncodeTwainCompress1e5-4      120            0              -100.00%
BenchmarkEncodeTwainCompress1e6-4      880            0              -100.00%

benchmark                              old bytes     new bytes     delta
BenchmarkEncodeDigitsSpeed1e4-4        4288          2             -99.95%
BenchmarkEncodeDigitsSpeed1e5-4        8896          15            -99.83%
BenchmarkEncodeDigitsSpeed1e6-4        84098         153           -99.82%
BenchmarkEncodeDigitsDefault1e4-4      4480          3             -99.93%
BenchmarkEncodeDigitsDefault1e5-4      9216          76            -99.18%
BenchmarkEncodeDigitsDefault1e6-4      73920         768           -98.96%
BenchmarkEncodeDigitsCompress1e4-4     4480          3             -99.93%
BenchmarkEncodeDigitsCompress1e5-4     9216          76            -99.18%
BenchmarkEncodeDigitsCompress1e6-4     73920         768           -98.96%
BenchmarkEncodeTwainSpeed1e4-4         4544          2             -99.96%
BenchmarkEncodeTwainSpeed1e5-4         9600          15            -99.84%
BenchmarkEncodeTwainSpeed1e6-4         77633         153           -99.80%
BenchmarkEncodeTwainDefault1e4-4       4352          3             -99.93%
BenchmarkEncodeTwainDefault1e5-4       9408          76            -99.19%
BenchmarkEncodeTwainDefault1e6-4       65984         768           -98.84%
BenchmarkEncodeTwainCompress1e4-4      4352          3             -99.93%
BenchmarkEncodeTwainCompress1e5-4      9216          76            -99.18%
BenchmarkEncodeTwainCompress1e6-4      65792         768           -98.83%

Updates #14258

Change-Id: Ibaa97b9619743ad623094727228eb2ada1ec7f1f
Reviewed-on: https://go-review.googlesource.com/19336
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 17:40:52 +00:00
Klaus Post
afdb8cff3e compress/flate: test if results are deterministic
This will test if deflate output is deterministic between two runs
of the deflater, when write sizes differ.

The deflater makes no official promises that results are
deterministic between runs, but this is a good test to determine
unintentional randomness.

Note that this does not guarantee that results are deterministic
across platforms nor that results will be deterministic between
Go versions. This is also not guarantees we should imply.

Change-Id: Id7dd89fe276060fd83a43d0b34ac35d50fcd32d9
Reviewed-on: https://go-review.googlesource.com/20573
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 17:07:51 +00:00
Michael Munday
d05773ce73 cmd/internal/obj: fix nil pointer dereference in Dconv
p can be nil in Dconv so we need to do a check before dereferencing
it. Fixes a problem I was having running toolstash.

Change-Id: I34d6d278b319583d8454c2342ac88e054fc4b641
Reviewed-on: https://go-review.googlesource.com/20595
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 16:58:41 +00:00
Matthew Dempsky
f973e79d09 cmd/compile: move InitPlan and InitEntry into sinit.go
I don't know what they're used for, but that's the only file they're
referenced in.

Change-Id: Ie39d7d4621e2d5224408243b5789597ca0dc14be
Reviewed-on: https://go-review.googlesource.com/20593
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-11 09:09:51 +00:00
Matthew Dempsky
3621600c92 cmd/compile: give "magic" code its own source file
This code is an eye sore to keep scrolling past in subr.go, so move it
out of the way.

Change-Id: I8eafc1725d868a4924ee7ca9b7738cce309f9eff
Reviewed-on: https://go-review.googlesource.com/20592
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-11 09:09:33 +00:00
Ian Lance Taylor
b354f91417 runtime: limit TestCgoCCodeSIGPROF test to 1 second
Still fails about 20% of the time on my laptop.

Fixes #14766.

Change-Id: I169ab728c6022dceeb91188f5ad466ed6413c062
Reviewed-on: https://go-review.googlesource.com/20590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 06:43:01 +00:00
Robert Griesemer
def9c0b06d cmd/compile: remove Label.Link field and lastlabel global var
Change-Id: If2a174f482ecd56dee43f921d13fef98439872fc
Reviewed-on: https://go-review.googlesource.com/20559
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-11 06:13:06 +00:00
Emmanuel Odeke
637e1aad5c net/http: defer idleMu.Unlock() in tryPutIdleConn + minor typo fixes.
Change-Id: Ia2273c3a9f0001d16b0c767fea91498a9acb0af5
Reviewed-on: https://go-review.googlesource.com/19963
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 06:12:28 +00:00
Matthew Dempsky
c7917de0bb cmd/compile: simplify transformclosure
Use idiomatic slicing operations instead of incrementally building a
linked list.

Passes toolstash -cmp.

Change-Id: Idb0e40c7b4d7d1110d23828afa8ae1d157ba905f
Reviewed-on: https://go-review.googlesource.com/20556
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 05:54:27 +00:00
Matthew Dempsky
501b1fc3f2 cmd/compile: cleanup unsafenmagic
In particular, make Alignof work more like Sizeof. Other idiomatic
cleanups while here.

Passes toolstash -cmp.

Change-Id: I4def20894f3d95e49ab6a50ddba189be36fdd258
Reviewed-on: https://go-review.googlesource.com/20555
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-11 05:42:59 +00:00
Matthew Dempsky
d3794f88e9 cmd/compile: eliminate uses of Type.Down in alg.go
This could be done by threading the Iter value down through memrun and
ispaddedfield, but that ends up a bit clunky. This way is also closer
to how we'll want the code to look once fields are kept in slices.

Passes toolstash -cmp.

Change-Id: I8a44445c85f921eb18d97199df2026c5ce0f4f67
Reviewed-on: https://go-review.googlesource.com/20558
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 05:30:49 +00:00