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

46938 Commits

Author SHA1 Message Date
Bryan C. Mills
5f15af111c syscall: comment on fields omitted from the win32finddata1 struct
Updates #42637

Change-Id: I4c7d38034b60c2c04efdeb530a97d96deddfd6fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/284152
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-02-25 22:38:21 +00:00
Matthew Dempsky
9a7fe196e4 Revert "cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in go/defer"
This reverts commit CL 294849.

Reason for revert: this doesn't actually fix the issue, as revealed
by the noopt builder's failures.

Change-Id: Ib4ea9ceb4d75e46b3b91ec348b365fd8c83316ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/296629
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-02-25 21:52:49 +00:00
Joe Tsai
b83d073e9e reflect: add Method.IsExported and StructField.IsExported methods
The IsExported method is a more intuitive helper for checking whether
the method or field is exported than checking whether PkgPath is empty.

In the same CL, modify the standard library to make use of this helper.

Fixes #41563

Change-Id: Iaacfb3b74449501f98e2707aa32095a32bd3c3c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/266197
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-25 21:21:51 +00:00
Josh Bleecher Snyder
7fcf9893f7 cmd/internal/obj: fix typo in docs
Change-Id: I5a3d26a4cc59b327d46ca24bcb01ef594758c230
Reviewed-on: https://go-review.googlesource.com/c/go/+/296531
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-25 19:58:05 +00:00
Matthew Dempsky
6c3bcda866 cmd/compile: declare inlined result params early for empty returns
The code for delayed declaration of inlined result parameters only
handles non-empty return statements. This is generally okay, because
we already early declare if there are any (non-blank) named result
parameters.

But if a user writes a function with only blank result parameters and
with exactly one return statement, which is empty, then they could end
up hitting the dreaded "Value live at entry" ICE.

This CL fixes the issue by ensuring we always early declare inlined
result parameters if there are any empty return statements.

Fixes #44355.

Change-Id: I315f3853be436452883b1ce31da1bdffdf24d506
Reviewed-on: https://go-review.googlesource.com/c/go/+/293293
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2021-02-25 19:57:49 +00:00
Josh Bleecher Snyder
526ee96f49 os: avoid allocation in File.WriteString
Instead of alloc+copy to convert the string
to a byte slice, do an unsafe conversion.

Rely on the kernel not to scribble on the
buffer during the write.

Fixes #42406

Change-Id: I66f4838b43a11bcc3d67bbfa1706726318d55343
Reviewed-on: https://go-review.googlesource.com/c/go/+/268020
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-02-25 19:42:00 +00:00
Ivan Trubach
194b636f8f database/sql: close driver.Connector if it implements io.Closer
This change allows driver implementations to manage resources in
driver.Connector, e.g. to share the same underlying database handle
between multiple connections. That is, it allows embedded databases
with in-memory backends like SQLite and Genji to safely release the
resources once the sql.DB is closed.

This makes it possible to address oddities with in-memory stores in
SQLite and Genji drivers without introducing too much complexity in
the driver implementations.

See also:
- https://github.com/mattn/go-sqlite3/issues/204
- https://github.com/mattn/go-sqlite3/issues/511
- https://github.com/genjidb/genji/issues/210

Fixes #41790

Change-Id: Idbd19763134438ed38288b9d44f16608e4e97fd7
GitHub-Last-Rev: 962c785dfb
GitHub-Pull-Request: golang/go#41710
Reviewed-on: https://go-review.googlesource.com/c/go/+/258360
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-25 19:34:27 +00:00
Josh Bleecher Snyder
4ebb6f5110 cmd/compile: automate resultInArg0 register checks
No functional changes; passes toolstash-check.
No measureable performance changes.

Change-Id: I2629f73d4a3cc56d80f512f33cf57cf41d8f15d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/296010
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-02-25 18:57:20 +00:00
Cuong Manh Le
1a3e968b1f cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in go/defer
In CL 253457, we did the same fix for direct function calls. But for
method calls, the receiver argument also need to be passed through the
wrapper function, which we are not doing so the compiler crashes with
the code in #44415.

As we already rewrite t.M(...) into T.M(t, ...) during walkCall1, to fix
this, we can do the same trick in wrapCall, so the receiver argument
will be treated as others.

