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

53337 Commits

Author SHA1 Message Date
Matthew Dempsky
88635b3862 cmd/compile/internal/noder: explicitly handle separate selectors
This CL separates out the handling of selector expressions for field
values, method values, and method expressions. Again part of
refactoring to make it possible to access runtime dictionaries where
needed.

No behavioral change; just duplicating and then streamlining the
existing code paths.

Change-Id: I53b2a344f4bdba2c9f37ef370dc9a091a3941021
Reviewed-on: https://go-review.googlesource.com/c/go/+/421818
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-10 23:27:27 +00:00
Matthew Dempsky
2e6ffd6c5d cmd/compile/internal/noder: explicitly handle function instantiations
This CL changes unified IR to explicitly handle function
instantiations within expression handling, rather than leaving it to
the underlying object reading logic.

Change-Id: I009a56013fbe9fbc4dabf80eea98993d34af4272
Reviewed-on: https://go-review.googlesource.com/c/go/+/421817
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-10 23:26:58 +00:00
David Chase
6b80b62fd1 internal/pkgbits: fix performance of rawReloc
There was a TODO about quadratic performance, and indeed,
it can get bad.  Added a map, made some integers that are
unlikely to exceed a few million into 32-bit integers.

Change-Id: I6facf2eabc00483e943b326ca8dcae2f778093da
Reviewed-on: https://go-review.googlesource.com/c/go/+/422297
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-10 22:22:48 +00:00
Matthew Dempsky
8003efe1b5 test: relax live.go for GOEXPERIMENT=unified
This CL applies the same change to test/live.go that was previously
applied to test/live_regabi.go in golang.org/cl/415240. This wasn't
noticed at the time though, because GOEXPERIMENT=unified was only
being tested on linux-amd64, which is a regabi platform.

Change-Id: I0c75c2b7097544305e4174c2f5ec6ec283c81a8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/422254
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-08-10 18:52:08 +00:00
Matthew Dempsky
d4280fda46 test: more robust detection of GOEXPERIMENT=unified
`go env GOEXPERIMENT` prints what experiments are enabled relative to
the baseline configuration, so it's not a very robust way to detect
what experiments have been statically enabled at bootstrap time.

Instead, we can check build.Default.ToolTags, which has goexperiment.*
for all currently enabled experiments, independent of baseline.

Change-Id: I6132deaa73b1e79ac24176ef4de5af67a507ee26
Reviewed-on: https://go-review.googlesource.com/c/go/+/422234
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-10 18:52:00 +00:00
Cuong Manh Le
9f8685f49e all: remove remaining UNREVIEWED files for Unified IR
Those ureader.go files have enough documents and in stable
developement/review as other parts of Unified IR.

Fixes #48194

Change-Id: I08a0cbfef05401135b5390e00fe808e838a96170
Reviewed-on: https://go-review.googlesource.com/c/go/+/422617
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-10 17:59:59 +00:00
David Chase
522f0fc425 cmd/compile: refactor GOSSAHASH debugging to make it usable outside ssa package.
I've needed this more than once in the past, I hack it in,
then throw it away, seems sensible to make the change and
save it.

Fixes #53937.

Change-Id: I7fe886b1c93d73cbf553bed587f2c30f0f5d5a0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/418015
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-08-10 17:44:57 +00:00
Keith Randall
f19f6c79e4 runtime: fix gofmt error
Introduced in https://go-review.googlesource.com/c/go/+/419755

Change-Id: I7ca353d495dd7e833e46b3eeb972eac38b3a7a24
Reviewed-on: https://go-review.googlesource.com/c/go/+/422474
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-10 16:27:29 +00:00
hopehook
7ba458d7d8 net/http/cgi: remove port from the CGI environment of variable SERVER_NAME
The SERVER_NAME variable in the CGI environment should not
contain the port, according to the section 4.1.14 of the
RFC 3875.

Fixes #53368.

Change-Id: Ifeea70206878cf83bc0bda35cb514d0226bbcd8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/412434
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: xie cui <523516579@qq.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-10 15:20:24 +00:00
ruinan
c81dfdd47a hash/crc32: use LDP instead of LDR in crc32 computation
Since recent ARM CPUs support CRC late forwarding of results from a
producer to a consumer, the second CRC instruction can be executed
before the first CRC instruction complete. By loading 16 bytes once with
LDP and ordering two CRC instructions here we can make the data
forwarding happen to get better performance.

