1
0
mirror of https://github.com/golang/go synced 2024-09-29 07:24:32 -06:00
Commit Graph

53754 Commits

Author SHA1 Message Date
Robert Griesemer
aa5ff29dab go/parser: adjustments to error messages
- Use "expected X" rather then "expecting X".
- Report a better error when a type argument list is expected.
- Adjust various tests.

For #54511.

Change-Id: I0c5ca66ecbbdcae1a8f67377682aae6b0b6ab89a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425734
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-01 22:37:04 +00:00
Robert Griesemer
c801e4b10f cmd/compile/internal/syntax: use BadExpr instead of fake CallExpr in bad go/defer
If the go/defer syntax is bad, using a fake CallExpr may produce
a follow-on error in the type checker. Instead store a BadExpr
in the syntax tree (since an error has already been reported).

Adjust various tests.

For #54511.

Change-Id: Ib2d25f8eab7d5745275188d83d11620cad6ef47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425675
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-01 22:37:03 +00:00
Robert Griesemer
9b80d3d3db go/parser: remove validation of expression syntax, leave to type checker
Remove the code that verifies that an expression is a type or non-type
expression. For one, it cannot be done perfectly accurate
(e.g., consider *p which could be an indirection or a pointer type),
it also unnecessarily slows down parsing. It's simpler to leave the
verification to the type checker which has all the information needed.

Remove short compiler tests that tested the expression/type property.
Adjust a couple of go/types tests which now trigger because the parser
doesn't complain anymore.

Change file for benchmark from "parser.go" to "../printer/nodes.go"
to avoid a moving target when benchmarking.

The parser may be marginally faster when tested on nodes.go:

name          old time/op    new time/op    delta
ParseOnly-12    1.35ms ± 0%    1.31ms ± 0%   ~     (p=0.100 n=3+3)

name          old speed      new speed      delta
ParseOnly-12  39.9MB/s ± 0%  41.0MB/s ± 0%   ~     (p=0.100 n=3+3)

For #54511.

Change-Id: I9a32c24c2c6e843c3d1af4587651c352f378b490
Reviewed-on: https://go-review.googlesource.com/c/go/+/425716
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-01 22:35:46 +00:00
Kir Kolyshkin
4048f3ffb6 syscall: Faccessat: use faccessat2 on linux
Linux kernel 5.8 added the faccessat2 syscall taking a flags argument.
Attempt to use it in Faccessat and fall back to the existing
implementation mimicking glibc faccessat.

Do not export the new syscall value so we keep syscall API intact.

Part of this commit is generated by:

	GOOS=linux ./mkall.sh -syscalls zsyscall_linux_*.go

This is similar to [1] amended by [2]. Required for [3].

[1] https://go-review.googlesource.com/c/sys/+/246537
[2] https://go-review.googlesource.com/c/sys/+/246817
[3] https://go-review.googlesource.com/c/go/+/414824

Co-authored-by: Tobias Klauser <tklauser@distanz.ch>
Change-Id: Ib7fe5ba853c15d92e869df9a16b56b79b96e43a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/416115
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-01 22:00:28 +00:00
Kir Kolyshkin
36f191abcd syscall: make mkall.sh accept file list
Amend the "mkall.sh -syscalls" implementation to
 - prepend ./ before mksyscalls.pl;
 - accept the optional file list argument.

This is a preparation for CL 416115.

Change-Id: Ib4dc2b4aa0d2dd22a256414864e92f2d2fd957a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423676
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-01 22:00:15 +00:00
Keith Randall
dd323fe205 cmd/compile,runtime: redo growslice calling convention
Instead of passing the original length and the new length, pass
the new length and the length increment. Also use the new length
in all the post-growslice calculations so that the original length
is dead and does not need to be spilled/restored around the growslice.

old: growslice(typ, oldPtr, oldLen, oldCap, newLen) (newPtr, newLen, newCap)
new: growslice(oldPtr, newLen, oldCap, inc, typ) (newPtr, newLen, newCap)

where inc = # of elements added = newLen-oldLen

Also move the element type to the end of the call. This makes register
allocation more efficient, as oldPtr and newPtr can often be in the
same register (e.g. AX on amd64) and thus the phi takes no instructions.

Makes the go binary 0.3% smaller.

Change-Id: I7295a60227dbbeecec2bf039eeef2950a72df760
Reviewed-on: https://go-review.googlesource.com/c/go/+/418554
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-01 21:28:35 +00:00
hopehook
1e7f535475 cmd/compile: use (*strings.Reader).Reset
Since when go1.17 is now used for bootstraping.