Fixes #44415

Change-Id: I396182983c85d9c5e4494657da79d25636e8a079
Reviewed-on: https://go-review.googlesource.com/c/go/+/294849
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-25 18:49:25 +00:00
Tobias Klauser
ee2a45e5fb runtime: use pipe2 for nonblockingPipe on dragonfly
The pipe2 syscall is available since DragonflyBSD 4.2, see
https://www.dragonflybsd.org/release42/

Change-Id: Ifc67c4935cc59bae29be459167e2fa765843ac03
Reviewed-on: https://go-review.googlesource.com/c/go/+/295471
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-25 18:43:17 +00:00
Andy Pan
1f7a01459b runtime: batch moving gFree list between local p and global schedt
Change-Id: I0ca1fcee6d3f08bdfcfa51f0dc774118d7355636
Reviewed-on: https://go-review.googlesource.com/c/go/+/271914
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2021-02-25 18:08:41 +00:00
Jay Conrod
bcac57f89c cmd: upgrade golang.org/x/mod to fix go.mod parser
modfile.Parse passed an empty string to the VersionFixer for the
module path. This caused errors for v2+ versions.

Fixes #44494

Change-Id: I13b86b6ecf6815c4bc9a96ec0668284c9228c205
Reviewed-on: https://go-review.googlesource.com/c/go/+/296131
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-02-25 17:50:59 +00:00
Bryan C. Mills
3137da82fd cmd/go: add a script test corresponding to the downhiddenartifact MVS test
For #36460

Change-Id: I95abff45bb325732a19eb8b9c0d3fc34df08b4d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/294293
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-25 17:28:44 +00:00
Bryan C. Mills
2c4c189bba cmd/go/internal/mvs: add test cases for downgrade interaction with hidden versions
For #36460

Change-Id: I889c4ece0d2caff7528cf437f89f7446dbd83955
Reviewed-on: https://go-review.googlesource.com/c/go/+/294292
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-25 16:45:36 +00:00
Ian Lance Taylor
9fe8ebf9b4 test: add test case that failed with gccgo
bug511.dir/b.go:10:14: error: reference to undefined field or method 'M'

Change-Id: I9f96dc5c7254b310bc3e15b0bc588d62718cb4b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/292009
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-25 15:24:25 +00:00
Ian Lance Taylor
ad17b65b34 testing/fstest: treat dash specially when building glob
"[-]" is not a valid path.Match pattern.

Fixes #44474

Change-Id: I0932bbf08ffb8ad0c5337d69d0893f53c1ba89ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/294869
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-02-25 15:23:02 +00:00
Jason A. Donenfeld
37ca84a9cd syscall: return error if GetQueuedCompletionStatus truncates key
This function has the wrong signature, so return an error when that
actually might lead to unexpected results. Users should switch to
x/sys/windows for the real version of this function.

Updates #44538.

Change-Id: I4d1f3d1e380815733ecfea683f939b1d25dcc32a
Reviewed-on: https://go-review.googlesource.com/c/go/+/296154
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-25 09:46:02 +00:00
Tobias Klauser
76c0003cd5 syscall, os: use pipe2 syscall on DragonflyBSD instead of pipe
Follow the implementation used by the other BSDs and account for the
intricacy of having to pass the fds array even though the file
descriptors are returned.

Re-submit of CL 130996 with corrected pipe2 wrapper.

Change-Id: Ie36d8214cba60c4fdb579f18bfc1c1ab3ead3ddc
Reviewed-on: https://go-review.googlesource.com/c/go/+/295372
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-25 09:20:03 +00:00
Ikko Ashimine
666ad85df4 cmd/compile: fix typo in rewrite_test.go
insted -> instead

Change-Id: Ib8a0423cf99f615976f058468873fb576dd96db6
GitHub-Last-Rev: 8e1a1d0880
GitHub-Pull-Request: golang/go#44598
Reviewed-on: https://go-review.googlesource.com/c/go/+/296309
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-25 04:55:35 +00:00
Egon Elbre
d822ffebc5 test: fix inline.go test for linux-amd64-noopt
math.Float32bits was not being inlined across package boundaries.
Create a private func that can be inlined with -l.

