1
0
mirror of https://github.com/golang/go synced 2024-11-14 17:50:31 -07:00
Commit Graph

60882 Commits

Author SHA1 Message Date
Austin Clements
3e1bda08fb runtime: run debuglog tests when debuglog tag is *not* set
Currently, the debuglog tests only run when the debuglog build tag is
set because, until the last few CLs, all of debuglog was compiled away
without that build tag. This causes two annoying problems:

1. The tests basically never run, because we don't regularly test this
configuration.

2. If you do turn on the debuglog build tag, it's probably because
you're adding debuglogs into the runtime, which are very likely to
mess up these tests, so you wind up disabling the tests and they,
again, don't get coverage.

Now we've set things up so the debuglog implementation is always
accessible, if you ask nicely enough. So we can switch these tests to
run when the tag is *not* set, and turn off when the tag *is* set (and
you're probably adding actual log statements).

Change-Id: Ib68d7a5022d4f5db96e9c7c8010cbef21d11fe11
Reviewed-on: https://go-review.googlesource.com/c/go/+/600697
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-07-30 13:10:59 +00:00
Austin Clements
548158c4a5 runtime: switch debuglog from const-toggled to type-toggled
Currently, the debuglog build tag controls the dlogEnabled const, and
all methods of dlogger first check this const and immediately return
if dlog is not enabled. With constant folding and inlining, this makes
the whole dlog implementation compile away if it's not enabled.

However, we want to be able to test debuglog even when the build tag
isn't set. For that to work, we need a different mechanism.

This CL changes this mechanism so the debuglog build tag instead
controls the type alias for dlogger to be either dloggerImpl or
dloggerFake. These two types have the same method set, but one is just
stubs. This way, the methods of dloggerImpl don't need to be
conditional dlogEnabled, which sets us up to use the now
fully-functional dloggerImpl type in the test.

I confirmed that this change has no effect on the final size of the
cmd/go binary. It does increase the size of the runtime.a file by 0.9%
and make the runtime take ever so slightly longer to compile because
the compiler can no longer simply eliminate the bodies of the all of
dlogger during early deadcode. However, this all gets eliminated by
the linker. I consider this worth it to always get build and test
coverage of debuglog.

Change-Id: I81759e9e1411b7d369a23383a18b022ab7451421
Reviewed-on: https://go-review.googlesource.com/c/go/+/600696
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-30 13:10:56 +00:00
Austin Clements
eb6743d9d7 runtime: rename dlogger to dloggerImpl
This is a mechanical change, other than adding the type alias for dlogger.

This is a step in preparing us to make debuglog testable without the
debuglog build tag.

Change-Id: Ief12f0eaf5db98a8b006c759fd325dabcc9a52d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/600695
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-30 13:10:52 +00:00
limeidan
8b51146c69 cmd/internal/obj/loong64, cmd/asm: remove useless instructions
Change-Id: I180c40898672a757d72cd0ef38e6e8cc20dc4c3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/565618
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-30 00:34:48 +00:00
limeidan
5881c41e7f cmd/internal/obj/loong64: remove unuseless functions
Change-Id: Ieee97a9477090d4273e54a6667b0a051bb0c1e9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/565619
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-07-30 00:34:30 +00:00
limeidan
ff0c2d9634 cmd/internal/obj/loong64: fixed operand assignment error for BFPT/BFPF instructions
The BFPT correspond to BCNEZ instruction of LoongArch64 which structure
is:
	| op-p1 | offs[15:0] | op-p2 | cj | offs[20:16] |
The register REG_FCC0 should be assigned to the source operand cj which named rj here.

Change-Id: I696d0a46028924da1cd7e240fbb40a1913f1a757
Reviewed-on: https://go-review.googlesource.com/c/go/+/565620
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2024-07-30 00:34:05 +00:00
limeidan
950fcf129e cmd/internal/obj: add stmt prologueEnd to DWARF for loong64
Change-Id: Ib477b2402e32ebb3c7623caf4e9d62f3afdee92f
Reviewed-on: https://go-review.googlesource.com/c/go/+/556615
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-30 00:33:49 +00:00
limeidan
44663f333b cmd/internal/obj/loong64: return an error when getting address of tls variable
The tls variable is thread local variable, an operation to get its address
is not supported, so we should return an error here.

Change-Id: Ia6a637f549cb886fdb643bdc04eeb269849d1096
Reviewed-on: https://go-review.googlesource.com/c/go/+/565621
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2024-07-30 00:33:36 +00:00
Damien Neil
1ef6b2805e net/http: don't write HEAD response body in ResponseWriter.ReadFrom
Responses to HEAD requests don't have a body.

The ResponseWriter automatically discards writes to the response body
when responding to a HEAD request. ResponseWriter.ReadFrom was failing
to discard writes under some circumstances; fix it to do so.

Fixes #68609

Change-Id: I912f6b2b2a535df28ae37b875fcf15b10da1af2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/601475
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-07-29 21:29:55 +00:00
apocelipes
ac51262592 cmd,log,net,runtime: simplify string prefix and suffix processing
Use the TrimPrefix, TrimSuffix and CutPrefix to simplify the code.

Change-Id: I3e2b271ec0d3f9ce664b830e2b0c21ab47337ed0
GitHub-Last-Rev: 4bd1577d24
GitHub-Pull-Request: golang/go#68629
Reviewed-on: https://go-review.googlesource.com/c/go/+/601675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-29 21:29:17 +00:00
Damien Neil
fad6390f38 net/http: don't write body for HEAD responses in Response.Write
Fixes #62015

Change-Id: I88c5427f85e740d5b956942bb1c2727dac2935ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/601238
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 21:26:22 +00:00
Than McIntosh
aa97a012b4 cmd/compile: add script testing facility for compiler use
Add support for running script tests as part of the compiler's suite
of tests, hooking in the script test engine packages recently moved
from cmd/go to cmd/internal. These script tests will use the test
binary itself as the compile tool for Go builds, and can also run the
C compiler if needed. New script test cases (*.txt files) should be
added to the directory cmd/compile/testdata/script.

Updates #68606.

Change-Id: I9b056a07024b0a72320a89ad734e4b4a51f1c10c
Reviewed-on: https://go-review.googlesource.com/c/go/+/601361
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 16:13:19 +00:00
Than McIntosh
f021221a58 cmd/link: add script testing facility for linker use
Add support for running script tests as part of the linker's suite of
tests, hooking in the script test engine packages recently moved from
cmd/go to cmd/internal. Linker script tests will use the test binary
itself as the linker for Go builds, and can also run the C compiler if
needed. New script test cases (*.txt files) should be added to the
directory cmd/link/testdata/script.

For demo purposes, this patch also adds a new "randlayout_option.txt"
script test that replicates the existing linker's TestRandLayout
testpoint in script form.

Updates #68606.

Change-Id: Icf26bf657850e39548d6ea819f2542fc68a3899b
Reviewed-on: https://go-review.googlesource.com/c/go/+/601360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-07-29 16:13:11 +00:00
Than McIntosh
0d8aa5737e cmd/internal/script/scriptest: add new apis for tool test use
Add top level apis to provide a general-purpose "script test" runner
for clients within cmd, e.g. tools such as compile, link, nm, and so
on. This patch doesn't add any uses of the new apis, this will
happen in follow-on CLs.

Updates #68606.

Change-Id: Ib7200a75d4dc7dc50897628f1a6269937be15a76
Reviewed-on: https://go-review.googlesource.com/c/go/+/601359
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-29 16:13:04 +00:00
Than McIntosh
32b55eda5e cmd: relocate cmd/go/internal/script to cmd/internal/script
Relocate cmd/go's internal/script package up a level into
cmd/internal/script, so as to enable the use of script tests in
other cmd packages.  No change in functionality.

Updates #68606.

Change-Id: I3974b0bf59c76e0f459184c9f3090d6077dd5d91
Reviewed-on: https://go-review.googlesource.com/c/go/+/601358
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 16:12:46 +00:00
Than McIntosh
6b2ffc72b6 cmd: extract cmd/go's cfg.LookPath into separate pathcache package
Lift out the LookPath cached lookup utility function into a separate
"cmd/internal/pathcache" package, so that it can be reused in other
commands in addition to cmd/go. No change in functionality.

Change-Id: Ica7fa627000843360c3e353d40a9a70605fbe033
Reviewed-on: https://go-review.googlesource.com/c/go/+/601479
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 15:38:33 +00:00
Than McIntosh
9f0491c524 cmd: consolidate "known" os/arch tables into separate package
Common up the the "known OS/Arch" tables from { cmd/go/internal/imports,
cmd/go/internal/modindex, go/build } and relocate them to a new
package, internal/syslist. No change in functionality.

Updates #68606.

Change-Id: I6414a05c96b8fddbdbd9678d322cb49d9b1b0af3
Reviewed-on: https://go-review.googlesource.com/c/go/+/601357
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 15:38:20 +00:00
Than McIntosh
5feca4554f cmd: relocate cmd/go/internal/robustio to cmd/internal/robustio
Relocate cmd/go's internal/robustio package up a level into
cmd/internal/robustio, so that it can be used by other cmd/internal
packages. No change in functionality. This change is intended to be in
support of making the cmd/go script test framework available to other
commands in addition to just the Go command.

Updates #68606.

Change-Id: Ic8421ef59d9b7d79a50c3679d180cfa2546c4cd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/601356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-07-29 15:38:00 +00:00
Than McIntosh
44cdbc2dac cmd: relocate cmd/go/internal/par to cmd/internal/par
Relocate cmd/go's internal/par package up a level into
cmd/internal/par, so that it can be used by other cmd/internal
packages. No change in functionality. This change is intended to be in
support of making the cmd/go script test framework available to other
commands in addition to just the Go command.

Updates #68606.

Change-Id: I920a5d5c9b362584fabdbb2305414325b42856a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/601355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-07-29 15:37:29 +00:00
Michael Pratt
fd7d5a6e6c debug/buildinfo: add test for malformed strings
Updates #68592.

Change-Id: I00c6c740ca0bdd19af24e08a219ec3c90196097e
Reviewed-on: https://go-review.googlesource.com/c/go/+/601458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-07-29 15:34:55 +00:00
Michael Pratt
28aed4015e debug/buildinfo: add old-Go and not-Go tests
There is currently no coverage for the pre-1.18 buildinfo format, or for
parsing non-Go binaries. Add basic tests for each of these.

Updates #68592.

Change-Id: Iec14d29ffc1392e46f592c0c7bebf2eb75f7d0d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/601457
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-07-29 15:32:56 +00:00
Michael Pratt
d531e344ae debug/buildinfo: improve format documentation
Existing documentation is a bit sparse, and more importantly focuses
almost entirely on the old pre-1.18 format, with the new format as an
afterthought. Since the new format is the primary format, make it more
prominent.

Updates #68592.

Change-Id: I108ecde1b33650b4812fa5d278b08cb9197f6329
Reviewed-on: https://go-review.googlesource.com/c/go/+/601456
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-07-29 15:32:53 +00:00
Nick Ripley
705f9848ef internal/trace: reduce event size by packing goroutine statuses
The trace parser was using an otherwise-unused event argument to hold an
extra goroutine state argument for the GoStatus & GoStatusStack events.
This is needed because the execution tracer just records the "after" for
state transitions, but we want to have both the "before" and "after"
states available in the StateTransition info for the parsed event. When
GoStatusStack was added, the size of the argument array was increased to
still have room for the extra status. However, statuses are currently
only 1 byte, and the status argument is 8 bytes, so there is plenty of
room to pack the "before" and "after" statuses in a single argument. Do
that instead to avoid the need for an extra argument.

Change-Id: I6886eeb14fb8e5e046b6afcc5b19e04218bcacd4
Reviewed-on: https://go-review.googlesource.com/c/go/+/601455
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 14:38:04 +00:00
Cuong Manh Le
8173a29aaa test: add open-coded defer tests for too many exits path
Add test cases that will disable open-coded defer when there are too
many exits path, even though number of defer statements are not greater
than 8.

Updates #14939
Updates #34481

Change-Id: If5af0e107ffc30043bc2902063f8c9b131a8bca4
Reviewed-on: https://go-review.googlesource.com/c/go/+/601635
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-07-29 14:30:07 +00:00
limeidan
33b247437f cmd/internal/obj/loong64, cmd/asm: remove invalid optab items
Cases 27 and 28 are used to handle floating point operations, MOVW is usually
used for integer processing, and, in two cases there is code like this:
	a :=AMOVF
	if p.As == AMOVD {
	        a=AMOVD
	}
This means that MOVW was eventually replaced by MOVF, so removed MOVW from cases 27 and 28.

Change-Id: Ib438febab88058e98b569e0dfe70b8610668ee31
Reviewed-on: https://go-review.googlesource.com/c/go/+/565622
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-29 14:29:30 +00:00
Zxilly
f7ec58b2fc cmd/go: remove comparison that is always true
Change-Id: Ia77769e03ee040451c044afb332ae4efae3065b9
GitHub-Last-Rev: 66c6d71c13
GitHub-Pull-Request: golang/go#68623
Reviewed-on: https://go-review.googlesource.com/c/go/+/601615
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 14:27:04 +00:00
Meng Zhuo
0fe775e9f3 cmd/compile: drop TODO in NilCheck for riscv64
Also add log as arm/amd64 do.

Change-Id: I3698993e2df0ebf3bfcf8bad5fe389affa0e8eff
Reviewed-on: https://go-review.googlesource.com/c/go/+/595355
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-07-29 05:12:05 +00:00
Xiaolin Zhao
f95ae3d689 cmd/asm: change register type for loong64 floating-point
On Loong64, the two input operands and one output operand of the ADDF
instruction are both floating-point registers; and the floating-point
comparison instruction CMPEQ{F,D}, CMPGE{F,D}, CMPGT{F,D} both input
operands are floating-point registers, and the output operation is a
floating-point condition register, currently, only FCC0 is used as the
floating-point condition register.

Example:
	ADDF	F0, F1, F0
	CMPEQF	F0, F1, FCC0

Change-Id: I4c1c453e522d43f294a8dcab7b6b5247f41c9c68
Reviewed-on: https://go-review.googlesource.com/c/go/+/580281
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 02:47:00 +00:00
limeidan
aec5cc52ad cmd/link/internal/loadelf: remove useless relocation size information of loong64
As of CL 455017 we have switched to following the new style relocations on
loong64, these stack based relocations should be removed.

Change-Id: Ic129a5665cf6f183a32e13b6f1a55d712a99d721
Reviewed-on: https://go-review.googlesource.com/c/go/+/537335
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-07-27 14:13:45 +00:00
limeidan
c6117e8f05 cmd/link: pass architecture to isPLTCall
The relocation number of each architecture starts from 0. objabi.ElfRelocOffset
+ objabi.RelocType(xxx) cannot uniquely represent a relocation, so the new
argument 'arch' was added to help identify relocation.

Change-Id: Ic8121dbfd1a4f31f279d50ffdc9c932ce3066efd
Reviewed-on: https://go-review.googlesource.com/c/go/+/580275
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2024-07-27 14:02:24 +00:00
Guoqi Chen
0a9321ad7f cmd/internal/obj/loong64: add CPUCFG instructions support
The CPUCFG instruction is used to dynamically obtain the features
supported by the current CPU during the running of the program.

Go asm syntax:
	CPUCFG RJ, RD

Equivalent platform assembler syntax:
	cpucfg rd, rj

Reference: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I545110ff837ae9c5ccd7c448a1daf2d1277f9aa1
Reviewed-on: https://go-review.googlesource.com/c/go/+/493436
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-27 08:44:18 +00:00
Kir Kolyshkin
456785ceed os: rm unused code
CL 588675 removes pidfdRelease, but misses this one.

Change-Id: Id1d93d10baa5b26a42a2289e29624409c4e351f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/601461
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-27 00:57:42 +00:00
Robert Griesemer
9e40780a46 go/types, types2: add test for receiver type parameters
Issue #51503 was fixed with the rewrite in CL 594740.
Add a respective test case.

Fixes #51503.
For #51343.

Change-Id: Iff9e7e3274c5ad40789e107b6f62d17e335e2428
Reviewed-on: https://go-review.googlesource.com/c/go/+/595697
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-07-26 20:15:36 +00:00
Robert Griesemer
ea82219d1c go/types, types2: completely rewrite method receiver type checking
1) Factor out handling of receiver from Checker.funcType into
   Checker.collectRecv. Analyze the receiver parameter "manually"
   without resorting to calling Checker.collectParams.
   The code is more straight-forward and error handling is simpler
   because constructing the receiver type and variable is all handled
   in one function.