Change-Id: If28338fc82e6c61f057d7eb3a4c2ed77846167df
Reviewed-on: https://go-review.googlesource.com/c/go/+/427558
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
2022-09-01 21:27:29 +00:00
hopehook
dced3461ee cmd/internal/pkgpath: use strings.Builder
Since when go1.17 is now used for bootstraping.

Change-Id: I5f763dec1cb152f94ab1c677d3fa26da17abf097
Reviewed-on: https://go-review.googlesource.com/c/go/+/427557
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-01 21:27:01 +00:00
hopehook
d31c4bc2de cmd/internal/objabi: use strings.Builder
Since when go1.17 is now used for bootstraping.

Change-Id: I5ee65aff72500a04e243238cffeae92ea659627b
Reviewed-on: https://go-review.googlesource.com/c/go/+/427555
Auto-Submit: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
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-09-01 21:26:43 +00:00
Michael Pratt
ef8414101f Revert "runtime: convert ncgocall to atomic type"
This reverts CL 426075.

Reason for revert: Import missing from cgocall.go.

Change-Id: Iac17e914045b83da30484dbe2a624cde526fb175
Reviewed-on: https://go-review.googlesource.com/c/go/+/427614
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-01 18:08:05 +00:00
cuiweixie
5a6db7c48f runtime: convert ncgocall to atomic type
For #53821

Change-Id: Ib0d62ee36487b3ed68e063976968f3cac6499e4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/426075
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-01 18:02:28 +00:00
Wayne Zuo
af991a6d28 cmd/compile: reorder rotate lowering rules in AMD64.rules
These rules should belong to lowering rules not optimizations.

Change-Id: I964d2c4b1d9bef0ede572978aff01cb11bf050ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/426197
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
2022-09-01 17:08:37 +00:00
cuiweixie
1f8e94e9f6 crypto/internal/boring/fipstls: convert required to atomic type
Change-Id: I73081b85e763122be1f5c0dbab25cecc9cf809df
Reviewed-on: https://go-review.googlesource.com/c/go/+/426087
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-01 17:06:14 +00:00
Daniel Martí
5bc8fa74f5 cmd/go: support long commands in asm and cgo
We have supported passing lists of arguments to the compiler and linker
for some time, since https://go.dev/issue/18468 was fixed.
The reason behind it is that some systems like Windows have relatively
small limits for commands, and some Go packages contain many source files.

This wasn't done for other Go toolchain programs like cgo and asm,
as there wasn't an initial need for it. A TODO was left for them.
The need has now arisen in the form of a bug report for a build of a
large Go package involving cgo.

Do asm as well, which could be triggered by lots of asm files.

I rebuilt Go itself with some basic logging to tell if any other
commands were being run with moderately large command lengths.
I only found one other: gcc being invoked with 300-500 bytes.

I didn't spot any length close to 1KiB, and we can't safely assume that
a user's CC compiler supports these "response files", so leave that as
another TODO for the future. Just like cgo and asm, we can revisit this
if any user reports a bug on the issue tracker.

Fixes #47235.

Change-Id: Ifcc099d7c0dfac3ed2c4e9e7a2d6e3d69b0ccb63
Reviewed-on: https://go-review.googlesource.com/c/go/+/427015
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-01 16:55:25 +00:00
Cuong Manh Le
b5b2cf519f go/types,types2: exclude tests that need cgo.Incomplete
Since when go/types,types2 do not know about build constraints, and
runtime/cgo.Incomplete is only available on platforms that support cgo.

These tests are also failing on aix with failure from linker, so disable
them on aix to make builder green. The fix for aix is tracked in #54814

Updates #46731
Updates #54814

Change-Id: I5d6f6e29a8196efc6c457ea64525350fc6b20309
Reviewed-on: https://go-review.googlesource.com/c/go/+/427394
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-01 15:27:07 +00:00
Joe Tsai
91ef076562 reflect: fix Value.SetIterXXX to check for the read-only bit
v.SetIterXXX(i) is semantically identical to v.Set(i.XXX()).
If the latter panics for unexported values, so should the former.

This change may breaking some programs, but the change is justified
under the "Go 1 and the Future of Go Programs" document because
the "library has a bug that violates the specification".
In this case, the "reflect" package does not accurately match
the behavior of the Go language specification.
Also, this API was recently released, so the number of users
who could be depending on this behavior is hopefully lower.

Fixes #54628