Benchmarks                             old         ThisRun    delta
CRC32/poly=IEEE/size=15/align=0-160    1.24GB/s    1.26GB/s   +1.92%
CRC32/poly=IEEE/size=15/align=1-160    1.24GB/s    1.26GB/s   +1.92%
CRC32/poly=IEEE/size=40/align=0-160    2.89GB/s    2.87GB/s   -0.72%
CRC32/poly=IEEE/size=40/align=1-160    2.86GB/s    2.87GB/s     ~
CRC32/poly=IEEE/size=512/align=0-160   9.29GB/s   14.47GB/s  +55.69%
CRC32/poly=IEEE/size=512/align=1-160   9.26GB/s   13.88GB/s  +49.89%
CRC32/poly=IEEE/size=1kB/align=0-160   10.2GB/s    17.6GB/s  +72.97%
CRC32/poly=IEEE/size=1kB/align=1-160   10.1GB/s    17.2GB/s  +69.29%
CRC32/poly=IEEE/size=4kB/align=0-160   10.5GB/s    20.9GB/s  +99.01%
CRC32/poly=IEEE/size=4kB/align=1-160   10.5GB/s    20.5GB/s  +95.02%
CRC32/poly=IEEE/size=32kB/align=0-160  11.1GB/s    22.0GB/s  +98.40%
CRC32/poly=IEEE/size=32kB/align=1-160  11.1GB/s    21.6GB/s  +94.80%

CRC32/poly=Castagnoli/size=15/align=0-160   1.26GB/s   1.26GB/s     ~
CRC32/poly=Castagnoli/size=15/align=1-160   1.25GB/s   1.26GB/s     ~
CRC32/poly=Castagnoli/size=40/align=0-160   2.88GB/s   3.02GB/s   +5.18%
CRC32/poly=Castagnoli/size=40/align=1-160   2.85GB/s   3.01GB/s   +5.57%
CRC32/poly=Castagnoli/size=512/align=0-160  9.24GB/s  14.71GB/s  +59.29%
CRC32/poly=Castagnoli/size=512/align=1-160  9.21GB/s  13.45GB/s  +45.92%
CRC32/poly=Castagnoli/size=1kB/align=0-160  10.1GB/s   17.8GB/s  +75.81%
CRC32/poly=Castagnoli/size=1kB/align=1-160  10.1GB/s   17.0GB/s  +67.80%
CRC32/poly=Castagnoli/size=4kB/align=0-160  10.5GB/s   21.0GB/s  +99.67%
CRC32/poly=Castagnoli/size=4kB/align=1-160  10.5GB/s   20.5GB/s  +94.26%
CRC32/poly=Castagnoli/size=32kB/align=0-160 11.1GB/s   22.0GB/s  +98.39%
CRC32/poly=Castagnoli/size=32kB/align=1-160 11.1GB/s   21.7GB/s  +95.63%

Change-Id: Ifc7be5048cafac242e7b75f652e4aafa9aeae844
Reviewed-on: https://go-review.googlesource.com/c/go/+/407854
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-08-10 08:57:33 +00:00
eric fang
5531838c04 plugin: enable plugin test on linux/arm64
The test passed on linux/arm64, so re-enable it.

Change-Id: Ib5252d89b58f0de256993065e27b64c4676f5103
Reviewed-on: https://go-review.googlesource.com/c/go/+/414975
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-10 02:14:09 +00:00
eric fang
efe5929dbd cmd/compile/internal/ssa: optimize ARM64 code with TST
For signed comparisons, the following four optimization rules hold:

(CMPconst [0] z:(AND x y)) && z.Uses == 1 => (TST x y)
(CMPWconst [0] z:(AND x y)) && z.Uses == 1 => (TSTW x y)
(CMPconst [0] x:(ANDconst [c] y)) && x.Uses == 1 => (TSTconst [c] y)
(CMPWconst [0] x:(ANDconst [c] y)) && x.Uses == 1 => (TSTWconst [int32(c)] y)

But currently they only apply to jump instructions, not to conditional
instructions within a block, such as cset, csel, etc. This CL extends
the above rules into blocks so that conditional instructions can also be
optimized.

