1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:26:15 -07:00
Commit Graph

41099 Commits

Author SHA1 Message Date
Keith Randall
36f30ba289 cmd/compile,runtime: generate hash functions only for types which are map keys
Right now we generate hash functions for all types, just in case they
are used as map keys. That's a lot of wasted effort and binary size
for types which will never be used as a map key. Instead, generate
hash functions only for types that we know are map keys.

Just doing that is a bit too simple, since maps with an interface type
as a key might have to hash any concrete key type that implements that
interface. So for that case, implement hashing of such types at
runtime (instead of with generated code). It will be slower, but only
for maps with interface types as keys, and maybe only a bit slower as
the aeshash time probably dominates the dispatch time.

Reorg where we keep the equals and hash functions. Move the hash function
from the key type to the map type, saving a field in every non-map type.
That leaves only one function in the alg structure, so get rid of that and
just keep the equal function in the type descriptor itself.

cmd/go now has 10 generated hash functions, instead of 504. Makes
cmd/go 1.0% smaller. Update #6853.

Speed on non-interface keys is unchanged. Speed on interface keys
is ~20% slower:

name                  old time/op  new time/op  delta
MapInterfaceString-8  23.0ns ±21%  27.6ns ±14%  +20.01%  (p=0.002 n=10+10)
MapInterfacePtr-8     19.4ns ±16%  23.7ns ± 7%  +22.48%   (p=0.000 n=10+8)

Change-Id: I7c2e42292a46b5d4e288aaec4029bdbb01089263
Reviewed-on: https://go-review.googlesource.com/c/go/+/191198
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2019-09-03 20:41:29 +00:00
Andrew
671bcb5966 doc: add Go 1.13 to release history
Change-Id: I3340561c0b17bf28d8d480e00f5bc8afb2a897ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/193041
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2019-09-03 20:02:22 +00:00
Ian Lance Taylor
aee084b3ca cmd/compile/internal/gc: use GoToolPath in TestDeps
Updates #31563
Fixes #34041

Change-Id: Ib9fdcd2f83d867fd31b42eab3a813f5cef88860e
Reviewed-on: https://go-review.googlesource.com/c/go/+/193077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-09-03 19:54:33 +00:00
Keith Randall
7c90e2cbda bytes/hash: disable seed test on 32-bit platforms
The distribution of hash outputs when varying the seed is
not good enough on 32-bit platforms.

This isn't a likely attack vector (the adversary controlling the seed),
so it isn't a huge deal. Would be nice to fix, though. For now, just
skip this test.

Fixes #33988

Change-Id: Icf51ab687fc215422a5492ae78e6f414b33e04cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/193078
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-03 19:37:16 +00:00
Cuong Manh Le
d2f958d8d1 cmd/compile: extend ssa.go to handle 1-element array and 1-field struct
Assinging to 1-element array/1-field struct variable is considered clobbering
the whole variable. By emitting OpVarDef in this case, liveness analysis
can now know the variable is redefined.

Also, the isfat is not necessary anymore, and will be removed in follow up CL.

Fixes #33916

Change-Id: Iece0d90b05273f333d59d6ee5b12ee7dc71908c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/192979
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-09-03 19:33:04 +00:00
Than McIntosh
9da7abd2eb debug/dwarf: better handling for DW_FORM_indirect
Fix a buglet in abbrev processing related to DW_FORM_indirect. When
reading an abbrev entry if we encounter an attribute with form
DW_FORM_indirect, leave the class as ClassUnknown, then when the
abbrev is walked during the reading of the DIE fill in the class based
on the value read at that point (code for handling DW_FORM_indirect
seems to be already partially in place in the DIE reader).

Updates #33488.

Change-Id: I9dc89abf5cc8d7ea96824c0011bef979de0540bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/190158
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-09-03 18:35:32 +00:00
Matthew Dempsky
9f89edcd96 cmd/compile: silence esc diagnostics about directiface OCONVIFACEs
In general, a conversion to interface type may require values to be
boxed, which in turn necessitates escape analysis to determine whether
the boxed representation can be stack allocated.