Change-Id: If86ede51f286e38093f6697944c089f616525115
Reviewed-on: https://go-review.googlesource.com/c/go/+/425184
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: David Chase <drchase@google.com>
2022-09-01 02:24:14 +00:00
Cuong Manh Le
64b260dbde test: use cgo.Incomplete instead of go:notinheap for "run" tests
Same as CL 421880, but for test directory.

Updates #46731

Change-Id: If8d18df013a6833adcbd40acc1a721bbc23ca6b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/421881
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-01 00:42:27 +00:00
Matthew Dempsky
ca634fa2c5 cmd/compile: reject not-in-heap types as type arguments
After running the types2 type checker, walk info.Instances to reject
any not-in-heap type arguments. This is feasible to check using the
types2 API now, thanks to #46731.

Fixes #54765.

Change-Id: Idd2acc124d102d5a76f128f13c21a6e593b6790b
Reviewed-on: https://go-review.googlesource.com/c/go/+/427235
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 23:52:00 +00:00
Matthew Dempsky
e4b624eae5 cmd/compile: use HaveInlineBody for unified IR
In go.dev/cl/419674 I added a mechanism to the inliner to allow
inlining to fail gracefully when a function body is missing, but I
missed we already have a mechanism for that: typecheck.HaveInlineBody.

This CL makes it overridable so that unified IR can plug in its
appropriate logic, like it does with the logic for building the
ir.InlinedCallExpr node.

While here, rename inline.NewInline to inline.InlineCall, because the
name "NewInline" is now a misnomer since we initialize it to oldInline
(now named oldInlineCall).

Change-Id: I4e65618d3725919f69e6f43cf409699d20fb797c
Reviewed-on: https://go-review.googlesource.com/c/go/+/427234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2022-08-31 22:22:43 +00:00
Keith Randall
33a7e5a4b4 cmd/compile: combine multiple rotate instructions
Rotating by c, then by d, is the same as rotating by c+d.

Change-Id: I36df82261460ff80f7c6d39bcdf0e840cef1c91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424894
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ruinan Sun <Ruinan.Sun@arm.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:10:52 +00:00
Keith Randall
5f5c018ca4 cmd/compile: redo mknode.go
The current mknode has a few problems:
1) It tends not to run successfully if the tree is in a broken state.
2) It requires that it be run by the go tool in the tree (somewhat related to 1)
3) It requires setting GOROOT
4) It imports code outside the tree (x/packages)

This makes mknode.go very fragile. In particular, I've spent lots of
time fighting mknode when adding or removing code, related to 1.

Rewrite to just use go/ast and friends. No typechecking, no importing,
etc. It can run with any go version, it doesn't need to be the one
corresponding to the code in which it is run. (e.g. you can use go
1.16 to run mknode). It will work as long as the ir package is parseable.

When run, it generates identical output to the old mknode.

Fixes #53959

Change-Id: I5ce0b55572ebcd2fcd11af57a5f29bbf9fa4ed33
Reviewed-on: https://go-review.googlesource.com/c/go/+/418375
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:09:44 +00:00
Keith Randall
69aed4712d cmd/compile: use better splitting condition for string binary search
Currently we use a full cmpstring to do the comparison for each
split in the binary search for a string switch.

Instead, split by comparing a single byte of the input string with a
constant. That will give us a much faster split (although it might be
not quite as good a split).

Fixes #53333

R=go1.20

Change-Id: I28c7209342314f367071e4aa1f2beb6ec9ff7123
Reviewed-on: https://go-review.googlesource.com/c/go/+/414894
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:08:26 +00:00
Keith Randall
af7f067e0d cmd/compile: tighten bounds for induction variables in strided loops
for i := 0; i < 9; i += 3

Currently we compute bounds of [0,8]. Really we know that it is [0,6].

CL 415874 computed the better bound as part of overflow detection.
This CL just incorporates that better info to the prove pass.

R=go1.20

Change-Id: Ife82cc415321f6652c2b5d132a40ec23e3385766
Reviewed-on: https://go-review.googlesource.com/c/go/+/415937
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-08-31 22:04:55 +00:00
cuiweixie
52d9e7f543 runtime: convert consistentHeapStats.gen to atomic type
For #53821

Change-Id: I9f57b84f6a2c29d750fb20420daef903a9311a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/425781
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 21:10:41 +00:00
Cuong Manh Le
ce77a46405 cmd/dist: disable cgo when testing internal linking of PIE
Since when internal linking cgo on some platforms, like android, is not
fully supported.

Updates #46731