name                       old time/op  new time/op  delta
DivisiblePow2constI64-160  1.04ns ± 0%  0.86ns ± 0%  -17.30%  (p=0.008 n=5+5)
DivisiblePow2constI32-160  1.04ns ± 0%  0.87ns ± 0%  -16.16%  (p=0.016 n=4+5)
DivisiblePow2constI16-160  1.04ns ± 0%  0.87ns ± 0%  -16.03%  (p=0.008 n=5+5)
DivisiblePow2constI8-160   1.04ns ± 0%  0.86ns ± 0%  -17.15%  (p=0.008 n=5+5)

Change-Id: I6bc34bff30862210e8dd001e0340b8fe502fe3de
Reviewed-on: https://go-review.googlesource.com/c/go/+/420434
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
2022-08-10 02:13:53 +00:00
Cherry Mui
8dc7710fae cmd/compile: do not use content addressable symbol for generic iface method names
When a generic interface method is used, we use a special
relocation R_USEGENERICIFACEMETHOD to tell the linker the name of
the generic interface method, so it can keep methods with that
name live. The relocation references a symbol whose content is the
name. Currently this is a string symbol, which is content
addessable and may have trailing zero bytes (for better
deduplication). The trailing bytes can cause confusion for the
linker. This symbol doesn't need to be in the final binary and
doesn't need to be deduplicated with other symbol. So we don't use
content addressable symbol but make an (unnamed) symbol
specifically for this.

May fix #54346.

Change-Id: If0c34f7844c3553a7be3846b66cf1c103bc231c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422300
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-10 00:51:41 +00:00
Cherry Mui
3c2a3ce6d9 runtime: gofmt
Add new line at the end of crash_test.go.

Change-Id: I73c77666066b105e563215f34e7ede6c1d92226b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422299
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-09 22:46:10 +00:00
Keith Randall
cb13022a24 runtime: ensure that we don't scan noscan objects
We claim to not maintain pointer bits for noscan objects. But in fact
we do, since whenever we switch a page from scannable to noscan, we
call heapBits.initSpan which zeroes the heap bits.

Switch to ensure that we never scan noscan objects. This ensures that
we don't depend on the ptrbits for noscan objects. That fixes a bug
in the 1-bit bitmap CL which depended on that fact.

Change-Id: I4e66f582605b53732f8fca310c1f6bd2892963cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422435
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 22:28:42 +00:00
Ludi Rehak
d39b54171a encoding/gob: change typeInfo.encoder type to atomic.Pointer[T]
Replace loading and storing an atomic.Value of type pointer with
atomic.Pointer.

Change-Id: I018ac1e18eee4f203ebca65c2833daf991075371
Reviewed-on: https://go-review.googlesource.com/c/go/+/422174
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
2022-08-09 21:26:45 +00:00
Emmanuel T Odeke
cd9cd925bb cmd: vendor github.com/google/pprof to fix mangled type parameter symbol names
Updates github.com/google/pprof to bring in the commit from
https://github.com/google/pprof/pull/717 which fixes mangled
symbol names for type parameters.

Fixes #54105

Change-Id: I01af9f780aba3338b960a03b30906a23642e4448
Reviewed-on: https://go-review.googlesource.com/c/go/+/420234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09 20:51:42 +00:00
Damien Neil
51a23d6681 net/url: clarify RawPath documentation
Consistently recommend using EscapedPath rather than RawPath directly.

For #33596.

Change-Id: Ibe5c2dfa7fe6b1fbc540efed6db1291fc6532726
Reviewed-on: https://go-review.googlesource.com/c/go/+/418035
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 18:43:28 +00:00
Daniel Martí
beebd537ca encoding/xml: use bytes.Buffer.WriteString
Change-Id: Icb0b917c48252ed8831e6c07109c1bc2d2438a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/421234
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
2022-08-09 18:32:01 +00:00
Abirdcfly
469a87d7a5 net/http: remove unused method needsSniff
Change-Id: Ia8c67d148fc7e71cac8954ccce6fffb8a6f423df
GitHub-Last-Rev: 9441b8f0c5
GitHub-Pull-Request: golang/go#54036
Reviewed-on: https://go-review.googlesource.com/c/go/+/419322
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Javad Rajabzadeh <ja7ad@live.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-08-09 18:11:37 +00:00
Cuong Manh Le
9c5cae0892 debug/gosym: fix missing symbol version for 1.2+ pclntab
Updates #37762

Change-Id: Ib587f472304a04ebd9794666228f81ae6cb5c2a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/422315
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09 17:17:44 +00:00
Matthew Dempsky
7d70779db5 cmd/compile/internal/noder: shuffle defined type handling code
Per TODO, this CL just moves code around without behavioral
change. Part of a cleanup process so that it's easier to access object
dictionaries where needed.

