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

43636 Commits

Author SHA1 Message Date
Keith Randall
dc9879e8fd cmd/compile: convert more AMD64.rules lines to typed aux mode
Change-Id: Idded860128b1a23680520d8c2b9f6d8620dcfcc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/228077
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 15:41:13 +00:00
Than McIntosh
6aeaf4a0f4 [dev.link] cmd/link: fix funcfunctab crash with darwin + plugin
Fix a bug in findfunctab when building plugin on Darwin (this is
a regression introduced by CL 227842).

Change-Id: Ic610168e45a750c0a2f2b8611d5d9154e6c2622f
Reviewed-on: https://go-review.googlesource.com/c/go/+/228137
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-13 13:21:48 +00:00
Tobias Klauser
916ecbc731 internal/cpu: unify HWCap/HWCap2 comments
HWCap and HWCap2 are no longer linknamed into package runtime. Also,
merge two sentences both starting with "These are..." and don't mention
any file name where archauxv is defined, as it become outdated if
support for a new $GOOS/$GOARCH combination is added. This is e.g.
already the case for arm64, where archauxv is also defined for
freebsd/arm64.

Change-Id: I9314a66633736b12e777869a832d8b79d442a6f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/228057
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 10:26:24 +00:00
Kevin Burke
2545323c63 cmd/link: fix spelling error
Change-Id: I6e730a99342563a97c3b1556893c8daaf5b6ec90
Reviewed-on: https://go-review.googlesource.com/c/go/+/228097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 04:28:53 +00:00
chainhelen
7242428509 doc/debugging_with_gdb: fix the link of delve
The repository of delve has already switched from the personal
account github.com/derekparker/delve to the organization account
github.com/go-delve/delve. According to go-delve/delve#1456.

Change-Id: Ie64f72c2808a8aca5059a75e2c2f11d8691e66b3
GitHub-Last-Rev: f90120c3b3
GitHub-Pull-Request: golang/go#38387
Reviewed-on: https://go-review.googlesource.com/c/go/+/227999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 04:26:57 +00:00
Joel Sing
c39439c53f cmd/compile: run TestLogOpt for riscv64 on amd64
Run TestLogOpt for riscv64 on amd64, as is done for other architectures.
This would have caught the test failure on riscv64 introduced in
47ade08141.

Change-Id: If29dea2ef383b087154d046728f6d1c96811f5a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227806
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-04-13 04:05:32 +00:00
Than McIntosh
e488ade6dd [dev.link] cmd/link/internal/loader: get rid of the AttrContainer loader method
Remove the loader's AttrContainer method, since it is no longer
needed. All of the code in the linker that used s.Attr.Container() is
now upstream of loadlibfull(), and the code in question now uses local
bitmaps to keep track of container text symbols as opposed to loader
methods.

Change-Id: Iae956d24bef2776e181c3b8208476dcb0b9a2916
Reviewed-on: https://go-review.googlesource.com/c/go/+/227959
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:19 +00:00
Than McIntosh
ad6fcf6993 [dev.link] cmd/link: convert inltree syms to anonymous in pclntab
The pclntab phase generates a series of "inltree.*" symbols with
inlining related pcdata; these symbols previously were given names and
enterered into the symbol lookup table, but there is no real reason to
do this, since they never need to be looked up when pcln generation is
done. Switch them over to anonymous symbols.

So as to insure that the later symtab phase picks them up correctly,
assign them a type of SGOFUNC instead of SRODATA, and change symtab to
look for this when assigning symbols to groups.

Change-Id: I38225dbb130ad7aea5d16f79cef3d8d388c61c2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227845
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:11 +00:00
Than McIntosh
2f9decbe95 [dev.link] cmd/link: convert findfunctab to loader APIs
Convert the linker's findfunctab phase to use the new loader APIs.