However, esc.go used to unconditionally print escape analysis
decisions about OCONVIFACE, even for conversions that don't require
boxing (e.g., pointers, channels, maps, functions).

For test compatibility with esc.go, escape.go similarly printed these
useless diagnostics. This CL removes the diagnostics, and updates test
expectations accordingly.

Change-Id: I97c57a4a08e44d265bba516c78426ff4f2bf1e12
Reviewed-on: https://go-review.googlesource.com/c/go/+/192697
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-03 17:52:06 +00:00
Matthew Dempsky
a71967e4c5 cmd/compile: replace copytype to setUnderlying
While here, change the params to be easier to understand: "t" is now
always the type being updated, and "underlying" is now used to
represent the underlying type.

Updates #33658.

Change-Id: Iabb64414ca3abaa8c780e4c9093e0c77b76fabf9
Reviewed-on: https://go-review.googlesource.com/c/go/+/192724
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-03 17:50:54 +00:00
Matthew Dempsky
380ef6b759 cmd/compile: simplify {defer,resume}checkwidth logic
This CL extends {defer,resume}checkwidth to support nesting, which
simplifies usage.

Updates #33658.

Change-Id: Ib3ffb8a7cabfae2cbeba74e21748c228436f4726
Reviewed-on: https://go-review.googlesource.com/c/go/+/192721
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-03 17:38:32 +00:00
Ian Lance Taylor
adf20ee3c5 debug/dwarf, debug/elf: support DWARF 5
Change-Id: I6e9d47865c198299d497911c58235cd40f775e34
Reviewed-on: https://go-review.googlesource.com/c/go/+/175138
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-09-03 17:37:24 +00:00
Ian Lance Taylor
663680b3d4 debug/dwarf: add new constants defined in DWARF 5
Also add a few other missing constants.

Also rerun current version of stringer.

Change-Id: I004ef27f6b40fe2cab64c52d169255dfea43fa01
Reviewed-on: https://go-review.googlesource.com/c/go/+/175137
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-09-03 17:32:37 +00:00
Changkun Ou
3c56143442 runtime: one lock per order
This CL implements one lock per order of stackpool. It improves performance when mutator stack growth deeply, see benchmark below:

```
name                old time/op  new time/op  delta
StackGrowth-8       3.60ns ± 5%  3.59ns ± 1%    ~     (p=0.794 n=10+9)
StackGrowthDeep-8    370ns ± 1%   335ns ± 1%  -9.47%  (p=0.000 n=9+9)
StackCopyPtr-8      72.6ms ± 0%  71.6ms ± 1%  -1.31%  (p=0.000 n=9+9)
StackCopy-8         53.5ms ± 0%  53.2ms ± 1%  -0.54%  (p=0.006 n=8+9)
StackCopyNoCache-8   100ms ± 0%    99ms ± 0%  -0.70%  (p=0.000 n=8+8)
```

Change-Id: I1170d3fd9e6ff8516e25f669d0aaf1861311420f
GitHub-Last-Rev: 13b820cddd
GitHub-Pull-Request: golang/go#33399
Reviewed-on: https://go-review.googlesource.com/c/go/+/188478
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-03 17:10:37 +00:00
Ayan George
88ca80b322 plugin: add freebsd/amd64 plugin support
Change-Id: I4e7b0e99fd0f6f7d6a8ef60e9d3cb5baeb80a2b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/191617
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-03 14:27:24 +00:00
Bryan C. Mills
9f5127bfeb doc/go1.13: remove announcements of arm64 support on NetBSD and OpenBSD
Those configurations currently lack builders, and it is not clear to
me what state their tests are in.

The Go porting policy¹ requires builders for all active ports, so
let's not claim support until that requirement is met.