Change-Id: I95bb3cdd3cdb46cae47d76d5c1d5d8256661f222
Reviewed-on: https://go-review.googlesource.com/c/go/+/421816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-09 16:42:21 +00:00
Matthew Dempsky
60d3276a94 test: test method expressions promoted to derived types
This CL adds a test that method expressions where the receiver type is
a derived type and embeds a promoted method work correctly.

Change-Id: I2e7c96007b6d9e6f942dc14228970ac508ff5c15
Reviewed-on: https://go-review.googlesource.com/c/go/+/422199
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 16:42:12 +00:00
Matthew Dempsky
f93b668842 test: add test for package-scope method value GC
The Go 1.18 frontend handles package-scope generic method values by
spilling the receiver value to a global temporary variable, which pins
it into memory. This issue isn't present in unified IR, which uses
OMETHVALUE when the receiver type is statically known.

Updates #54343.

Change-Id: I2c4ffeb125a3cf338f949a93b0baac75fff6cd31
Reviewed-on: https://go-review.googlesource.com/c/go/+/422198
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-08-09 16:41:51 +00:00
Matthew Dempsky
0c2f87f23d cmd/compile/internal/escape: support OITAB and OCHECKNIL
For interface method values, we nil check the receiver value at the
point of evaluating the method value. Currently this is inserted by
the backend during walk, but in some cases it's useful to emit them
upfront instead.

OITAB is essentially a field selection operation, like ODOT, OIDATA,
and OSPTR.

OCHECKNIL is a statement that simply evaluates its unary operand, and
discards the result (after testing for nil).

Change-Id: I583b5170539caa9a87aec661d5c293080fd87fbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422197
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-09 16:41:39 +00:00
Matthew Dempsky
25d74f324d cmd/compile/internal/inline: fix latent CalleeEffects issue
ir.ClosureExpr implements ir.InitNode, so ir.InitExpr can prepend init
statements to it. However, CalleeEffects wasn't aware of this and
could cause the init statements to get dropped when inlining a call to
a closure.

This isn't an issue today, because we don't create closures with init
statements. But I ran into this within unified IR.

Easy and robust solution: just take advantage that ir.TakeInit can
handle any node.

Change-Id: Ica05fbf6a8c5be4b11927daf84491a1140da5431
Reviewed-on: https://go-review.googlesource.com/c/go/+/422196
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-09 16:41:32 +00:00
Matthew Dempsky
bd901af30b cmd/compile/internal/ir: prevent NewClosureVar misuse
NewClosureVar should only be called to capture locally declared
variables in the enclosing function scope. This CL adds a check to
make sure it's used that way, in particular to make sure it's not
called to capture global variables.

This came up because for generic method values, we desugar the method
value into a function literal that captures the receiver value after
evaluating it. However, due to compiler backend limitations, for
package-scope generic method values we spill the receiver value into a
global variable rather than capturing it normally.

To prevent confusing backend issues when misusing NewClosureVar with
global variables, this CL adds an extra check.

Change-Id: I80f0f083dc80f70c7f0298020efe56dba00b67d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/422195
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 16:41:24 +00:00
Matthew Dempsky
b911771f12 cmd/compile/internal/ir: better dump for OLINKSYMOFFSET
When debugging IR that uses OLINKSYMOFFSET, you really need to know
what linksym it actually refers to.

Change-Id: I7f4775d040b50e36262f9f8b52d0fb112b7ed350
Reviewed-on: https://go-review.googlesource.com/c/go/+/422194
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09 16:41:17 +00:00
Keith Randall
ad0287f496 Revert "runtime: redo heap bitmap"
This reverts commit b589208c8c.

Reason for revert: Bug somewhere in this code, causing wasm and maybe linux/386 to fail.

Change-Id: I5e1e501d839584e0219271bb937e94348f83c11f
Reviewed-on: https://go-review.googlesource.com/c/go/+/422395
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 16:10:10 +00:00
Keith Randall
e1a8e0e05d Revert "runtime: process ptr bitmaps one word at a time"
This reverts commit c3833a5543.

Reason for revert: Bug somewhere in this code, causing wasm and maybe linux/386 to fail.