Change-Id: Ia980a85963fe2e7c554c212c0cc89208272264bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/227842
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:01 +00:00
Keith Randall
2f84caebe3 cmd/compile: rewrite some AMD64 rules to use typed aux fields
Surprisingly many rules needed no modification.

Use wrapper functions for aux like we did for auxint.
Simplifies things a bit.

Change-Id: I2e852e77f1585dcb306a976ab9335f1ac5b4a770
Reviewed-on: https://go-review.googlesource.com/c/go/+/227961
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2020-04-12 23:46:56 +00:00
Keith Randall
7580937524 cmd/compile: move more generic rewrites to the typed version
Change-Id: I22d0644710d12c7efc509fd2a15789e2e073e6a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227869
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-04-12 19:41:35 +00:00
Joel Sing
fb16f4b82e cmd/compile: log large copies on riscv64
Log large copies in the riscv64 compiler.

This was missed in 47ade08141, resulting in
the new test added to cmd/compile/internal/logopt failing on riscv64.

Change-Id: I6f763e86f42834148e911d16928f9fbabcfa4290
Reviewed-on: https://go-review.googlesource.com/c/go/+/227804
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 17:51:29 +00:00
Joel Sing
1eb66be1b9 cmd/compile: enable Sqrt as a compiler intrinsic on riscv64
Change-Id: I829a02ced9aa73b45079e67194186116b39504b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/227805
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 16:51:25 +00:00
Keith Randall
3afa74115b runtime/race: rebuild netbsd .syso
Fixes #14481
Fixes #37355

Change-Id: Idfceaf0e64d340b7304ce9562549a82ebfc27e3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/227867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2020-04-12 15:37:29 +00:00
Cherry Zhang
636fa3148f [dev.link] cmd/link: don't split container symbols when write blocks
We split the output into blocks and write them in parallel. The
block boundary is placed at symbol boundary. In the case of outer
symbols and sub symbols, currently we may split an outer symbol
into two blocks. This will be bad, as the two blocks will have
overlapping address range, since outer symbol and its sub symbols
occupies the same address range.

Make sure we place block boundary only at top-level symbol
boundaries.

Fix boringcrypto build.

Change-Id: I56811d3969c65c6be97672d8e1f1ea36b2447465
Reviewed-on: https://go-review.googlesource.com/c/go/+/227957
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-12 04:28:04 +00:00
Emmanuel T Odeke
83bfe3b1bf doc/go1.15, net/url: document new method URL.Redacted
Adds an entry in the Go1.15 release notes, but also
adds an example test for URL.Redacted.

Follow-up of CL 207082.

Updates #37419

Change-Id: Ibf81989778907511a3a3a3e4a03d1802b5dd9762
Reviewed-on: https://go-review.googlesource.com/c/go/+/227997
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 00:19:41 +00:00
Nigel Tao
b10849fbb9 strconv: add comment re extFloat errorscale
Change-Id: I6f006ba72e1711ba2a24cd71552855ad88284eec
Reviewed-on: https://go-review.googlesource.com/c/go/+/227797
Reviewed-by: Rémy Oudompheng <remyoudompheng@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-04-11 23:08:34 +00:00
Josh Bleecher Snyder
64dcef3045 cmd/compile: guard against invalid phis in shortcircuit
In the review of CL 222923, Keith expressed concern
that we could end up with invalid phis.

We have some code to handle this, but on further reflection,
I think it might not handle some cases in which phis get moved.

I can't create a failing case, but guard against it nevertheless.

Change-Id: Ib3a07ac1d36a674c72dcb9cc9261ccfcb716b5a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227697
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-11 17:33:35 +00:00
Cuong Manh Le
b78109e80e cmd/compile: correct comment for len check when make slice
CL 226737 optimizes len check when make slice. The comment that cap is
constrainted to [0, 2^31) is not quite true, it's 31 or 63 depends on
whether it's 32/64-bit systems.