¹https://golang.org/wiki/PortingPolicy#requirements-for-a-new-port

Updates #30824
Updates #31656
Updates #34035
Updates #34036

Change-Id: I6496de9d92fb8546048abf139cf10546a47e314b
Reviewed-on: https://go-review.googlesource.com/c/go/+/192997
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-09-03 13:44:53 +00:00
Daniel Martí
b36a7a502a Revert "runtime: remove slow time compatibility hacks for wine"
This reverts CL 191759.

Reason for revert: broke most Go programs using the time package on Wine,
including on 4.15, the latest stable version. Only wine-staging (with
experimental patches) contains an upstream fix we could rely on.

Change-Id: Ic8ba126022e54f412174042fbb9abed82d5eb318
Reviewed-on: https://go-review.googlesource.com/c/go/+/192622
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-09-02 21:46:03 +00:00
Andrew
ea2fb678c0 doc: document Go 1.13
Change-Id: Icf7e1dab82aa48cc693eb4da8a564dff23312741
Reviewed-on: https://go-review.googlesource.com/c/go/+/192745
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-09-02 21:44:56 +00:00
Andrew Bonventre
dec16794cf doc/1.13: remove draft note and make various fixes
Fixes #33954

Change-Id: Idfe71bf825adcd7cbf70cd139b3e779963394ff6
Reviewed-on: https://go-review.googlesource.com/c/go/+/192105
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2019-09-02 19:55:59 +00:00
Ivan Trubach
060669a689 cmd/doc: make -src mode deterministic
These changes make cmd/doc -src deterministic, or, more precisely,
go/ast.MergePackageFiles, which is used by cmd/doc. So far the order of
comments depended on the package file map iteration order.

cmd/doc with -src flag has been inserting and omitting random comments
ever since the addition of -src flag. After investigating the code path
with the debugger, I’ve noticed that ast.File.Comments slice order changes
between invocations of the command. The bug was introduced in 3e24f2d,
which ironically claimed to “fix formatting of -src output”. The commit
implemented the collection of comments by iterating over the map and
c7cdce1 “godoc: make ?m=src mode deterministic” did’t actually make
go/ast.MergePackageFiles deterministic.

I’ve found this issue after running “go doc -src sync.WaitGroup.Wait”.
There are likely other packages and functions affected, but the bug
should be somewhat reproducible across all Go versions.

Change-Id: Iae223e99550c0a3b54005c5cde36f909e655b66b
GitHub-Last-Rev: c49532f79f
GitHub-Pull-Request: golang/go#33553
Reviewed-on: https://go-review.googlesource.com/c/go/+/189477
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-02 15:31:19 +00:00
tomocy
2f04903fec net: document concurrency safety and example for Dialer
Fixes #33743.

Change-Id: I80621321d56b6cf312a86e272800f1ad03c5544c
GitHub-Last-Rev: d91cb36975
GitHub-Pull-Request: golang/go#33856
Reviewed-on: https://go-review.googlesource.com/c/go/+/191879
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-09-02 14:47:38 +00:00
Daniel Martí
03ac39ce5e std: remove unused bits of code all over the place
Some were never used, and some haven't been used for years.

One exception is net/http's readerAndCloser, which was only used in a
test. Move it to a test file.

While at it, remove a check in regexp that could never fire; the field
is an uint32, so it can never be negative.

Change-Id: Ia2200f6afa106bae4034045ea8233b452f38747b
Reviewed-on: https://go-review.googlesource.com/c/go/+/192621
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-02 12:57:37 +00:00
peter zhang
d5fe73393c math/big: fix a duplicate "the" in a comment
Change-Id: Ib637381ab8a12aeb798576b781e1b3c458ba812d
GitHub-Last-Rev: 12994496b6
GitHub-Pull-Request: golang/go#34017
Reviewed-on: https://go-review.googlesource.com/c/go/+/192877
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-02 11:42:47 +00:00
spacewander
4a457e3edc net/http: merge IsDir checks in fs.go's serveFile function
Fixes #33385