Change-Id: Ic50bf4727dd8ade09d011eb204006b7ee88db34a
Reviewed-on: https://go-review.googlesource.com/c/go/+/295989
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-25 02:22:12 +00:00
Jason A. Donenfeld
ff614b13d9 runtime: subtract one from ip when determining abort
On windows/arm, the abort is given from one byte off of the function
address, perhaps because Windows wants to simulate x86/amd64 modes, or
because it's jumping from thumb mode. This is not the case with
windows/arm64, though.

This prevents a failure in the builders with the TestAbort test:

    crash_test.go:727: output contains BAD:
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
                panic: BAD: recovered from abort
        [signal 0xc0000005 code=0x0 addr=0x0 pc=0x6a5721]

Change-Id: I8939c60611863cc0c325e179a772601acea9fd4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/296153
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-25 01:30:37 +00:00
Jason A. Donenfeld
dbbc5ec7e8 syscall: restore broken GetQueuedCompletionStatus signature but make it not crash
This reverts commit dc4698f52b, and then
fixes the memory corruption issue. It also suggests users switch to
x/sys/windows for the proper function.

This requires CL 295174 to be submitted first.

Updates #44538.

Change-Id: I0ee602f1c1d6a89cc585aff426833a4cb3f2be50
Reviewed-on: https://go-review.googlesource.com/c/go/+/296149
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-24 23:35:00 +00:00
David Chase
d0d21b7c4c cmd/compile: plumb abi info into expandCalls
Work in progress.

TODO:
- insert debugging output for all the steps listed below
- emit modified call instructions w/ multiple register inputs
  and Result-typed outputs (next CL)
  - initially just change output from "mem" to "Result{mem}"
  = most places this hits will be future work.
- change OpArg to use registerized variants
  - (done) match abi paramresultinfo with particular arg, use Name
  - (this CL) push register offsets for "loads" and "stores" into
    recursive decomposition.
- hand registerized Result to exit block

For #40724.

Change-Id: Ie5de9d71f8fd4e092f5ee9260b54de35abf91016
Reviewed-on: https://go-review.googlesource.com/c/go/+/293390
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-02-24 23:05:10 +00:00
Dan Scales
8027343b63 cmd/compile: disable inlining functions with closures for now
Added a flag '-d=inlfuncswithclosures=1' to allow inlining functions with
closures, and change the default to off for now, until #44370 is fixed.

Updates #44370.

Change-Id: Ic17723aa5c091d91f5f5004d8b63ec7125257acf
Reviewed-on: https://go-review.googlesource.com/c/go/+/296049
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
2021-02-24 21:34:21 +00:00
Josh Bleecher Snyder
6c3f8a2f47 cmd/link: use ctxt.Logf instead of package log
Fixes #43601

Change-Id: I28b745cb92932d875a66f64c63355650a092f096
Reviewed-on: https://go-review.googlesource.com/c/go/+/296029
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-24 20:23:56 +00:00
Egon Elbre
3ee32439b5 cmd/compile: ARM64 optimize []float64 and []float32 access
Optimize load and store to []float64 and []float32.
Previously it used LSL instead of shifted register indexed load/store.

Before:

    LSL   $3, R0, R0
    FMOVD F0, (R1)(R0)

After:

    FMOVD F0, (R1)(R0<<3)

Fixes #42798

Change-Id: I0c0912140c3dce5aa6abc27097c0eb93833cc589
Reviewed-on: https://go-review.googlesource.com/c/go/+/273706
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Giovanni Bajo <rasky@develer.com>
2021-02-24 19:49:08 +00:00
Austin Clements
80ddc17ae1 cmd/compile/internal-abi: fix ABI0-equivalence for zero-sized values
This fixes a bug in the internal ABI specification that made it not
equivalent to ABI0 even with zero architectural argument registers in
the case of a zero-sized argument with alignment > 1.

In ABI0, even zero-sized arguments cause alignment padding in the
stack frame.

Currently, in the internal ABI, zero-sized arguments get
register-assigned even if there are no registers because they don't
consume any registers. Hence, they don't create alignment padding in
the stack frame.