2) Change Checker.collectParams to collect parameter names and
   corresponding parameter variables, but do not declare them.
   Instead return two equal-length slices of parameter names
   and variables for later declaration.

3) Streamline Checker.funcType into a sequence of simple steps.
   By declaring the receiver and parameters after type parameters,
   there is no need for a temporary scope and scope squashing anymore.

4) Simplify Checker.unpackRecv some more: don't strip multiple
   *'s from receiver type expression because we don't typecheck
   that expression as a whole later (we don't use collectParams
   for receiver types anymore). If we have a **T receiver, we
   need to use *T (one * stripped) as receiver base type expression
   so that we can report an error later.

5) Remove Checker.recvTParamMap and associated machinery as it is
   not needed anymore.

6) Remove Scope.Squash/squash as it is not needed anymore.

7) Remove the explicit scope parameter from Checker.collectParams
   as it is not needed anymore.

8) Minor adjustments to tests: in some cases, error positions have
   shifted slightly (because we don't use Checker.collectParams to
   typecheck receivers anymore), and in some cases duplicate errors
   don't appear anymore (resolves TODOs).

Fixes #51343.

Change-Id: Ia77e939bb68e2912ef2e4ed68d2a7a0ad605c5ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/594740
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-26 20:14:26 +00:00
Robert Griesemer
1d542efe23 go/types, types2: adjust Checker.unpackRecv signature slightly
Instead of returning the receiver type name (rname), return the
receiver type base expression (base), with pointer indirections
stripped. The type base may or may not not be a type name. This
is needed for further rewrites of the signature type-checking code.
Adjust call sites accordingly to preserve existing behavior.