Change-Id: I6f54e41827ffe4d0b67a44975da3ce07b2fabbad
Reviewed-on: https://go-review.googlesource.com/c/go/+/227803
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-11 16:20:57 +00:00
Keith Randall
a1b802bde7 cmd/compile: move some generic rules to strongly typed
Move a lot of the constant folding rules to use strongly
typed AuxInt fields.

We need more than a cast to convert AuxInt to, e.g., float32.
Make conversion functions for converting back and forth.

Change-Id: Ia3d95ee3583ee2179a10938e20210a7617358c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/227866
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-04-11 15:49:38 +00:00
Keith Randall
fd18f3ba50 cmd/link: turn ASLR off for netbsd+race
The race detector can't handle ASLR (adddress space layout randomization).
On some platforms it can re-exec the binary with ASLR off. But not NetBSD.
For NetBSD we have to introduce a special ELF header note that tells
the kernel not to use ASLR.

This works fine for internal linking. For external linking it also works,
but "readelf -n" shows multiple notes in the resulting binary. Maybe the
last one wins? Not sure, but it appears to work.

Change-Id: I5fe6dd861e42a8293f64d0dacb166631ea670fcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/227864
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2020-04-11 15:42:09 +00:00
Alex Brainman
df15eaedd0 Revert "cmd/compile: make logopt test skip if cannot create scratch directory"
This reverts commit 98534812bd.

Reason for revert: The change does not really fixes issue #38251. CL 227497 is real fix.

Change-Id: I9f556005baf1de968f059fb8dad89dae05330aa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/227802
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-04-11 13:49:21 +00:00
David Chase
06314b620d cmd/compile: add explanations to escape-analysis JSON/LSP logging
For 1.15.

From the test:

{"range":{"start":{"line":7,"character":13},"end":{...},"severity":3,"code":"leaks","source":"go compiler","message":"parameter z leaks to ~r2 with derefs=0","relatedInformation":[
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:    flow: y = z:"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:      from y = \u003cN\u003e (assign-pair)"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:    flow: ~r1 = y:"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":4,"character":11},"end":{...}},"message":"inlineLoc"},

	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:      from y.b (dot of pointer)"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":4,"character":11},"end":{...}},"message":"inlineLoc"},

	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:      from \u0026y.b (address-of)"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":4,"character":9},"end":...}},"message":"inlineLoc"},

	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":13},"end":{...}},"message":"escflow:      from ~r1 = \u003cN\u003e (assign-pair)"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":3},"end":...}},"message":"escflow:    flow: ~r2 = ~r1:"},
	{"location":{"uri":"file://T/file.go","range":{"start":{"line":9,"character":3},"end":...}},"message":"escflow:      from return (*int)(~r1) (return)"}]}

Change-Id: Idf02438801f63e487c35a928cf5a0b6d3cc48674
Reviewed-on: https://go-review.googlesource.com/c/go/+/206658
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-11 02:04:15 +00:00
David Chase
fced302aa1 cmd/compile: change gc logging to report inline failure instead of success
I've been experimenting with this, success is the wrong thing to report
even though it seems to log much less.

Change-Id: I7c25a45d2f41e82b6c8dd8b0a56ba848c63fb21a
Reviewed-on: https://go-review.googlesource.com/c/go/+/223298
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-10 20:34:40 +00:00
Keith Randall
83e288f3db cmd/compile: prevent constant folding of +/- when result is NaN
Missed as part of CL 221790. It isn't just * and / that can make NaNs.

Update #36400
Fixes #38359

Change-Id: I3fa562f772fe03b510793a6dc0cf6189c0c3e652
Reviewed-on: https://go-review.googlesource.com/c/go/+/227860
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2020-04-10 19:32:41 +00:00
Cherry Zhang
84fb045763 [dev.link] cmd/link: fix aux symbol handling in Funcdata
If a Go symbol is cloned to external, we should preserve its Aux
symbols for FuncInfo, etc.. We already do this in
loader.FuncInfo, but not in FuncInfo.Funcdata. Do it in the
latter as well. In fact, since FuncInfo and Funcdata should use
the same set of auxs, just record the auxs and reuse.