Fix this by stack-assigning zero-sized arguments.

For #40724.

Change-Id: I1f5a95a94fed8b5313a360e5e76875701ba5f562
Reviewed-on: https://go-review.googlesource.com/c/go/+/295791
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-24 19:26:13 +00:00
Austin Clements
3deb528199 cmd/compile/internal-abi: update internal ABI spec for g register
We've already implemented dedicating R14 as the G register on amd64,
so remove the TODO saying we might want to hold off on this.

For #40724.

Change-Id: I45b24ced03cac862127b53f5e9a4b4bcf6b1f86c
Reviewed-on: https://go-review.googlesource.com/c/go/+/295790
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-24 19:26:11 +00:00
Austin Clements
478277f812 cmd/compile/internal-abi: use x87 mode, not MMX mode
Florian Weimer pointed out that my justification for using MMX mode
was nonsense and that staying in x87 mode simplifies transitions to
and from C. Hence, switch the spec to say we're always in x87 mode.

For #40724.

Change-Id: Iad916b2c376db41f95614aa6897f6b1184576bb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/295789
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-24 19:26:10 +00:00
Alejandro García Montoro
bf48163e8f cmd/compile: add rule to coalesce writes
The code generated when storing eight bytes loaded from memory created a
series of small writes instead of a single, large one. The specific
pattern of instructions generated stored 1 byte, then 2 bytes, then 4
bytes, and finally 1 byte.

The new rules match this specific pattern both for amd64 and for s390x,
and convert it into a single instruction to store the 8 bytes. arm64 and
ppc64le already generated the right code, but the new codegen test
covers also those architectures.

Fixes #41663

Change-Id: Ifb9b464be2d59c2ed5034acf7b9c3e473f344030
Reviewed-on: https://go-review.googlesource.com/c/go/+/280456
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-24 19:25:49 +00:00
Than McIntosh
b7f62daa59 cmd/internal/goobj: add test case for object file reader
Add test in which a input Go object file contains a very large number
of relocations (more than 1<<20).

Updates #41621.

Change-Id: If1ebf3c4fefbf55ddec4e05c5299e7c48fc697d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/278493
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
2021-02-24 18:49:08 +00:00
Kevin Burke
c9d9b40b13 context: avoid importing context package twice
Change-Id: Id0a127e080dda8ee62738922c6de8caf3719dd68
Reviewed-on: https://go-review.googlesource.com/c/go/+/295949
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Kevin Burke <kev@inburke.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-24 18:15:00 +00:00
Jason A. Donenfeld
dc4698f52b syscall: do not overflow key memory in GetQueuedCompletionStatus
The third argument to GetQueuedCompletionStatus is a pointer to a
uintptr, not a uint32. Users of this functions have therefore been
corrupting their memory every time they used it. Either that memory
corruption was silent (dangerous), or their programs didn't work so they
chose a different API to use.

Fixes #44538.

RELNOTES=yes

Change-Id: Idf48d4c712d13da29791e9a460159255f963105b
Reviewed-on: https://go-review.googlesource.com/c/go/+/295371
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-24 18:03:45 +00:00
David Chase
7a2f3273c5 cmd/compile: plumb abi info into ssagen/ssa
Plumb abi information into ssa/ssagen for plain calls
and plain functions (not methods).  Does not extend all the
way through the compiler (yet).

One test disabled because it extends far enough to break the test.

Normalized all the compiler's register args TODOs to
// TODO(register args) ...

For #40724.

Change-Id: I0173a4579f032ac3c9db3aef1749d40da5ea01ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/293389
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-24 17:54:29 +00:00
Egon Elbre
adb467ffd2 cmd/compile: reduce inline cost of OCONVOP
OCONVOP doesn't have effect in the compiled code so, it can be safely
excluded from inline cost calculation.

Also make sequence ODEREF OCONVNOP* OADDR cost 1. This is rather common
conversion, such as *(*uint32)(unsafe.Pointer(&x)).

Fixes #42788

Change-Id: I5001f7e89d985c198b6405694cdd5b819cf3f47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/281232
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Elias Naur <mail@eliasnaur.com>
2021-02-24 17:00:14 +00:00
Josh Bleecher Snyder
27684ea195 testing: print late arriving log line in panic
When you log after a test has completed,
the testing package panics.