For #51343.

Change-Id: Ib472ca25d43ec340762d0a8dd1ad038568c2b2bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/595335
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-07-26 20:13:11 +00:00
Robert Griesemer
f234c9423b go/types, types2: fix test name (for debugging)
Change-Id: I982cf4da98af73ac41936a9d0b51588e3dbfd706
Reviewed-on: https://go-review.googlesource.com/c/go/+/594739
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-07-26 20:13:07 +00:00
Robert Griesemer
0509936823 go/types, types2: report type name in comp. literal error, if possible
When reporting an error for the element type of a struct literal, use
the element type's type name rather than it's underlying/core type.

Also, combine error reporting for invalid composite literal types in
one place, at the end.

Fixes #68184.

Change-Id: I1f407d5403777948da9a0eca95aacc1389f4bd44
Reviewed-on: https://go-review.googlesource.com/c/go/+/595075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-07-26 20:11:56 +00:00
Robert Griesemer
77a3c3b984 go/types, types2: remove superfluous if statement (minor cleanup)
Found while re-reading this code.

Change-Id: I5c87bb38ce07e49f1d122db1630c48d5ff082a30
Reviewed-on: https://go-review.googlesource.com/c/go/+/594975
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-07-26 20:11:54 +00:00
Robert Griesemer
1b7285d1ab go/types, types2: factor out method receiver validation
While at it, slightly regroup surounding code for clarity.