Change-Id: I344a763f8dfb0cce04371d9305eee634bfd9ee77
Reviewed-on: https://go-review.googlesource.com/c/go/+/426199
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: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-31 20:33:16 +00:00
Wayne Zuo
da6556968f cmd/compile: simplify bounded shift on riscv64
The prove pass will mark some shifts bounded, and then we can use that
information to generate better code on riscv64.

Change-Id: Ia22f43d0598453c9417adac7017db28d7240948b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:21:00 +00:00
Joel Sing
971373f56a cmd/compile: remove NEG when used with SEQZ/SNEZ on riscv64
The negation does not change the comparison to zero.

Also remove unnecessary x.Uses == 1 condition from equivalent BEQZ/BNEZ rules.

Change-Id: I62dd8e383e42bfe5c46d11bbf78d8e5ff862a1d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426262
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 20:08:03 +00:00
Joel Sing
239115c3ef cmd/compile: avoid extending floating point comparision on riscv64
The result of these operations are already extended.

Change-Id: Ifc8ba362dda7035d8fd0d40046a96f61d3082877
Reviewed-on: https://go-review.googlesource.com/c/go/+/426260
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:05:46 +00:00
Joel Sing
9085ff5859 cmd/compile: avoid extending when already sufficiently masked on riscv64
Removes more than 2000 instructions from the Go binary on linux/risv64.

Change-Id: I6db3e3b1c93f29f00869adcba7c6192bfb90b25c
Reviewed-on: https://go-review.googlesource.com/c/go/+/426259
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:05:06 +00:00
cuiweixie
3f65ddbfd3 runtime: convert rwmutex.{readerCount,readerWait} to atomic type
For #53821

Change-Id: Ib10a745799e8bc0dc1d02a9c3e5d00b2842a9edd
Reviewed-on: https://go-review.googlesource.com/c/go/+/425779
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 19:54:04 +00:00
cuiweixie
c708532936 cmd/compile: add support for unsafe.{String,StringData,SliceData}
For #53003

Change-Id: I13a761daca8b433b271a1feb711c103d9820772d
Reviewed-on: https://go-review.googlesource.com/c/go/+/423774
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 17:15:15 +00:00
cuiweixie
301ca7513f runtime: convert worldIsStopped to atomic type
For #53821

Change-Id: I246b65ddb1171d2cab42f98092c64f20ecef392a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425778
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-31 17:15:13 +00:00
Tobias Klauser
0d6a7f9d2e internal/poll, internal/syscall/unix, net, runtime: convert openbsd (except mips64) to direct libc calls
Call libc wrappers directly rather than calling using syscall(2).

Updates golang/go#36435

Change-Id: I40be410c7472f7d89cbec2ebdc7c841c7726ca4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425637
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
2022-08-31 16:59:38 +00:00
Archana R
59b15726d1 cmd/asm: fix condition check to work on ppc64
A condition check was added to parse.go in CL 405542 to prevent
usage of scaled operands on ppc64. However while trying to improve
the error notification message, an if-condition was left out by
oversight. This CL corrects that.

Change-Id: I8cef3dd194c75343354ffe888b5e639e694badde
Reviewed-on: https://go-review.googlesource.com/c/go/+/426994
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 16:39:34 +00:00
eric fang
ebc75ac1c6 cmd/internal/obj/arm64: allow transition from $0 to ZR for MSR
Previously the first operand of MSR could be $0, which would be
converted to the ZR register. This is prohibited by CL 404316,
this CL restores this instruction format.

Change-Id: I5b5be59e76aa58423a0fb96942d1b2a9de62e311
Reviewed-on: https://go-review.googlesource.com/c/go/+/426198
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
2022-08-31 16:37:20 +00:00
bqyang
bc0a033266 runtime: fix comment typo in mpagealloc.go
leve --> level

Change-Id: Ia5ff46c79c4dda2df426ec75d69e8fcede909b47
GitHub-Last-Rev: e57cad22d9
GitHub-Pull-Request: golang/go#54788
Reviewed-on: https://go-review.googlesource.com/c/go/+/426974
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 16:27:09 +00:00
cuiweixie
fa0e3bffb4 runtime: convert semaRoot.nwait to atomic type
For #53821

Change-Id: I686fe81268f70acc6a4c3e6b1d3ed0e07bb0d61c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425775
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-31 15:33:00 +00:00
Andy Pan
6e74c4116a runtime: convert p.numTimers and p.deletedTimers to internal atomic types
Note that this changes the non-atomic operations in p.destroy() to atomic operations.

For #53821