Change-Id: I497ccd868d408a9c5648c72aa5ce41221368daf4
GitHub-Last-Rev: 3bf483808e
GitHub-Pull-Request: golang/go#33423
Reviewed-on: https://go-review.googlesource.com/c/go/+/188677
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-02 11:13:03 +00:00
itchyny
7450960a13 encoding/json: fix scanner byte offset on scanEnd
scanEnd is delayed one byte so we decrement
the scanner bytes count by 1 to ensure that
this value is correct in the next call of Decode.

Fixes #32399

Change-Id: I8c8698e7f95bbcf0373aceaa05319819eae9d86f
GitHub-Last-Rev: 0ac25d8de2
GitHub-Pull-Request: golang/go#32598
Reviewed-on: https://go-review.googlesource.com/c/go/+/182117
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-02 11:00:29 +00:00
Derek Phan
9c295bdeab net/http: remove redundant port validation
The URL port is already checked in net/url, so we can remove the redundant validation in net/http.

Fixes #33600

Change-Id: I62511a452df6262d4b66180933758d34627ff9df
GitHub-Last-Rev: c19afa3102
GitHub-Pull-Request: golang/go#33611
Reviewed-on: https://go-review.googlesource.com/c/go/+/190057
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-02 09:45:08 +00:00
LE Manh Cuong
fa7d40abe0 cmd/link: always set .dynsym info field
CL 187979 added set .dynsym info field, but it won't when
there are no global symbols. This CL sets that field
unconditionally.

Fixes #34000

Change-Id: Icc2f8bc74afdade88a377793e6760912b03686ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/192600
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-01 23:59:23 +00:00
Tom Thorogood
79669dc705 encoding/json: revert Compact HTML escaping documentation
This partly reverts CL 173417 as it incorrectly documented that Compact
performed HTML escaping and the output was safe to embed inside HTML
<script> tags. This has never been true.

Although Compact does escape U+2028 and U+2029, it doesn't escape <, >
or &. Compact is thus only performing a subset of HTML escaping and it's
output is not safe to embed inside HTML <script> tags.

A more complete fix would be for Compact to either never perform any
HTML escaping, as it was prior to CL 10883045, or to actually perform
the same HTML escaping as HTMLEscape. Neither change is likely safe
enough for go1.13.

Updates #30357

Change-Id: I912f0fe9611097d988048b28228c4a5b985080ba
GitHub-Last-Rev: aebababc92
GitHub-Pull-Request: golang/go#33427
Reviewed-on: https://go-review.googlesource.com/c/go/+/188717
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-01 16:43:30 +00:00
William Poussier
85f3ca7488 encoding/json: fix panic for nil instances of TextMarshaler in map keys
This change adds a a check in the encodeWithString.resolve method
to ensure that a reflect.Value with kind Ptr is not nil before
the type assertion to TextMarshaler.

If the value is nil, the method returns a nil error, and the map key
encodes to an empty string.

Fixes #33675

Change-Id: I0a04cf690ae67006f6a9c5f8cbb4cc99d236bca8
GitHub-Last-Rev: 6c987c9084
GitHub-Pull-Request: golang/go#33700
Reviewed-on: https://go-review.googlesource.com/c/go/+/190697
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-01 16:39:38 +00:00
Alex Gaynor
a806c213e7 doc: make the draft 1.13 release notes expected release date accurate
Change-Id: I17148bb2b8021ed305ed0d230675d51c41736a11
GitHub-Last-Rev: 2998d46d10
GitHub-Pull-Request: golang/go#34004
Reviewed-on: https://go-review.googlesource.com/c/go/+/192797
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-01 16:37:25 +00:00
Alberto Donizetti
e6d2544d20 test/codegen: mention -all_codegen in the README
For performance reasons (avoiding costly cross-compilations) CL 177577
changed the codegen test harness to only run the tests for the
machine's GOARCH by default.