Should fix PPC64 build.

Change-Id: Iab9020eaca15d98fe3bb41f50f0d5bdb4999e8c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227848
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-10 19:04:34 +00:00
Lynn Boger
37470c0664 cmd/internal/obj/ppc64: add support for pcalign 32 on ppc64x
Previous PCALIGN support on ppc64x only accepted 8 and 16 byte
alignment since the default function alignment was 16. Now that
the function's alignment can be set to a larger value when needed,
PCALIGN can accept 32. When this happens then the function's
alignment will be changed to 32.

Test has been updated to recognized this new value.

Change-Id: If82c3cd50d7c686fcf8a9e819708b15660cdfa63
Reviewed-on: https://go-review.googlesource.com/c/go/+/227775
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-10 18:45:24 +00:00
Ian Lance Taylor
162f1bf7c2 test: add test case that gccgo failed to compile
Change-Id: I08ca5f77b7352fe3ced1fbe3d027d6f5b4828e35
Reviewed-on: https://go-review.googlesource.com/c/go/+/227783
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-10 18:42:07 +00:00
Cherry Zhang
53a2a6a7fc [dev.link] all: merge branch 'master' into dev.link
Clean merge.

Change-Id: Ic3634fa450e42635e2daafb53b7dedc6c954d072
2020-04-10 13:50:52 -04:00
Cherry Zhang
a1c29156ae [dev.link] cmd/internal/goobj2: remove "2"
Rename
Sym2 -> Sym
Reloc2 -> Reloc
Aux2 -> Aux

Also the Reader methods.

Change-Id: I49f29e2d1cb480f5309e01d7a74b5e0897d826fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227900
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2020-04-10 17:38:25 +00:00
Cherry Zhang
82f6d8eabb [dev.link] cmd/link: use new-style Reloc accessors in loadpe
Change-Id: I3601a5b4573e3e742a3e48c9709bbff616619d89
Reviewed-on: https://go-review.googlesource.com/c/go/+/227899
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-10 17:30:25 +00:00
Cherry Zhang
69f3bc04e5 [dev.link] cmd/link: use new-style Reloc accessors in loadxcoff
Change-Id: I606b60807b4a8b6e5c0f489db3c5d9e75bd1e728
Reviewed-on: https://go-review.googlesource.com/c/go/+/227898
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-10 17:30:19 +00:00
Cherry Zhang
0505e8a3a3 [dev.link] cmd/link: use new-style Reloc accessors in loadelf
Change-Id: I9c283aa2631dc21c0567a0708b26cdf95a6dc9fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227897
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-10 17:30:12 +00:00
Than McIntosh
db48c404cf [dev.link] cmd/link: convert pcln linker phase to use loader APIs
Rework the linker's pcln phase to work with the new loader. As part of
this set of changes the handling of "go.file..." symbols has been
revised somewhat -- previously they were treated as always live in the
loader, and now we no longer do this.

The original plan had been to have the new implementation generate
nameless "inltree" symbols, however the plan now is to keep them
named for now and convert them to nameless in a subsequent patch.

Change-Id: If71c93ff1f146dbb63b6ee2546308acdc94b643c
Reviewed-on: https://go-review.googlesource.com/c/go/+/227759
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-10 16:35:02 +00:00
Keith Randall
ea7126fe14 cmd/compile: use a Sym type instead of interface{} for symbolic offsets
Will help with strongly typed rewrite rules.

Change-Id: Ifbf316a49f4081322b3b8f13bc962713437d9aba
Reviewed-on: https://go-review.googlesource.com/c/go/+/227785
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2020-04-10 16:24:46 +00:00
Than McIntosh
c306fbaa1c [dev.link] cmd/link: add IsWasm method for Target
Add Target.IsWasm method.