Change-Id: I05f7cfa467598ca0c2c84fd4f752cc4ef117cc51
Reviewed-on: https://go-review.googlesource.com/c/go/+/422394
Run-TryBot: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-08-09 16:09:24 +00:00
Than McIntosh
0d9ed0638b test: skip -buildmode=pie tests on alpine
Skip a collection of -buildmode=pie tests on alpine, which are
currently failing on the linux-amd64-alpine builder. Once #54354 has
been investigated and resolved we can turn these tests back on.

Updates #54354.

Change-Id: I99d4016a40873ee6bb4eda571a64eddbe719c76a
Reviewed-on: https://go-review.googlesource.com/c/go/+/422295
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-09 15:13:01 +00:00
Ludi Rehak
c7942f87a2 log: change isDiscard type to atomic.Bool
Change-Id: Iff881cc6cc2ec34c7cf8bbd5dd1b0a05a19e1c23
Reviewed-on: https://go-review.googlesource.com/c/go/+/422175
Run-TryBot: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-08-09 14:40:33 +00:00
Joe Tsai
0981d9fff1 time: add DateTime, DateOnly, and TimeOnly
Add named constants for the 3rd, 4th, and 13th most popular formats.

Fixes #52746

Change-Id: I7ce92e44dcae18c089124f1d6f5bc2d6359d436c
Reviewed-on: https://go-review.googlesource.com/c/go/+/412495
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
2022-08-09 14:33:24 +00:00
Than McIntosh
662a729ded runtime: disable gdb testpoints on alpine pending builder fix
Disable the TestGdb* testpoints until we can figure out why they are
failing and reconfigure the machine properly.

Updates #54352.

Change-Id: Id9c76a0ba6e23b5deff24f521a1c8e0aafb6481a
Reviewed-on: https://go-review.googlesource.com/c/go/+/422294
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-08-09 14:12:01 +00:00
Nick Ripley
9e8020b2d4 cmd/asm: add VTBX instruction on arm64
Change-Id: Icd9eeb78bfc0c0bbe19dcb9841c9fdc0abc29cc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/413314
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-09 13:39:27 +00:00
Andy Pan
ffe5f085cd runtime: refine code reducing indents in netpollBreak()
Change-Id: I2d1528910cb3660344c7a664d6f32306defe75d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/419321
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-09 13:23:50 +00:00
Cuong Manh Le
13bd6ddbe7 cmd/compile/internal/typecheck: simplify tcAppend
After CL 418514, Unified IR now always write concrete type of constant
expressions, thus we don't need to handle untyped string anymore.

Change-Id: Ic930ee2418746ca9f4a5122c614e077bef8d7eb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422041
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-09 12:18:32 +00:00
Cuong Manh Le
2699065483 cmd/compile: do not write implicit conversion for append in Unified IR
Same as CL 418475, but for Unified IR.

Updates #53888
Fixes #54337

Change-Id: I31d5a7af04d8e3902ed25db85009d46ea4c38dbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/422040
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09 12:18:20 +00:00
Cuong Manh Le
a292b3905c internal/testenv: add and use OptimizationOff/SkipIfOptimizationOff
So we don't have to duplicate the logic to detect noopt builder in
multiple places.

Based on khr@'s suggestion in CL 422037.

Change-Id: Idb338e8bc08cdf00460574bfc0d2f7018c79bbd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/422038
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-09 12:16:31 +00:00
Tobias Klauser
98277f30e4 syscall: add Mmap and Munmap on solaris
They exist on all other Unix ports, define them on GOOS=solaris as well.

Fixes #52875

Change-Id: I7285156b3b48ce12fbcc6d1d88865540a5c51a21
Reviewed-on: https://go-review.googlesource.com/c/go/+/413374
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-09 12:06:56 +00:00
Tobias Klauser
dcf354512a syscall: wrap fstatat only once on linux/{arm64,riscv64}
Currently the linux/arm64 and linux/riscv64 ports wrap the fstatat
syscall twice, once in func fstatat and once in func Fstatat. Change the
latter to be a simple wrapper around the former to deduplicate some
code.

Change-Id: I82ec9374e2bcfe116eabf01f021eed1ee810ec15
Reviewed-on: https://go-review.googlesource.com/c/go/+/412934
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09 12:06:26 +00:00
Cuong Manh Le
0f8dffd0aa all: use ":" for compiler generated symbols
As it can't appear in user package paths.

There is a hack for handling "go:buildid" and "type:*" on windows/386.