This change updates the codegen README accordingly, explaining what
all.bash does run by default and how to perform the tests for all
architectures.

Fixes #33924

Change-Id: I43328d878c3e449ebfda46f7e69963a44a511d40
Reviewed-on: https://go-review.googlesource.com/c/go/+/192619
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-01 15:37:13 +00:00
Daniel Martí
c51909e3a5 cmd/compile: remove a few unused bits of code
Just the low-hanging fruit; code that was either never used, or its last
use was removed a while ago.

Change-Id: Ic7f90aeee3e6daf7edc16cde3c0a767d67e617ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/192618
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-01 14:25:12 +00:00
Andrew Bonventre
99df76f086 mime: update type of .js and .mjs files to text/javascript
application/javascript is being deprecated per
https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/

Specify a charset to be consistent with other text/* mime types.

Fixes #32351

Change-Id: I7300f6cfdbcf574103764991cb75172a252a3400
Reviewed-on: https://go-review.googlesource.com/c/go/+/186927
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-01 10:08:53 +00:00
Irbe Krumina
54a9c16533 path: change the output format of ExampleSplit function
At the moment the last output line of ExampleSplit- two empty strings- are being
trimmed from the output.  I have formatted the output of the function to avoid
whitespace trimming and show empty strings more clearly.

Fixes #23542

Change-Id: Ic2a4d98cfa06db1466c6c6d98099542df9e7c88b
Reviewed-on: https://go-review.googlesource.com/c/go/+/191397
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-01 10:08:36 +00:00
jsign
d15dfdc023 io/ioutil: don't check for short write in WriteFile
*os.File already does it.

Fixes #33064

Change-Id: I3edf0a31bf6d6e5023f47f01ebc92ed057357278
GitHub-Last-Rev: e6a5ba45d7
GitHub-Pull-Request: golang/go#33065
Reviewed-on: https://go-review.googlesource.com/c/go/+/185857
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-01 02:31:50 +00:00
Ou Changkun
d6143914e4 runtime: remove outdated comment in select sortkey
This CL removes an outdated comment regarding converting a pointer to `uintptr`.
The comment was introduced in Go 1.4 and runtime GC was under the consideration of major revisions. According to the current situation, Go runtime memory allocator has no fragmentation issue. Therefore compact GC won't be implemented in the near future.

Change-Id: I5c336d81d810cf57b76797f05428421bb39a5b9f
GitHub-Last-Rev: 2ab4be3885
GitHub-Pull-Request: golang/go#33685
Reviewed-on: https://go-review.googlesource.com/c/go/+/190520
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-01 00:05:48 +00:00
Brian Kessler
b003afe4fe cmd/compile: intrinsify RotateLeft32 on wasm
wasm has 32-bit versions of all integer operations. This change
lowers RotateLeft32 to i32.rotl on wasm and intrinsifies the math/bits
call.  Benchmarking on amd64 under node.js this is ~25% faster.

node v10.15.3/amd64
name          old time/op  new time/op  delta
RotateLeft    8.37ns ± 1%  8.28ns ± 0%   -1.05%  (p=0.029 n=4+4)
RotateLeft8   11.9ns ± 1%  11.8ns ± 0%     ~     (p=0.167 n=5+5)
RotateLeft16  11.8ns ± 0%  11.8ns ± 0%     ~     (all equal)
RotateLeft32  11.9ns ± 1%   8.7ns ± 0%  -26.32%  (p=0.008 n=5+5)
RotateLeft64  8.31ns ± 1%  8.43ns ± 2%     ~     (p=0.063 n=5+5)

Updates #31265

Change-Id: I5b8e155978faeea536c4f6427ac9564d2f096a46
Reviewed-on: https://go-review.googlesource.com/c/go/+/182359
Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2019-08-31 17:03:04 +00:00
LE Manh Cuong
12dbd20a50 cmd/link: set .dynsym info field
.dynsym section info field is the index of first non-local symbol, mean
the number of local symbols.

The go linker have never ever set it before, so just set it.

Fixes #33358

Change-Id: Ifde2deb7c15471b04d565861f5d81daffb0c0d3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/187979
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-31 15:49:08 +00:00
Jason A. Donenfeld
c96d794f66 ld: ensure that PE versions sync for internal and external linkage
Previously users who opted into cgo might have received a bit of a
behavior surprise when their mingw installation defaulted to a
potentially older and different set of compatibility hacks. Since Go is
explicitly targeting >=6.1 for internal linkage, propagate these changes
to external linkage too.

While we're at it, we move these values into constant variables so that
they don't become out of sync and allow for easy updating as Go
gradually drops compatibility for older operating systems.

Change-Id: I41e654d135be6e3db9088e73efeb414933e36caa
Reviewed-on: https://go-review.googlesource.com/c/go/+/191842
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-08-31 14:56:29 +00:00
Jason A. Donenfeld
8fc35238a7 ld: mark PE executables as terminal services aware
This has been the default in MSVC for a very long time, and it's hard to
imagine modern programs actually wanting the old legacy behavior. For
example, no modern programs try to install their junk into C:\windows
and therefore need to have an emulated writable windows directory.
That's not really even allowed by ACLs on modern systems.

Change-Id: Iadaca6815e39ea5c6b05c1cac5a95cfc35e5b48a
Reviewed-on: https://go-review.googlesource.com/c/go/+/191840
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-08-31 14:54:31 +00:00
Elias Naur
2afe9d4dec runtime: don't forward SIGPIPE on macOS
macOS and iOS deliver SIGPIPE signals to the main thread and not
the thread that raised it by writing to a closed socket or pipe.

SIGPIPE signals can be suppressed for sockets with the SO_NOSIGPIPE
option, but there is no similar option for pipes. We have no other
choice but to never forward SIGPIPE on macOS.

This is a fixup of reverted CL 188297.

Fixes #33384

Change-Id: I09b258b078857ad3b22025bc2902d1b12d2afd92
Reviewed-on: https://go-review.googlesource.com/c/go/+/191785
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-31 06:19:40 +00:00
OlgaVlPetrova
9f85668a65 cmd/compile/internal/ssa: simplify s = s <op> x to s <op>= x
Change-Id: I366b89e35d194ca2a7eb97a8253497bd3fc2af94
Reviewed-on: https://go-review.googlesource.com/c/go/+/142019
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-08-31 02:52:13 +00:00
Eli Bendersky
d47526ed77 test2json: default to "pass" when the test doesn't report failures
When a test has a TestMain that doesn't run any tests (doesn't invoke
m.Run), `go test` passes, but `go test -json` reports a "fail" event
though the exit code is still 0.

This CL fixes test2json to behave similarly to `go test` in such cases -
no output from the test is taken as "pass" by default, not as "fail".

Fixes #31969

Change-Id: I1829d40fc30dc2879e73974fac416f6a34212ccd
Reviewed-on: https://go-review.googlesource.com/c/go/+/192104
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-31 01:06:32 +00:00
Emmanuel Odeke
bac5b3f0fe os: skip TestPipeThreads on GOOS=darwin
Updates #32326.
Updates #33953.

Change-Id: I97a1cbe682becfe9592e19294d4d94f5e5b16c21
Reviewed-on: https://go-review.googlesource.com/c/go/+/192342
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-31 00:57:57 +00:00
Simon Ferquel
e5e5fb024a runtime: do not crash in lastcontinuehandler when running as DLL
If Go DLL is used by external C program, and lastcontinuehandler
is reached, lastcontinuehandler will crash the process it is
running in.

But it should not be up to Go runtime to decide if process to be
crashed or not - it should be up to C runtime. This CL adjusts
lastcontinuehandler to not to crash when running as DLL.

Fixes #32648.

Change-Id: Ia455e69b8dde2a6f42f06b90e8af4aa322ca269a
GitHub-Last-Rev: dbdffcb432
GitHub-Pull-Request: golang/go#32574
Reviewed-on: https://go-review.googlesource.com/c/go/+/181839
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-08-31 00:47:27 +00:00
Ben Shi
1786ecd502 cmd/compile: eliminate WASM's redundant extension & wrapping
This CL eliminates unnecessary pairs of I32WrapI64 and
I64ExtendI32U generated by the WASM backend for IF
statements. And it makes the total size of pkg/js_wasm/
decreases about 490KB.

Change-Id: I16b0abb686c4e30d5624323166ec2d0ec57dbe2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/191758
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2019-08-30 21:20:03 +00:00
Cherry Zhang
cd03fd05b5 runtime: remove unnecessary variable decls in asm.s
runtime/asm.s contains two variable declarations that don't seem
needed. The variables are defined in Go and not referenced in
assembly. They were added in 2014 during the C to Go transition.
Maybe they were useful at that time, but not now. Remove them.

Change-Id: Id00d724813d18db47126c2f2b8cacfc9d77ffd4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/192378
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-08-30 20:41:54 +00:00
David Chase
b177d8802c cmd/compile: print lines missing is_stmt if testing.Verbose()
helpful for debugging failures to figure out which lines
disappeared to cause the failure.

Change-Id: Id42b64a65f76eed47e01003f05346bc09cec27e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/188019
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-08-30 20:11:59 +00:00
micnncim
4219aec60a syscall: fix duplicate comments
Removed repetitions of "the" in some comments.

Change-Id: I36a6f51609765076de32e1b97398c4c08743aafc
GitHub-Last-Rev: 4d06aea6a7
GitHub-Pull-Request: golang/go#33797
Reviewed-on: https://go-review.googlesource.com/c/go/+/191497
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-08-30 19:28:35 +00:00
Ben Shi
8d5197d818 cmd/compile: optimize 386's math.bits.TrailingZeros16
This CL reverts CL 192097 and fixes the issue in CL 189277.

Change-Id: Icd271262e1f5019a8e01c91f91c12c1261eeb02b
Reviewed-on: https://go-review.googlesource.com/c/go/+/192519
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-08-30 17:37:00 +00:00
zdjones
ba068c1a6f cmd/compile: rename poset method dominates to reaches
The partially ordered set uses a method named 'dominates' to determine whether
two nodes are partially ordered. Dominates does a depth-first search of the
DAG, beginning at the source node, and returns true as soon as it finds a path
to the target node. In the context of the forest-of-DAGs that makes up the
poset, dominates is not necessarily checking dominance, but is checking
reachability. See the issue tracker for a more detailed discussion of the
difference.

Fortunately, reachability is logically correct everywhere dominates is currently
used in poset.go. Reachability within a DAG is sufficient to establish the
partial ordering (source < target).

This CL changes the name of the method (dominates -> reaches) and updates
all the comments in the file accordingly.

Fixes #33971.

Change-Id: Ia3a34f7b14b363801d75b05099cfc686035f7d96
Reviewed-on: https://go-review.googlesource.com/c/go/+/192617
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-30 17:22:14 +00:00
Rhys Hiltner
9d480edadc cmd/cover: skip go list when profile is empty
Only call "go list" when explicitly listing packages. An empty coverage
profile references no packages, and would otherwise lead to "go list"
implicitly looking at the package in "." (which might not exist).

Fixes #33855

Change-Id: I02d4e374405d86f03d105fe14648aa03b4d2284c
Reviewed-on: https://go-review.googlesource.com/c/go/+/192340
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-30 17:07:53 +00:00