For #51343.

Change-Id: Ibb3a58c2ea138afae0be5315d98f698d7633b22a
Reviewed-on: https://go-review.googlesource.com/c/go/+/593455
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-26 20:11:50 +00:00
Robert Griesemer
e0ca2e04b8 go/types, types2: slightly reorganize method receiver checking
- move receiver checks up, closer to where the receiver is collected
- adjust some comments after verifying against some test cases
- removed some minor discrepancies between the two type checkers

For #51343.

Change-Id: I75b58efbed1e408df89b8d6536e6c6da45740f93
Reviewed-on: https://go-review.googlesource.com/c/go/+/593336
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-07-26 20:11:48 +00:00
Robert Griesemer
88bd985239 cmd/compile/internal/types2: use syntax.EndPos instead of local computation
Previously, the end position for a select statement clause body was
computed explicitly as the start of the next clause or the closing "}"
of the select statement, respectively.

Since syntax.EndPos computes the end position of a node, there's no
need to compute these positions "manually", we can simply use the
syntax.ExdPos for each clause. The positions are not exactly the
same as before but for the purpose of identifier visibility in
scopes there is no semantic change.

Simplifies the code and brings it more in line with go/types.

Change-Id: I24bca85a131a0ea31a2adaafc08ab713450258fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/593016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-07-26 20:11:46 +00:00
Robert Griesemer
e7b7f44ff8 go/types, types2: use ":" as start of implicit type switch case scopes
Adjust the respective API test accordingly.

