1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:24:54 -07:00
Commit Graph

43416 Commits

Author SHA1 Message Date
Katie Hockman
9dcd6b32c8 crypto: implement Hash.String
Fixes #33430

Change-Id: I323323b3136dd7b408005c3bb5ea05e3b566bd38
Reviewed-on: https://go-review.googlesource.com/c/go/+/224937
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-03-24 17:24:24 +00:00
Cherry Zhang
ea93ddfaeb [dev.link] cmd/link: use Extname in doxcoff
On AIX, when external linking, we need to change the function
names to start with a dot and make function descriptors with the
names without the dot. Currently this is done through symbol
renaming, which is not friendly for switching to the loader.

In this CL we use symbol's external name for this. This allows us
to get rid of symbol renaming.

Change-Id: If72602d17e96f0339fdac2e2321f1edfb292b5f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/224940
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-24 16:43:33 +00:00
Cherry Zhang
ed7a491940 [dev.link] cmd/link: convert mangleTypeSym to new style
Use symbol's Extname, instead of symbol renaming, for the mangled
names.

The old symbol Rename has an interesting logic of "merging"
symbols, when a symbol is renamed to the name of an existing
symbol. It turns out that this is needed for linking against
shared libraries, where the Go object has a reference to a symbol
with the original name, and the shared libary provides a symbol
under the mangled name. Implement this logic with the loader.

Change-Id: Ib95d7a9c93a52f8e02f4a51ac67240d6ebfc1c6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/224939
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-24 16:43:18 +00:00
Jeremy Faller
b328ab1d1e [dev.link] cmd/link: remove global datap, moved to *Link
This change moves datap from global space into the link context. Rather
than having it exist in context, we could have it returned from dodata,
and pass it as a parameter, but it is used in awkward places in the
Arch functions. Easiest for now is just keeping it in the context, until
we more formally move it to slices of loader.Sym.

This is a largely non-functional change.

Change-Id: Ica93bd857c39913ad470a61c63bc8d21704d6308
Reviewed-on: https://go-review.googlesource.com/c/go/+/222664
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-24 16:01:15 +00:00
Jeremy Faller
4d5fdd74ab [dev.link] cmd/link: refactor some of dodata
This is a non-functional change, just moving things around, making
dodata a more approachable piece of code.

Change-Id: I06fa047cbef2313040a31998fa8d242ccb2fedea
Reviewed-on: https://go-review.googlesource.com/c/go/+/222662
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-24 16:00:49 +00:00
Joel Sing
ade988623e cmd/compile: provide Load32/Load64/Store32/Store64 atomic intrinsics on riscv64
Updates #36765

Change-Id: Id5ce5c5f60112e4f4cf9eec1b1ec120994934950
Reviewed-on: https://go-review.googlesource.com/c/go/+/223558
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-24 14:21:50 +00:00
Ian Lance Taylor
20b46c7c69 runtime: negate errno value for mips pipe/pipe2
The callers expect negative errno values, so negate them when necessary.

No test because there is no reasonable way to make pipe/pipe2 fail.
This was reported on a system on which pipe2 returned ENOSYS.

Fixes #37997

Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508
Reviewed-on: https://go-review.googlesource.com/c/go/+/224592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-03-24 11:03:07 +00:00
nao20010128nao
9ef61d58c0 syscall/js: make wasm_exec.js compatible with Webpack
In Webpack, require("fs") will always be empty. This behavior throws an error: "fs.writeSync is not function". It happens when you did "fmt.Println".
This PR avoids such problem and use polyfill in wasm_exec.js on Webpack.

Change-Id: I55f2c75ce86b7f84d2d92e8e217b5decfbe3c8a1
GitHub-Last-Rev: aecc847e3f
GitHub-Pull-Request: golang/go#35805
Reviewed-on: https://go-review.googlesource.com/c/go/+/208600
Reviewed-by: Richard Musiol <neelance@gmail.com>
2020-03-24 10:33:13 +00:00
Aurélio A. Heckert
f0e8b81aa3 syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArray
closes #38011