Change-Id: Ia3bfc359208b8e392b1a484c41aebce9761bc2f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227758
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-10 12:33:22 +00:00
Than McIntosh
2599c175cb [dev.link] cmd/link/internal/loader: add another symbolbuilder method
Introduce SetAddrPlus method for use with SymbolBuilder.

Change-Id: Ieb2986b2fc1675b7a3a71c84b7219b3d564ac122
Reviewed-on: https://go-review.googlesource.com/c/go/+/227757
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-10 12:33:13 +00:00
Than McIntosh
30b0c819d1 [dev.link] cmd/link/internal/loader: expand methods for FuncInfo
Expand the methods for the FuncInfo helper, to support reading the
contents of an object file FuncInfo aux symbol using the new style
(that is to say, incrementally and without allocating slices to hold
the various bits).

Change-Id: I953d72c4a53f98c840e6b25b08fd33dc4a833dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/227585
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-10 12:33:04 +00:00
Sylvain Zimmer
782fcb44b9 regexp: add (*Regexp).SubexpIndex
SubexpIndex returns the index of the first subexpression with the given name,
or -1 if there is no subexpression with that name.

Fixes #32420

Change-Id: Ie1f9d22d50fb84e18added80a9d9a9f6dca8ffc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/187919
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2020-04-10 09:38:07 +00:00
Andy Pan
245409ea86 runtime: replace the type of netpollWakeSig from a uintptr to a uint32
There's no need for netpollWakeSig to use a uintptr type, a uint32 is enough.

Relevant CL: CL 212737

Change-Id: Ide24478b217a02bad62f7e000a9680c26a8c5366
Reviewed-on: https://go-review.googlesource.com/c/go/+/227798
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-10 03:29:25 +00:00
Bryan C. Mills
7b90c1c0c4 os/exec: extend grace period in TestExtraFiles to 20% of overall deadline
Updates #25628

Change-Id: I938a7646521b34779a3a57833e7ce9d508b58faf
Reviewed-on: https://go-review.googlesource.com/c/go/+/227765
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-10 01:36:31 +00:00
Keith Randall
28157b3292 cmd/compile: start implementing strongly typed aux and auxint fields
Right now the Aux and AuxInt fields of ssa.Values are typed as
interface{} and int64, respectively. Each rule that uses these values
must cast them to the type they actually are (*obj.LSym, or int32, or
ValAndOff, etc.), use them, and then cast them back to interface{} or
int64.

We know for each opcode what the types of the Aux and AuxInt fields
should be. So let's modify the rule generator to declare the types to
be what we know they should be, autoconverting to and from the generic
types for us. That way we can make the rules more type safe.

It's difficult to make a single CL for this, so I've coopted the "=>"
token to indicate a rule that is strongly typed. "->" rules are
processed as before. That will let us migrate a few rules at a time in
separate CLs.  Hopefully we can reach a state where all rules are
strongly typed and we can drop the distinction.

This CL changes just a few rules to get a feel for what this
transition would look like.

I've decided not to put explicit types in the rules. I think it
makes the rules somewhat clearer, but definitely more verbose.
In particular, the passthrough rules that don't modify the fields
in question are verbose for no real reason.

Change-Id: I63a1b789ac5702e7caf7934cd49f784235d1d73d
Reviewed-on: https://go-review.googlesource.com/c/go/+/190197
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-04-09 21:18:55 +00:00
Cherry Zhang
37cc5cd769 [dev.link] cmd/link: use new-style Reloc accessors in loadmacho
Change-Id: I890bd8b297fc5612000131fac7c45f5c623ab908
Reviewed-on: https://go-review.googlesource.com/c/go/+/227764
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-09 20:37:17 +00:00
Cherry Zhang
9669c3f361 [dev.link] cmd/link: convert buildinfo pass to new style
Change-Id: I2e1a6d2f1ef7402277c981282556c276ec0585ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/227771
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-09 20:36:50 +00:00
Lynn Boger
a1550d3ca3 cmd/compile: use isel with variable shifts on ppc64x
This changes the code generated for variable length shift
counts to use isel instead of instructions that set and
read the carry flag.