Previously, windows/386 requires underscore prefix on external symbols,
but that's only applied for SHOSTOBJ/SUNDEFEXT or cgo export symbols.
"go.buildid" is STEXT, "type.*" is STYPE, thus they are not prefixed
with underscore.

In external linking mode, the external linker can't resolve them as
external symbols. But we are lucky that they have "." in their name,
so the external linker see them as Forwarder RVA exports. See:

 - https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-address-table
 - https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/pe-dll.c;h=e7b82ba6ffadf74dc1b9ee71dc13d48336941e51;hb=HEAD#l972)

This CL changes "." to ":" in symbols name, so theses symbols can not be
found by external linker anymore. So a hacky way is adding the
underscore prefix for these 2 symbols. I don't have enough knowledge to
verify whether adding the underscore for all STEXT/STYPE symbols are
fine, even if it could be, that would be done in future CL.

Fixes #37762

Change-Id: I92eaaf24c0820926a36e0530fdb07b07af1fcc35
Reviewed-on: https://go-review.googlesource.com/c/go/+/317917
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 11:28:56 +00:00
Tobias Klauser
5639fcae7f net/netip: fix method name in {AddrPort,Prefix}.IsValid godoc
In CL 339309 these were probably copied from the respective
godoc comments in package inet.af/netaddr, also see
https://pkg.go.dev/inet.af/netaddr#IPPort.IsValid and
https://pkg.go.dev/inet.af/netaddr#IPPrefix.IsValid

In net/netip the methods are named Addr. Adjust the godoc comments
accordingly.

Change-Id: Icfe1d73b647c2e195d96cd5b1073a734905134af
Reviewed-on: https://go-review.googlesource.com/c/go/+/421995
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-09 05:59:43 +00:00
Meng Zhuo
228f891c90 internal/cpu: add sha512 for arm64
The new M1 cpu (Apple) comes with sha512 hardware
acceleration feature.

Change-Id: I823d1e9b09b472bd21571eee75cc5314cd66b1ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/408836
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 01:22:19 +00:00
Meng Zhuo
4884599a54 debug/pe: add IMAGE_FILE_MACHINE_RISCV{32,64,128}
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format

Fixes #54251

Change-Id: I024130fd9f55b2f1c0439baacdc56cdbc3315215
Reviewed-on: https://go-review.googlesource.com/c/go/+/421357
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2022-08-09 01:21:43 +00:00
Ian Lance Taylor
365ca69472 runtime/cgo: add -fno-stack-protector to CFLAGS
Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Fixes #52919
Fixes #54313

Change-Id: I6f51d5e906503f61fc768ad8e30c163bad135087
Reviewed-on: https://go-review.googlesource.com/c/go/+/421935
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-08 21:29:53 +00:00
Russ Cox
3315066f46 cmd/link: detect glibc vs musl ldso at link time
Doing the test at link time lets us distribute one Linux toolchain
that works on both glibc-based and musl-based Linux systems.
The old way built a toolchain that only ran on one or the other.

Fixes #54197.

Change-Id: Iaae8c274c78e1091eee828a720b49646be9bfffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/420774
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2022-08-08 21:12:57 +00:00
Ian Lance Taylor
52dfdc5e1e mime: remove test ordering dependency
Arrange for tests that call setMimeInit to fully restore the old values,
by clearing the sync.Once that controls initialization.

Once we've done that, call initMime in initMimeUnixTest because
otherwise the test types loaded there will be cleared by the call to
initMime that previously was not being done.

For golang/go#51648

Change-Id: I8bf92b305fc4499337db06113817c9decdc5aedb
Reviewed-on: https://go-review.googlesource.com/c/go/+/421442
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-08 21:09:03 +00:00
Joe Tsai
9a4685f220 strings: avoid utf8.RuneError mangling in Split
Split should only split strings and not perform mangling
of invalid UTF-8 into ut8.RuneError.
The prior behavior is clearly a bug since mangling is not
performed in all other situations (e.g., separator is non-empty).

Fixes #53511

Change-Id: I112a2ef15ee46ddecda015ee14bca04cd76adfbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/413715
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-08 20:44:51 +00:00
Ian Lance Taylor
ced4d6fd2d syscall: rename close to closeFD
...to avoid conflicts with the predeclared close function.

Change-Id: If6a19a004c390f4e0795ec207c72caa79a7281f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/421934
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-08 20:38:29 +00:00