Change-Id: I7ecc8899b40ae3b5aeb2c1e032935c672b41e0b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/592675
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-26 20:11:09 +00:00
Robert Griesemer
c761174d96 go/types, types2: cleanup of code handling type switch cases
Move logic for type-specific variable type into typeCases function
which already does all the relevant work.

Add more detailed documentation to typeCases function.

Uncomment alernative typeCases function so that it is being type-
checked and kept up-to-date. Since it's not (yet) used, the code
will not appear in the binary.

Follow-up on CL 592555.

Change-Id: I6e746503827d512a1dbf7b99b48345c480e61200
Reviewed-on: https://go-review.googlesource.com/c/go/+/592616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-07-26 20:11:06 +00:00
Robert Griesemer
dd005f43f1 go/types, types2: factor out list substitution code (cleanup)
- Replace the various subst.XList methods with a generic function.
- Rename comparable function to comparableType to avoid shadowing
  predeclared type comparable.
- Rename substFunc/Var to cloneFunc/Var which is more accurate.

Change-Id: I3243f2093e4c43a537766f47e3348402de517090
Reviewed-on: https://go-review.googlesource.com/c/go/+/587775
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-07-26 20:05:46 +00:00
Austin Clements
2a3e2e9b29 runtime: allow experimental trace batches to be reused
Currently, we can only cache regular trace event buffers on each M. As
a result, calling unsafeTraceExpWriter will, in effect, always return
a new trace batch, with all of the overhead that entails.