Change-Id: Ic50f2f27456dccdc3fca1bda076871af1eb81705
Reviewed-on: https://go-review.googlesource.com/c/go/+/224638
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-24 10:31:12 +00:00
Michael Matloob
6a9d850b82 cmd/go: list test packages even when the main package has an error
List test packages (when list is run with -e) even when the main package
has an error. This is useful to get complete data for go/packages.

Fixes #37971

Change-Id: If6ba0270a319ea5e003d1ed8b1ad39e479e95509
Reviewed-on: https://go-review.googlesource.com/c/go/+/224944
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-24 00:04:19 +00:00
Bryan C. Mills
fb2a6343de Revert "crypto/rsa,crypto/ecdsa,crypto/ed25519: implement PublicKey.Equal"
This reverts CL 223754.

Reason for revert: new tests are failing on all longtest builders.

Change-Id: I2257d106c132f3a02c0af6b20061d4f9a8093c4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/225077
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-23 21:15:27 +00:00
Keith Randall
5b897ec017 cmd/compile: disable addressingmodes pass for 386
Update #37881

Change-Id: I1f9a3f57f6215a19c31765c257ee78715eab36b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/225057
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-23 20:31:13 +00:00
Dan Scales
5113f57766 cmd/go: define a build tag for any GOEXPERIMENT which is enabled.
For each experiment that has been enabled in the toolchain, define a build tag
with the same name (but prefixed by "goexperiment.") which can be used for
compiling alternative files for the experiment. This allows changes for the
experiment, like extra struct fields in the runtime, without affecting the base
non-experiment code at all.

