aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-26cmd/link: recognize ARM64 PE files and relocationsJason A. Donenfeld
For now, this only add a single relocation type, which is sufficient for Windows resources. Later we'll see if we need more for cgo. In order to ensure these code paths are actually tested, this expands the rsrc tests to include all the architectures of PE objects that we need to be recognizing, and splits things more clearly between binutils and llvm objects, which have a slightly different layout, so that we test both. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. Change-Id: Ia1ee840265e9d12c0b12dd1c5d0810f8b300e557 Reviewed-on: https://go-review.googlesource.com/c/go/+/289429 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-26cmd/link: handle types as converted to interface when dynlinkCherry Zhang
When using plugins, a type (whose value) may be pass to a plugin and get converted to interface there, or vice versa. We need to treat the type as potentially converted to interface, and retain its methods. Should fix #44586. Change-Id: I80dd35e68baedaa852a317543ccd78d94628d13b Reviewed-on: https://go-review.googlesource.com/c/go/+/296709 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-26cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in ↵Cuong Manh Le
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. It will be nicer if we can rewrite OCALLMETHOD to normal OCALLFUNC, but that will be for future CL. The passing receiver argument to wrapper function is easier for backporting to go1.16 branch. Fixes #44415 Change-Id: I03607a64429042c6066ce673931db9769deb3124 Reviewed-on: https://go-review.googlesource.com/c/go/+/296490 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-26cmd/compile: change StaticCall to return a "Results"David Chase
StaticLECall (multiple value in +mem, multiple value result +mem) -> StaticCall (multiple ergister value in +mem, multiple register-sized-value result +mem) -> ARCH CallStatic (multiple ergister value in +mem, multiple register-sized-value result +mem) But the architecture-dependent stuff is indifferent to whether it is mem->mem or (mem)->(mem) until Prog generation. Deal with OpSelectN -> Prog in ssagen/ssa.go, others, as they appear. For #40724. Change-Id: I1d0436f6371054f1881862641d8e7e418e4a6a16 Reviewed-on: https://go-review.googlesource.com/c/go/+/293391 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-26cmd/compile: fix missing descend in Addrtaken for closures.Dan Scales
ComputeAddrtaken needs to descend into closures, now that imported bodies can include closures. The bug was that we weren't properly setting Addrtaken for a variable inside a closure inside a function that we were importing. For now, still disable inlining of functions with closures for -G mode. I'll enable it in a later change -- there are just a few fixes related to the fact that we don't need to set Ntype for closure functions. Added a test derived from the cilium repro in the issue. Fixes #44370 Change-Id: Ida2a403636bf8740b471b3ad68b5474951811e19 Reviewed-on: https://go-review.googlesource.com/c/go/+/296649 Run-TryBot: Dan Scales <danscales@google.com> Trust: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-02-25cmd/internal/obj: add Prog.SetFrom3{Reg,Const}Josh Bleecher Snyder
These are the the most common uses, and they reduce line noise. I don't love adding new deprecated APIs, but since they're trivial wrappers, it'll be very easy to update them along with the rest. No functional changes; passes toolstash-check. Change-Id: I691a8175cfef9081180e463c63f326376af3f3a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/296009 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-25syscall: comment on fields omitted from the win32finddata1 structBryan C. Mills
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-25Revert "cmd/compile: fix mishandling of unsafe-uintptr arguments with call ↵Matthew Dempsky
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-25reflect: add Method.IsExported and StructField.IsExported methodsJoe Tsai
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-25cmd/internal/obj: fix typo in docsJosh Bleecher Snyder
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-25cmd/compile: declare inlined result params early for empty returnsMatthew Dempsky
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-25os: avoid allocation in File.WriteStringJosh Bleecher Snyder
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-25database/sql: close driver.Connector if it implements io.CloserIvan Trubach
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: 962c785dfb3bb6ad98b2216bcedd84ba383fe872 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-25cmd/compile: automate resultInArg0 register checksJosh Bleecher Snyder
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-25cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in ↵Cuong Manh Le
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-25runtime: use pipe2 for nonblockingPipe on dragonflyTobias Klauser
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-25runtime: batch moving gFree list between local p and global schedtAndy Pan
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-25cmd: upgrade golang.org/x/mod to fix go.mod parserJay Conrod
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-25cmd/go: add a script test corresponding to the downhiddenartifact MVS testBryan C. Mills
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-25cmd/go/internal/mvs: add test cases for downgrade interaction with hidden ↵Bryan C. Mills
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-25test: add test case that failed with gccgoIan Lance Taylor
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-25testing/fstest: treat dash specially when building globIan Lance Taylor
"[-]" 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-25syscall: return error if GetQueuedCompletionStatus truncates keyJason A. Donenfeld
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-25syscall, os: use pipe2 syscall on DragonflyBSD instead of pipeTobias Klauser
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-25cmd/compile: fix typo in rewrite_test.goIkko Ashimine
insted -> instead Change-Id: Ib8a0423cf99f615976f058468873fb576dd96db6 GitHub-Last-Rev: 8e1a1d08807a35c55d65a2e3f8bb28418a43b3a8 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-25test: fix inline.go test for linux-amd64-nooptEgon Elbre
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-25runtime: subtract one from ip when determining abortJason A. Donenfeld
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-24syscall: restore broken GetQueuedCompletionStatus signature but make it not ↵Jason A. Donenfeld
crash This reverts commit dc4698f52b5ad3f0251e0cc25bc7ffbd10e23f2c, 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-24cmd/compile: plumb abi info into expandCallsDavid Chase
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-24cmd/compile: disable inlining functions with closures for nowDan Scales
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-24cmd/link: use ctxt.Logf instead of package logJosh Bleecher Snyder
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-24cmd/compile: ARM64 optimize []float64 and []float32 accessEgon Elbre
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-24cmd/compile/internal-abi: fix ABI0-equivalence for zero-sized valuesAustin Clements
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-24cmd/compile/internal-abi: update internal ABI spec for g registerAustin Clements
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-24cmd/compile/internal-abi: use x87 mode, not MMX modeAustin Clements
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-24cmd/compile: add rule to coalesce writesAlejandro García Montoro
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-24cmd/internal/goobj: add test case for object file readerThan McIntosh
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-24context: avoid importing context package twiceKevin Burke
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-24syscall: do not overflow key memory in GetQueuedCompletionStatusJason A. Donenfeld
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-24cmd/compile: plumb abi info into ssagen/ssaDavid Chase
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-24cmd/compile: reduce inline cost of OCONVOPEgon Elbre
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-24testing: print late arriving log line in panicJosh Bleecher Snyder
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-24context: reduce contention in cancelCtx.DoneJosh Bleecher Snyder
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-24cmd/go: fix version validation in 'go mod edit -exclude'Bryan C. Mills
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-24cmd/go, cmd/cgo: pass -mfp32 and -mhard/soft-float to MIPS GCCYunQiang Su
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-24io/ioutil: forward TempFile and TempDir to os packageIan Lance Taylor
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-24encoding/json: reduce allocated space in UnmarshalJosh Bleecher Snyder
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-24database: remove race in TestTxContextWaitJosh Bleecher Snyder
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-24go/types: review of call.goRob Findley
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-24hash/maphash: remove duplicate from Hash documentationAlberto Donizetti
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>