Change-Id: I7bba77c9a2287ba697c87cce2c79293e4d1b3334
Reviewed-on: https://go-review.googlesource.com/c/go/+/425774
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-08-31 15:31:21 +00:00
cuiweixie
d01200e772 runtime: convert sig.{state,delivering} to atomic type
For #53821

Change-Id: I1c8df255ce9e2345d4fa45bd4d1761b73b9fa064
Reviewed-on: https://go-review.googlesource.com/c/go/+/425780
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:30:57 +00:00
cuiweixie
a25a34abe9 runtime: convert mcache.flushGen to atomic type
For #53821

Change-Id: I90ab52a45b7fb6b9e3ff1d6ea97251549306c7aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/425435
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:30:26 +00:00
Andy Pan
d3b35a4242 runtime: convert mOS.profileTimerValid to internal atomic type
For #53821

Change-Id: I6ef90867e918d4907baa83c5a811f1f93e8c09a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426196
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-31 15:12:21 +00:00
Andy Pan
28e388589b runtime: convert workType.cycles to internal atomic types
Note that this changes a non-atomic operation to atomic operation in gcStart().

For #53821

Change-Id: I754d254f6f190855144ff62151b6bae673b47867
Reviewed-on: https://go-review.googlesource.com/c/go/+/425776
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2022-08-31 15:12:18 +00:00
Andy Pan
5634629f0b runtime: convert extram and extraMWaiters to internal atomic type
Updates #53821

Change-Id: Id579b2f8e48dfbe9f37e02d2fa8c94354f9887a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/425480
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:01:49 +00:00
Sean Liao
3486735bf2 net/http/pprof: link docs to runtime/pprof
And add some documentation for the debug query param.

Fixes #27737
Fixes #53971

Change-Id: I629aaa2d4a43175381eb04872f1caad238519a41
Reviewed-on: https://go-review.googlesource.com/c/go/+/421635
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 09:38:38 +00:00
Wayne Zuo
3680b5e9c4 cmd/compile: teach prove about bitwise OR operation
Fixes #45928.

Change-Id: Ifbb0effbca4ab7c0eb56069fee40edb564553c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/410336
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 09:35:45 +00:00
Wayne Zuo
d2e0587f77 cmd/compile: derive relation between x+delta and x in prove
If x+delta cannot overflow/underflow, we can derive:
  x+delta < x if delta<0 (this CL included)
  x+delta > x if delta>0 (this CL not included due to
  a recursive stack overflow)

Remove 95 bounds checks during ./make.bat

Fixes #51622

Change-Id: I60d9bd84c5d7e81bbf808508afd09be596644f09
Reviewed-on: https://go-review.googlesource.com/c/go/+/406175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 09:35:10 +00:00
Khaled Yakdan
6b113c0fec cmd/compile: avoid excessive libfuzzer instrumentation of int compares
Do not intercept integer compares that are used to increment libFuzzer's
8-bit counters. This is unnecessary and has a negative impact on the
fuzzing performance. This fixes #53760.

Change-Id: Id22efac968b18014eedabb6f0762e1456897024e
GitHub-Last-Rev: 52f69fd68c
GitHub-Pull-Request: golang/go#53786
Reviewed-on: https://go-review.googlesource.com/c/go/+/416796
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 07:49:01 +00:00
shaoliming
2f103873c5 cmd/compile/internal/noder: reuse package scope's names
Change-Id: I2cc62efb7bb3b47f1ee3ed0bb77e35c47e2df9a1
GitHub-Last-Rev: 106cb494de
GitHub-Pull-Request: golang/go#54718
Reviewed-on: https://go-review.googlesource.com/c/go/+/426297
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-31 06:12:44 +00:00
Cuong Manh Le
ee0e40aaef reflect: use cgo.Incomplete instead of go:notinheap in tests
go:notinheap will be replaced by runtime/internal/sys.NotInHeap, and for
longer term, we want to restrict all of its usages inside the runtime
package only.

Updates #46731

Change-Id: I267adc2a19f0dc8a1ed29b5b4aeec1a7dc7318d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/421880
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 01:16:54 +00:00
Keith Randall
bd56cb90a7 cmd/compile: regenerate node_gen.go
Looks like CL 413361 which added CaseClause.RTypes missed the need
to regenerate this file.

Also CL 413357 added DynamicTypeAssertExpr.SrcRType, same issue.

Change-Id: I45e4d0685cc2f9bdcef1fad2cfc92e7005ef363e
Reviewed-on: https://go-review.googlesource.com/c/go/+/426675
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-30 21:30:15 +00:00