Print the logged line as part of that panic,
to aid in debugging.

Change-Id: I3d6689d1eed57c03e300afe37db0c15b2f4acda4
Reviewed-on: https://go-review.googlesource.com/c/go/+/283972
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-24 16:38:56 +00:00
Josh Bleecher Snyder
ae1fa08e41 context: reduce contention in cancelCtx.Done
Use an atomic.Value to hold the done channel.
Conveniently, we have a mutex handy to coordinate writes to it.

name                 old time/op  new time/op  delta
ContextCancelDone-8  67.5ns ±10%   2.2ns ±11%  -96.74%  (p=0.000 n=30+28)

Fixes #42564

Change-Id: I5d72e0e87fb221d4e230209e5fb4698bea4053c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288193
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Sameer Ajmani <sameer@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-02-24 16:38:32 +00:00
Bryan C. Mills
691ac806d2 cmd/go: fix version validation in 'go mod edit -exclude'
The fix is to pull in CL 295089 from the x/mod repo.

Fixes #44497

Change-Id: I008b58d0f4bb48c09d4f1e6ed31d11a714f87dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/295150
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2021-02-24 15:54:12 +00:00
YunQiang Su
b97b1456ae cmd/go, cmd/cgo: pass -mfp32 and -mhard/soft-float to MIPS GCC
For mips32 currently, we are using FP32, while the gcc may be FPXX,
which may generate .MIPS.abiflags and .gnu.attributes section with
value as FPXX. So the kernel will treat the exe as FPXX, and may
choose to use FR=1 FPU mode for it.
Currently, in Go, we use 2 lwc1 to load both half of a double value
to a pair of even-odd FPR. This behavior can only work with FR=0 mode.

In FR=1 mode, all of 32 FPR are 64bit. If we lwc1 the high-half of a double
value to an odd FPR, and try to use the previous even FPR to compute, the
real high-half of even FPR will be unpredicatable.
We set -mfp32 to force the gcc generate FP32 code and section value.

More details about FP32/FPXX/FP64 are explained in:
https://web.archive.org/web/20180828210612/https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking

When GOMIPS/GOMIPS64 is set as softfloat, we should also pass
 -msoft-float to gcc.

Here we also add -mno-odd-spreg option, since Loongson's CPU cannot use
odd-number FR in FR=0 mode.

Fixes #39435

Change-Id: I54026ad416a815fe43a9261ebf6d02e5519c3930
Reviewed-on: https://go-review.googlesource.com/c/go/+/237058
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
2021-02-24 15:48:11 +00:00
Ian Lance Taylor
07c658316b io/ioutil: forward TempFile and TempDir to os package
For #42026
Fixes #44311

Change-Id: I3dabcf902d155f95800b4adf1d7578906a194ce6
Reviewed-on: https://go-review.googlesource.com/c/go/+/285378
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-02-24 15:12:08 +00:00
Josh Bleecher Snyder
04edf418d2 encoding/json: reduce allocated space in Unmarshal
The decodeState type is a large part of the allocated space during Unmarshal.
The errorContext field is infrequently used, and only on error.
Extract it into a pointer and allocate it separate when necessary.

name                old time/op    new time/op    delta
UnmarshalString-8      115ns ± 5%     114ns ± 3%     ~     (p=0.170 n=15+15)
UnmarshalFloat64-8     113ns ± 2%     106ns ± 1%   -6.42%  (p=0.000 n=15+14)
UnmarshalInt64-8      93.3ns ± 1%    86.9ns ± 4%   -6.89%  (p=0.000 n=14+15)

name                old alloc/op   new alloc/op   delta
UnmarshalString-8       192B ± 0%      160B ± 0%  -16.67%  (p=0.000 n=15+15)
UnmarshalFloat64-8      180B ± 0%      148B ± 0%  -17.78%  (p=0.000 n=15+15)
UnmarshalInt64-8        176B ± 0%      144B ± 0%  -18.18%  (p=0.000 n=15+15)