This extends that cache to support buffers for experimental trace
data. This way, unsafeTraceExpWriter can return a partially used
buffer, which the caller can continue to extend. This gives the caller
control over when these buffers get flushed and reuses all of the
existing trace buffering mechanism.

This also has the consequence of simplifying the experimental batch
infrastructure a bit. Now, traceWriter needs to know the experiment ID
anyway, which means there's no need for a separate traceExpWriter
type.

Change-Id: Idc2100176c5d02e0fbb229dc8aa4aea2b1cf5231
Reviewed-on: https://go-review.googlesource.com/c/go/+/594595
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-26 18:46:28 +00:00
Cuong Manh Le
fac95803eb runtime: remove darwin-amd64-10_14 builder check
By now macOS 11 is the minimum required version.

Updates #43926

Change-Id: I13716e2e521c26bd9997f0ea1b717cf72ab7e47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/601276
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-26 17:43:29 +00:00
Dmitri Shuralyov
d597642981 net: unskip TestUDPZeroBytePayload on Darwin
From information we have available in the issue, this test was flaky
on OS X 10.10 but not newer. By now macOS 11 is the minimum required
version, and 1000 local runs of the test passed, so try to unskip as
the next step.

For #29225.

Change-Id: I18a24459f01e53ef9de05b50d1dd8786d0683107
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_11,gotip-darwin-amd64_14
Reviewed-on: https://go-review.googlesource.com/c/go/+/601395
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-26 17:39:51 +00:00
Cuong Manh Le
b6efbd4efc cmd/compile, reflect: treat abi.NoEscape as cheap call
The abi.NoEscape function is introduced to replace all usages of
noescape wrapper in the standard library. However, the last usage in
reflect package is still present, because the inlining test failed if
abi.NoEscape were used. The reason is that reflect.noescape is treated
as a cheap call, while abi.NoEscape is not.

By treating abi.NoEscape a cheap call, the last usage of noescape in
reflect package can now be removed.

Change-Id: I798079780129221a5a26cbcb18c95ee30855b784
Reviewed-on: https://go-review.googlesource.com/c/go/+/601275
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-26 16:18:47 +00:00
Cuong Manh Le
deed521ea3 go/internal/gcimporter: cleanup test code pre Unified IR
Same as CL 543315 did for cmd/compile.

Change-Id: I56a200664c92fe34d4b78c2dbf6ed56288e89e0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/600675
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-07-26 16:16:28 +00:00
Cuong Manh Le
eb3dd019ed cmd/compile: cleanup test code pre Unified IR
Change-Id: Ibb9a7ce37ac28873aa720a64d1f89cb87fc5fa27
Reviewed-on: https://go-review.googlesource.com/c/go/+/543315
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-26 16:13:46 +00:00