This reduces the generated code for shifts like this
by 1 instruction and avoids the use of instructions to
set and read the carry flag.

This sequence can be found in strconv with these results
on power9:

Atof64Decimal                          71.6ns ± 0%  68.3ns ± 0%   -4.61%
Atof64Float                            95.3ns ± 0%  90.9ns ± 0%   -4.62%
Atof64FloatExp                          153ns ± 0%   149ns ± 0%   -2.61%
Atof64Big                               234ns ± 0%   232ns ± 0%   -0.85%
Atof64RandomBits                        348ns ± 0%   369ns ± 0%   +6.03%
Atof64RandomFloats                      262ns ± 0%   262ns ± 0%     ~
Atof32Decimal                          72.0ns ± 0%  68.2ns ± 0%   -5.28%
Atof32Float                            92.1ns ± 0%  87.1ns ± 0%   -5.43%
Atof32FloatExp                          159ns ± 0%   158ns ± 0%   -0.63%
Atof32Random                            194ns ± 0%   191ns ± 0%   -1.55%

Some tests in codegen/shift.go are enabled to verify the
expected instructions are generated.

Change-Id: I968715d10ada405a8c46132bf19b8ed9b85796d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227337
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-09 19:18:56 +00:00
Cherry Zhang
a35b322709 [dev.link] cmd/link: convert typelink pass to new style
Change-Id: If861409a5cc4e398496199a89498a141f106f44f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227762
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-09 19:02:47 +00:00
Cherry Zhang
fd7666881b [dev.link] cmd/link: add methods for adding relocations in Reloc2 format
This is in prepration of removing the old loader.Reloc. This also
introduces a way of adding a slice of relocations more
efficiently (will be used in the next CL).

Change-Id: I3eaee7fb3a3e102a8670990f4a31c40d0b17b8c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/227761
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-09 19:02:37 +00:00
Cherry Zhang
e7c16412b7 [dev.link] cmd/internal/goobj2: remove old-style types
They are no longer needed.

Also rewrite the test, as the old one no longer meaningful.

Change-Id: Id39ad6bb2a334cb6d61aa0a7c52837e0c3d62432
Reviewed-on: https://go-review.googlesource.com/c/go/+/227641
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-09 16:38:33 +00:00
Cherry Zhang
88d6d37b77 [dev.link] cmd/internal/obj: change writer to use new-style accessors
Introduce field setters and use them on the writer side. Now we
are able to eliminate the old-style types.

Change-Id: I650d837328dc02f9be839d16a31812be86721b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/227640
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-09 16:36:46 +00:00
Than McIntosh
7c0ee1127b test: deflaking measures for runtime gdb test
Tweak the runtime's GDB python test to try to reduce flake failures.

Background: the intent of the testpoint in question is to make sure
that python-supported commands like "info goroutines" or "goroutine 1
backtrace" work properly. The Go code being run under the debugger as
part of the test is single-threaded, but the test is written assuming
that in addition to the primary goroutine there will be other
background goroutines available (owned by the runtime). The flakiness
seems to crop up the most when requesting a backtrace for one of these
background goroutines; the speculation is that if we catch a
runtime-owned goroutine in an odd state, this could interfere with the
test.

The change in this patch is to explicitly start an additional
goroutine from the main thread, so that when the debugger stops the
main thread we can be sure that there is some other non-main goroutine
in a known state.

This change authored by Josh Bleecher Snyder <josharian@gmail.com>.

Updates #24616.

Change-Id: I45682323d5898e5187c0adada7c5d117e92f403b
Reviewed-on: https://go-review.googlesource.com/c/go/+/226558
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-09 16:15:34 +00:00