name                old allocs/op  new allocs/op  delta
UnmarshalString-8       2.00 ± 0%      2.00 ± 0%     ~     (all equal)
UnmarshalFloat64-8      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
UnmarshalInt64-8        1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Change-Id: I53f3f468e6c65f77a12e5138a2626455b197012d
Reviewed-on: https://go-review.googlesource.com/c/go/+/271338
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2021-02-24 14:12:16 +00:00
Josh Bleecher Snyder
e496120891 database: remove race in TestTxContextWait
This test contained a data race.
On line 437, db.BeginTx starts a goroutine that runs tx.awaitDone,
which reads tx.keepConnOnRollback.
On line 445, the test writes to tx.keepConnOnRollback.
tx.awaitDone waits on ctx, but because ctx is timeout-based,
there's no ordering guarantee between the write and the read.

The race detector never caught this before
because the context package implementation of Done
contained enough synchronization to make it safe.
That synchronization is not package of the context API or guarantees,
and the first several releases it was not present.
Another commit soon will remove that synchronization,
exposing the latent data race.

To fix the race, emulate a time-based context
using an explicit cancellation-based context.
This gives us enough control to avoid the race.

Change-Id: I103fe9b987b1d4c02e7a20ac3c22a682652128b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288493
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2021-02-24 14:10:04 +00:00
Rob Findley
26001d109e go/types: review of call.go
The changes from the (reviewed) dev.regabi copy of call.go can be seen
by comparing patchset 1 and 4. The actual changes are removing the
"// REVIEW INCOMPLETE" marker, deleting some leftover handling of type
instantiation in Checker.call, and adding a comment that exprOrTypeList
should be refactored.

I started to refactor exprOrTypeList, but thought it best to mark this
code as reviewed before diverging from types2.

Change-Id: Icf7fbff5a8def49c5f1781472fd7ba7b73dd9a9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/295531
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-24 12:37:13 +00:00
Alberto Donizetti
35b80eac7d hash/maphash: remove duplicate from Hash documentation
Fixes #44255

Change-Id: I14d2edbee0a0c39e04111414a57d70ee2fdfb6af
Reviewed-on: https://go-review.googlesource.com/c/go/+/291631
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2021-02-24 08:36:15 +00:00
Tobias Klauser
eb863240dc runtime: remove unused const stackSystem on dragonfly
Change-Id: I778c2bd7cf0b12275bae344cb2130a7959500481
Reviewed-on: https://go-review.googlesource.com/c/go/+/295470
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-24 08:20:45 +00:00
DQNEO
084b07d6f6 spec: improve sentence structure for passing a slice
Change-Id: I453d06da2f596eb0b99905aec46a05547d73c62c
Reviewed-on: https://go-review.googlesource.com/c/go/+/290872
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Robert Griesemer <gri@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-02-24 05:23:32 +00:00
John Bampton
6ba4a300d8 docs: fix spelling
Change-Id: Ib689e5793d9cb372e759c4f34af71f004010c822
GitHub-Last-Rev: d63798388e
GitHub-Pull-Request: golang/go#44259
Reviewed-on: https://go-review.googlesource.com/c/go/+/291949
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-02-24 04:11:43 +00:00
David Benjamin
43652dc46f bufio, bytes, strings: handle negative runes in WriteRune
Updates #43254

Change-Id: I7d4bf3b99cc36ca2156af5bb01a1c595419d1d3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/280492
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-24 04:01:25 +00:00
David Benjamin
3780529255 unicode: correctly handle negative runes
Is and isExcludingLatin did not handle negative runes when dispatching
to is16. TestNegativeRune covers this along with the existing uint32
casts in IsGraphic, etc. (For tests, I picked the smallest non-Latin-1
code point in each range.)

Updates #43254

Change-Id: I17261b91f0d2b5b5125d19219411b45c480df74f
Reviewed-on: https://go-review.googlesource.com/c/go/+/280493
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-02-24 04:00:46 +00:00
Andy Pan
0694fb3d78 image: resolve the TODO of doc comment style
Change-Id: Ic7701a9e4635fe1a331c9a1df776ed580759eb9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/268758
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Nigel Tao <nigeltao@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Rob Pike <r@golang.org>
2021-02-24 01:35:53 +00:00