I use this capability in my CL for static lock ranking
(https://go-review.googlesource.com/c/go/+/207619), so that static lock ranking
can be fully enabled as a GOEXPERIMENT, but there is no overhead in the runtime
when the experiment is not enabled.

I added a test in cmd/go/testdata/scripts to make sure the build tags are being
defined properly. In order to implement the test, I needed to provide environment
variable GOEXPSTRING to the test scripts (with its value set from
objabi.Expstring(), so that it can determine the experiments baked into the
toolchain.

I filed https://github.com/golang/go/issues/37937 to make a builder with
GOEXPERIMENT set to 'staticlockranking'. This builder will ensure another variant
of GOEXPERIMENT is being tested regularly for this change, as well as checking
static lock ranking in the runtime.

Change-Id: Ieb4b86107238febd105558c1e639d30cfe57ab5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/222925
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-23 19:24:26 +00:00
Andy Pan
6aded2524c strings: narrow the search range of IndexByte in Index
Same as https://golang.org/cl/224589.

Change-Id: I6a9e2ea60bf6e1888a95bad0331c92079a7eff99
GitHub-Last-Rev: 81c13c0f5b
GitHub-Pull-Request: golang/go#38016
Reviewed-on: https://go-review.googlesource.com/c/go/+/224593
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-23 19:14:29 +00:00
Keith Randall
3adbdb6d99 cmd/compile: disable mem+op operations on 386
Rolling back portions of CL 222782 to see if that helps
issue #37881 any.

Update #37881

Change-Id: I9cc3ff8c469fa5e4b22daec715d04148033f46f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/224837
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-23 18:27:37 +00:00
Filippo Valsorda
5c9bd499e1 crypto/rsa,crypto/ecdsa,crypto/ed25519: implement PublicKey.Equal
This makes all modern public keys in the standard library implement a
common interface (below) that can be used by applications for better
type safety and allows for checking that public (and private keys via
Public()) are equivalent.

interface {
    Equal(crypto.PublicKey) bool
}

Equality for ECDSA keys is complicated, we take a strict interpretation
that works for all secure applications (the ones not using the
unfortunate non-constant time CurveParams implementation) and fails
closed otherwise.

Tests in separate files to make them x_tests and avoid an import loop
with crypto/x509.

Fixes #21704

Change-Id: Id5379c96384a11c5afde0614955360e7470bb1c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/223754
Reviewed-by: Katie Hockman <katie@golang.org>
2020-03-23 17:56:24 +00:00
Giovanni Bajo
24925c7ed9 cmd/compile: fold LEAQ with constant scale into LEA
Discovered this after rebasing CL196679 (use poset bounds in prove).
Some tests fail with that CL applied:

codegen/smallintiface.go:11: linux/amd64/: opcode not found: "^LEAQ\\truntime.staticuint64s\\+8\\(SB\\)"
codegen/smallintiface.go:16: linux/amd64/: opcode not found: "^LEAQ\\truntime.staticuint64s\\+2024\\(SB\\)"
codegen/smallintiface.go:21: linux/amd64/: opcode not found: "^LEAQ\\truntime.staticuint64s\\+24\\(SB\\)"

The only difference in prove SSA dumps is that a single Lsh64x64
op with constant shift (<< 3) is marked as bounded. This triggers
a different rule matching sequence in lower, which manages to generate
worse code for the above testcases.

This CL fixes the above test after CL196679 is applied. Right now,
these rules never trigger (this CL passes toolstash -cmp), so I can't
write a test.

Change-Id: I353f1c79c1875cac1da82cd8afa1e05e42684f1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/224877
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-23 17:47:29 +00:00
Roland Shoemaker
5d47f870a6 crypto/x509: add RevocationList and CreateRevocationList
The existing Certificate.CreateCRL method generates non-conformant CRLs and
as such cannot be used for implementations that require standards
compliance. This change implements a new top level method, CreateCRL, which
generates compliant CRLs, and offers an extensible API if any
extensions/fields need to be supported in the future.

Here is an example Issuer/CRL generated using this change:
-----BEGIN CERTIFICATE-----
MIIBNjCB3aADAgECAgEWMAoGCCqGSM49BAMCMBIxEDAOBgNVBAMTB3Rlc3Rpbmcw
IhgPMDAwMTAxMDEwMDAwMDBaGA8wMDAxMDEwMTAwMDAwMFowEjEQMA4GA1UEAxMH
dGVzdGluZzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLHrudbSM36sn1VBrmm/
OfQTyEsI4tIUV1VmneOKHL9ENBGCiec4GhQm2SGnDT/sZy2bB3c3yozh/roS6cZJ
UZqjIDAeMA4GA1UdDwEB/wQEAwIBAjAMBgNVHQ4EBQQDAQIDMAoGCCqGSM49BAMC
A0gAMEUCIQCoAYN6CGZPgd5Sw5a1rd5VexciT5MCxTfXj+ZfJNfoiAIgQVCTB8AE
Nm2xset7+HOgtQYlKNw/rGd8cFcv5Y9aUzo=
-----END CERTIFICATE-----
-----BEGIN X509 CRL-----
MIHWMH0CAQEwCgYIKoZIzj0EAwIwEjEQMA4GA1UEAxMHdGVzdGluZxgPMDAwMTAx
MDIwMDAwMDBaGA8wMDAxMDEwMzAwMDAwMFowFjAUAgECGA8wMDAxMDEwMTAxMDAw
MFqgHjAcMA4GA1UdIwQHMAWAAwECAzAKBgNVHRQEAwIBBTAKBggqhkjOPQQDAgNJ
ADBGAiEAjqfj/IG4ys5WkjrbTNpDbr+saHGO/NujLJotlLL9KzgCIQDm8VZPzj0f
NYEQgAW4nsiUzlvEUCoHMw0141VCZXv67A==
-----END X509 CRL-----

Fixes #35428

Change-Id: Id96b6f47698d0bed39d586b46bd12374ee6ff88f
GitHub-Last-Rev: c83a601716
GitHub-Pull-Request: golang/go#36945
Reviewed-on: https://go-review.googlesource.com/c/go/+/217298
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-23 17:23:03 +00:00
Michael Anthony Knyszek
67c2dcbc59 runtime: use OnesCount64 to count allocated objects in a span
This change modifies the implementation of (*mspan).countAlloc by
using OnesCount64 (which on many systems is intrinsified). It does so by
using an unsafe pointer cast, but in this case we don't care about
endianness because we're just counting bits set.

This change means we no longer need the popcnt table which was redundant
in the runtime anyway. We can also simplify the logic here significantly
by observing that mark bits allocations are always 8-byte aligned, so we
don't need to handle any edge-cases due to the fact that OnesCount64
operates on 64 bits at a time: all irrelevant bits will be zero.

Overall, this implementation is significantly faster than the old one on
amd64, and should be similarly faster (or better!) on other systems
which support the intrinsic. On systems which do not, it should be
roughly the same performance because OnesCount64 is implemented using a
table in the general case.

Results on linux/amd64:

name                         old time/op  new time/op  delta
MSpanCountAlloc/bits=64-4    16.8ns ± 0%  12.7ns ± 0%  -24.40%  (p=0.000 n=5+4)
MSpanCountAlloc/bits=128-4   23.5ns ± 0%  12.8ns ± 0%  -45.70%  (p=0.000 n=4+5)
MSpanCountAlloc/bits=256-4   43.5ns ± 0%  12.8ns ± 0%  -70.67%  (p=0.000 n=4+5)
MSpanCountAlloc/bits=512-4   59.5ns ± 0%  15.4ns ± 0%  -74.12%  (p=0.008 n=5+5)
MSpanCountAlloc/bits=1024-4   116ns ± 1%    23ns ± 0%  -79.84%  (p=0.000 n=5+4)

Change-Id: Id4c994be22224653af5333683a69b0937130ed04
Reviewed-on: https://go-review.googlesource.com/c/go/+/216558
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-23 17:07:22 +00:00
Michael Anthony Knyszek
7af6a31b48 runtime: add countAlloc benchmark
This change adds a small microbenchmark for (*mspan).countAlloc, which
we're about to replace. Admittedly this isn't a critical piece of code,
but the benchmark was useful in understanding the performance change.

Change-Id: Iea93c00f571ee95534a42f2ef2ab026b382242b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/224438
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-23 16:55:37 +00:00
Michael Anthony Knyszek
8c30971da6 cmd/compile: panic if trying to alias an intrinsic with no definitions
Currently if we try to alias an intrinsic which hasn't been defined for
any architecture (such as by accidentally creating the alias before the
intrinsic is created with addF), then we'll just silently not apply any
intrinsics to those aliases.

Catch this particular case by panicking in alias if we try to apply the
alias and it did nothing.

Change-Id: I98e75fc3f7206b08fc9267cedb8db3e109ec4f5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/224637
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-23 16:01:20 +00:00
Michael Anthony Knyszek
830ee4792e cmd/compile: declare runtime bit func aliases after math/bits intrinsics
Currently runtime/internal/sys bit-manipulation functions are aliased to
math/bits functions, which are intrinsified. Unfortunately these aliases
are declared before the intrinsified versions are generated, resulting
in the generic version of the code being copied over.

This change moves the aliases for bit operations in runtime/internal/sys
after the addF calls to generate those intrinsics in SSA, so that the
intrinsified SSA representation of those functions actually get copied
over.

This should improve the overall performance of the runtime (especially
the page allocator) since these bit operations will actually be
intrinsified now.

Change-Id: I4377da13f9a7bb6aee608e50df0297148bf8f806
Reviewed-on: https://go-review.googlesource.com/c/go/+/224437
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-23 15:52:57 +00:00
Than McIntosh
d44c9a046b [dev.link] cmd/link: set "local" attribute on symbols during preload
Set the "local" attribute on object file loader symbols during preload,
as opposed to the current strategy of only propagating the local attr
when we convert to sym.Symbols.

Change-Id: I18965e2fdaa9a0b9315d95466d17d9f41aa40a45
Reviewed-on: https://go-review.googlesource.com/c/go/+/224379
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-23 15:10:28 +00:00
Than McIntosh
49099d21f5 [dev.link] cmd/link: add loader.Loader apis for symbol dynamic id
Add SymDynid and SetSymDynid methods to the loader. This symbol
property is currently backed by a map.

Change-Id: Iaf86b1d8aaa775fa102fadea30394eb8a670e0e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/224378
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-23 15:10:20 +00:00
Cherry Zhang
5ffa696ade [dev.link] cmd/link: invoke oldlink if old object format is chosen
Now we can choose the old object file format by setting
-gcflags=all=-go115newobj=false -asmflags=all=-go115newobj=false -ldflags=all=-go115newobj=false

Tested that setting all three to default false and it still works.

Change-Id: I9514b62a676916cc383b8afa389489fe7b8fa2bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/224625
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23 14:42:58 +00:00
Cherry Zhang
6c7d6cefd0 [dev.link] cmd/internal/obj: restore old DWARF symbol handling
When old object file format is used, serialize DWARF symbols in
the old way.

Change-Id: I73a97f10bba367ac29c52f8f3d0f8f3b34a42523
Reviewed-on: https://go-review.googlesource.com/c/go/+/224624
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23 14:39:03 +00:00
Cherry Zhang
330f53b615 [dev.link] cmd/asm, cmd/compile: add back newobj flag
Add back the newobj flag, renamed to go115newobj, for feature
gating. The flag defaults to true.

This essentially reverts CL 206398 as well as CL 220060.

The old object format isn't working yet. Will fix in followup CLs.

Change-Id: I1ace2a9cbb1a322d2266972670d27bda4e24adbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/224623
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23 14:38:49 +00:00
Cherry Zhang
54c32590f0 [dev.link] cmd/oldlink: add back the old linker
Basically a "cp -r" from tip's cmd/link (at commit
776a9d0958), and fix up import
paths.

It is not used for now. A flag will be introduced in followup
CLs, which will allow to switch between the old and new linker.

Some adjustments to make it still build:
- Adjust accessor of NoSplit attribute to match the change in
  goobj2 package (cmd/oldlink/internal/loader/loader.go:1206).
- Change sym.Symbol's Len method to Length to match the new
  interface in cmd/internal/dwarf
  (cmd/oldlink/internal/sym/symbol.go:102).
- Add a TODO for deletion (cmd/oldlink/main.go:5).

Change-Id: I76e62f259cb6b494280f5511f75913bc37874746
Reviewed-on: https://go-review.googlesource.com/c/go/+/224622
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23 14:38:38 +00:00
Cherry Zhang
f652eb72b6 [dev.link] cmd/internal/dwarf: add back some constant prefixes
They are still used by the old linker.

This is for introducing gating for the new object file format and
the new linker.

Change-Id: I97bb6ab4cc2c03f90f199c705d4c127e45ca07f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/224621
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23 14:38:30 +00:00
Matthew Dempsky
bb929b7452 cmd/compile: skip generating args_stackmap for "pulled" funcs
In golang.org/cl/171464, we cleaned up generation of .stkobj linker
symbols, but we couldn't figure out why a similar cleanup to
.args_stackmap linker symbols caused problems.

The issue is that we only need/want to generate .args_stackmap for
functions that are implemented in assembly in the same package. When
"pulling" a function from another package via //go:linkname, we can
safely skip emitting .args_stackmap, because compiling that package
will have generated it, if necessary.

Fixes #31615.

Change-Id: If8680aa7dd5b4e8f268b6b032d746f1b8536c867
Reviewed-on: https://go-review.googlesource.com/c/go/+/223238
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: Keith Randall <khr@golang.org>
2020-03-23 03:56:18 +00:00
Andy Pan
0c30245996 runtime: correct the system-call name of kevent in comment
Change-Id: Ib1f4a6f7e36d28eff39f597df5c4703bf62654a4
GitHub-Last-Rev: 15ea1b9fa8
GitHub-Pull-Request: golang/go#37994
Reviewed-on: https://go-review.googlesource.com/c/go/+/224590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-23 03:51:02 +00:00
Andy Pan
1250a324b4 bytes: narrow the search of IndexByte in Index
Change-Id: I5a47b18b64e7f781dcc77440b06de36966e3d01d
GitHub-Last-Rev: 8576f1931d
GitHub-Pull-Request: golang/go#37993
Reviewed-on: https://go-review.googlesource.com/c/go/+/224589
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-23 03:44:45 +00:00
Allen Li
ab2cc45cc9 go/ast: fix inflection in comments to match plurality
Change-Id: I3a725c5691a1090952acdc2ae0bed96aaa8d7067
GitHub-Last-Rev: 339a0dda36
GitHub-Pull-Request: golang/go#37256
Reviewed-on: https://go-review.googlesource.com/c/go/+/219737
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-03-23 03:31:16 +00:00
Ben Schwartz
02e492f1a3 runtime: speed up receive on empty closed channel
Currently, nonblocking receive on an open channel is about
700 times faster than nonblocking receive on a closed channel.
This change makes closed channels equally fast.

Fixes #32529.  Includes a correction based on #36714.

relevant benchstat output:
name                       old time/op    new time/op    delta
MakeChan/Byte-40            140ns ± 4%     137ns ± 7%   -2.38%  (p=0.023 n=17+19)
MakeChan/Int-40             174ns ± 5%     173ns ± 6%     ~     (p=0.437 n=18+19)
MakeChan/Ptr-40             315ns ±15%     301ns ±15%     ~     (p=0.051 n=20+20)
MakeChan/Struct/0-40        123ns ± 8%      99ns ±11%  -19.18%  (p=0.000 n=20+17)
MakeChan/Struct/32-40       297ns ± 8%     241ns ±18%  -19.13%  (p=0.000 n=20+20)
MakeChan/Struct/40-40       344ns ± 5%     273ns ±23%  -20.49%  (p=0.000 n=20+20)
ChanNonblocking-40         0.32ns ± 2%    0.32ns ± 2%   -1.25%  (p=0.000 n=19+18)
SelectUncontended-40       5.72ns ± 1%    5.71ns ± 2%     ~     (p=0.326 n=19+19)
SelectSyncContended-40     10.9µs ±10%    10.6µs ± 3%   -2.77%  (p=0.009 n=20+16)
SelectAsyncContended-40    1.00µs ± 0%    1.10µs ± 0%  +10.75%  (p=0.000 n=18+19)
SelectNonblock-40          1.22ns ± 2%    1.21ns ± 4%     ~     (p=0.141 n=18+19)
ChanUncontended-40          240ns ± 4%     233ns ± 4%   -2.82%  (p=0.000 n=20+20)
ChanContended-40           86.7µs ± 0%    82.7µs ± 0%   -4.64%  (p=0.000 n=20+19)
ChanSync-40                 294ns ± 7%     284ns ± 9%   -3.44%  (p=0.006 n=20+20)
ChanSyncWork-40            38.4µs ±19%    34.0µs ± 4%  -11.33%  (p=0.000 n=20+18)
ChanProdCons0-40           1.50µs ± 1%    1.63µs ± 0%   +8.53%  (p=0.000 n=19+19)
ChanProdCons10-40          1.17µs ± 0%    1.18µs ± 1%   +0.44%  (p=0.000 n=19+20)
ChanProdCons100-40          985ns ± 0%     959ns ± 1%   -2.64%  (p=0.000 n=20+20)
ChanProdConsWork0-40       1.50µs ± 0%    1.60µs ± 2%   +6.54%  (p=0.000 n=18+20)
ChanProdConsWork10-40      1.26µs ± 0%    1.26µs ± 2%   +0.40%  (p=0.015 n=20+19)
ChanProdConsWork100-40     1.27µs ± 0%    1.22µs ± 0%   -4.15%  (p=0.000 n=20+19)
SelectProdCons-40          1.50µs ± 1%    1.53µs ± 1%   +1.95%  (p=0.000 n=20+20)
ChanCreation-40            82.1ns ± 5%    81.6ns ± 7%     ~     (p=0.483 n=19+19)
ChanSem-40                  877ns ± 0%     719ns ± 0%  -17.98%  (p=0.000 n=18+19)
ChanPopular-40             1.75ms ± 2%    1.78ms ± 3%   +1.76%  (p=0.002 n=20+19)
ChanClosed-40               215ns ± 1%       0ns ± 6%  -99.82%  (p=0.000 n=20+18)

Previously committed in CL 181543 and reverted in CL 216158.

Change-Id: Ib767b08d724cfad03598d77271dbc1087485feb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/216818
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-22 20:37:22 +00:00
kadern0
9a2db7c41b cmd/compile: remove unused isIntOrdering method
Fixes #37989

Change-Id: Iabf86529fde3be9a98222b7e8d09ff8301cf8830
Reviewed-on: https://go-review.googlesource.com/c/go/+/224777
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-22 11:16:34 +00:00
Giovanni Bajo
683c266f95 build: add default GOROOT_BOOTSTRAP in Windows
CL 57753 added support to make.bash and make.rc to
default GOROOT_BOOTSTRAP to 'go env GOROOT'. This
patch does the same in make.bat for Windows.

Updates #18545
Fixes #28641

Change-Id: I9152cc5080ed219b4de5bad0bd12d7725422ee1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/96455
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-03-22 08:44:07 +00:00
Giovanni Bajo
787e7b048c build: force all Windows batch files to CRLF
Batch files should use CRLF endings. LF endings mostly
work but in some situations they cause random errors like
goto commands failing for mysterious reasons. See
golang.org/issue/37791 for more information.

Next CL triggered one of such bug (a label was not being
recognized), so prepare for it by converting to CRLF.

This CL also touches all existing batch files to force git
to update the line endings (unfortunately, changing
.gitattributes only has effect next time the file is checked
out or modified).

Fixes #37791
Updates #9281

Change-Id: I6f9a114351cb7ac9881914400aa210c930eb8cc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/96495
Run-TryBot: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-03-22 08:42:38 +00:00
Ian Lance Taylor
2910c5b4a0 cmd/go: fix function name in comment
Fixes #37991

Change-Id: Ica58223f8564ec5d501d5b90b4258ffb78c42af1
Reviewed-on: https://go-review.googlesource.com/c/go/+/224587
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-03-22 01:21:05 +00:00
d-tsuji
36b815edd6 net/http: remove period at end of error message
Change-Id: I4ff5411543c200344babb754fc089e10e29e0fe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/224697
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-22 00:10:27 +00:00
Austin Clements
6def07cf1e [dev.link] cmd/link: finish phase CPU profile before running GC
Currently, phase profiling runs GC at the end of a phase before
stopping the CPU profile. Rearrange things so we stop the CPU profile
right when we collect the end time-stamp and before dealing with GCs
and heap profiles.

Change-Id: I9a84b9b17c7db7f8cacf591147de15464298b6af
Reviewed-on: https://go-review.googlesource.com/c/go/+/224620
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-21 13:48:38 +00:00
Austin Clements
fb0c3ee13d [dev.link] cmd/link: improve documentation on -benchmarkprofile
Change-Id: Ib55017f538b6c4ba805e56491b6a59942fad64ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/224618
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-21 13:48:36 +00:00
Austin Clements
105053fa19 [dev.link] cmd/link: record per-phase memory profile
We already have an option to record per-phase CPU profiles. If we're
in "mem" benchmark mode, then it also makes sense to collect a heap
profile of the live heap at the end of a phase. This CL adds that
profile and changes the extensions of the profiles to "cpuprof" and
"memprof" to make the distinction clear.

Change-Id: Ia05b7fa18bccad954a875f7a55d9cff5ad8dfaaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/224617
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-21 13:48:35 +00:00
Alex Brainman
d467f3bbc9 runtime: ignore error returned by PowerRegisterSuspendResumeNotification
It appears that PowerRegisterSuspendResumeNotification is not supported
when running inside Docker - see issues #35447, #36557 and #37149.

Our current code relies on error number to determine Docker environment.
But we already saw PowerRegisterSuspendResumeNotification return
ERROR_FILE_NOT_FOUND, ERROR_INVALID_PARAMETERS and ERROR_ACCESS_DENIED
(see issues above). So this approach is not sustainable.

Just ignore PowerRegisterSuspendResumeNotification returned error.

Fixes #37149

Change-Id: I2beba9d45cdb8c1efac5e974e747827a6261915a
Reviewed-on: https://go-review.googlesource.com/c/go/+/219657
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-03-21 06:00:19 +00:00
Keith Randall
287d67e3dd cmd/compile: indexed loads/stores can't be faultOnNilArg0
Because of the index, these ops can't guarantee faulting if arg0 is nil.

Clean up the PPC64 index ops - they can't take a sym or an offset.

Noticed while debugging #37881. I don't think it is the cause, but I guess
there is a chance.
Update #37881

Change-Id: Ic22925250bf7b1ba64e3cea1a65638bc4bab390c
Reviewed-on: https://go-review.googlesource.com/c/go/+/224457
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-21 02:46:16 +00:00
Than McIntosh
7055f01e12 [dev.link] cmd/link: minor perf tweak for PropagateLoaderChangesToSymbols
When fixing up relocations in PropagateLoaderChangesToSymbols, don't
reallocate the target sym.Symbol relocation slice if it already has
the desired size (this gets rid of some unneeded allocations).

Change-Id: I05287772c18cab861c2df805fa9497103fb00dcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/224420
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-20 20:31:35 +00:00
Keith Randall
5bc75a3097 runtime: handle empty stack in expandFinalInlineFrame
Fixes #37967

Change-Id: I6fc22bdd65f0263d5672731b73d09249201ab0aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/224458
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-03-20 20:01:06 +00:00
Alberto Donizetti
c5058652fd math/big: document that Sqrt doesn't set Accuracy
Document that the Float.Sqrt method does not set the receiver's
Accuracy field.

Updates #37915

Change-Id: Ief1dcac07eacc0ef02f86bfac9044501477bca1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/224497
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-03-20 19:24:37 +00:00
Than McIntosh
0dff5b0b9e [dev.link] cmd/compile, cmd/link: move away from DWARF file renumbering
This patch moves the compiler and linker away from the current scheme
used to generate file references in DWARF subprogram dies.

Up until now the scheme has been to have the compiler emit a special
relocation on a DIE file reference that points to the file symbol in
question. The linker then reads this relocation and updates the addend
to the index of the appropriate file in the line table of the
compilation unit of the DIE (the linker emits the comp unit file
table, so it knows at that point what number use). The drawback of
this scheme is that it requires a lot of relocation processing.

With this patch, we switch to having the compiler emit the file index
directly, and then have the linker use the compiler-generated file
table to emit the line table file section (no renumbering, no
relocations, etc).

Change-Id: Id4fbe67b28a64200a083e3c5ea358dbe091ec917
Reviewed-on: https://go-review.googlesource.com/c/go/+/223318
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-20 16:19:22 +00:00
Than McIntosh
673a02a235 [dev.link] cmd/compile, cmd/link: move DWARF info sym to anonymous aux data
Switch the primary subprogram die DWARF symbol emitted by the compiler
from named+dupOK to anonymous aux. This should help performance wise
by not having to add these symbols to the linker's symbol name lookup
tables.

Change-Id: Idf66662b8bf60b3dee9a55e6cd5137b24a9f5ab6
Reviewed-on: https://go-review.googlesource.com/c/go/+/223669
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-20 16:19:15 +00:00
Than McIntosh
62b0790a79 [dev.link] cmd/compile: refactor aux handling in newobj sym traversal
Generalize symbol traversal code for aux symbols to allow for client
control over whether the walk incldues symbols referenced by
relocations on visited aux syms. This is not needed just yet but will
be required in order to support anonymous aux syms that have
relocations.

Change-Id: I898c1f398213c8d9d777dd3c40524a013b25e348
Reviewed-on: https://go-review.googlesource.com/c/go/+/223668
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-20 16:19:07 +00:00