aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
AgeCommit message (Collapse)Author
2024-09-10cmd/compile: optimize []byte(string1 + string2)Paschalis Tsilias
This CL optimizes the compilation of string-to-bytes conversion in the case of string additions. Fixes #62407 Change-Id: Ic47df758478e5d061880620025c4ec7dbbff8a64 Reviewed-on: https://go-review.googlesource.com/c/go/+/527935 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Tim King <taking@google.com>
2024-09-09all: remove unnecessary symbols and add missing symbolscuishuang
Change-Id: I535a7aaaf3f9e8a9c0e0c04f8f745ad7445a32f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/611678 Run-TryBot: shuang cui <imcusg@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-09-06cmd/internal/obj/arm64: Add helpers for span7 passesSebastian Nickolls
Adds helper functions for the literal pooling, large branch handling and code emission stages of the span7 assembler pass. This hides the implementation of the current assembler from the general workflow in span7 to make the implementation easier to change in future. Updates #44734 Change-Id: I8859956b23ad4faebeeff6df28051b098ef90fed Reviewed-on: https://go-review.googlesource.com/c/go/+/595755 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06cmd/internal: use t.TempDir in testsKir Kolyshkin
Change-Id: I3d4c66793afa3769a8450e2d65093a0f9115596e Reviewed-on: https://go-review.googlesource.com/c/go/+/611043 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06cmd/internal/script: use sync.OnceValueKir Kolyshkin
Change-Id: I384a7391a26f24402c055aec98b37927305e2a39 Reviewed-on: https://go-review.googlesource.com/c/go/+/611042 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-06cmd/internal/objabi: use sync.OnceValueKir Kolyshkin
Change-Id: I09c134fff728d32c5bc475889b8c673cc18120a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/611041 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06cmd/internal/testdir: remove temp filesKir Kolyshkin
Function stdlibImportcfgFile creates a temporary directory and a file in it, which are never deleted. The easiest to fix this (without creating the file unnecessarily, or creating it multiple times) is to add a global tmpDir and use it in stdlibImportcfgFile. Change-Id: Ia971b4478d9e0fa7c3a9b4c66e13fd5a4af9cbaa Reviewed-on: https://go-review.googlesource.com/c/go/+/610818 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-06cmd/internal/testdir: use sync.OnceValueKir Kolyshkin
Change-Id: I90fd0318c7f85032ef8b6621331fe2a8a2da41f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/611040 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> 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-09-06cmd/internal/testdir: use os.ReadDirKir Kolyshkin
Change-Id: I9828c7c4f9c27efabf072ec1d83b3ce94c14cc0f Reviewed-on: https://go-review.googlesource.com/c/go/+/610817 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-05cmd/internal/obj/loong64: add support for instructions ANDN and ORNXiaolin Zhao
Go asm syntax: ANDN/ORN RK, RJ, RD or ANDN/ORN RK, RD Equivalent platform assembler syntax: andn/orn rd, rj, rk or andn/orn rd, rd, rk Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: I6d240ecae8f9443811ca450aed3574f13f0f4a81 Reviewed-on: https://go-review.googlesource.com/c/go/+/610475 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: abner chenc <chenguoqi@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2024-09-04cmd: remove notsha256 packageCuong Manh Le
All of its usages were removed in CL 610596. Updates #51940 Updates #64751 Change-Id: I72a0ea4bd44a2f671e032bffa1facf84822a90f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/610599 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: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2024-09-04cmd: use 16 bytes hash when possibleCuong Manh Le
CL 402595 changes all usages of 16 bytes hash to 32 bytes hash by using notsha256. However, since CL 454836, notsha256 is not necessary anymore, so this CL reverts those changes to 16 bytes hash using cmd/internal/hash package. Updates #51940 Updates #64751 Change-Id: Ic015468ca4a49d0c3b1fb9fdbed93fddef3c838f Reviewed-on: https://go-review.googlesource.com/c/go/+/610598 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-04cmd: use 20 bytes hash when possibleCuong Manh Le
CL 402595 changes all usages of 20 bytes hash to 32 bytes hash by using notsha256. However, since CL 454836, notsha256 is not necessary anymore, so this CL reverts those changes to 20 bytes hash using cmd/internal/hash package. Updates #51940 Updates #64751 Change-Id: Icb08d5a0d8032a3c4d050ff7b2298d31c483b88b Reviewed-on: https://go-review.googlesource.com/c/go/+/610597 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
2024-09-04cmd: do not use notsha256Cuong Manh Le
CL 402595 used notsha256 to prevent the compiler from depending on cgo-based implementations of sha1 and sha256. However, since CL 454836, cmd is built with CGO_ENABLED=0, which will disable boringcrypto. Thus all usages of notsha256 is not necessary anymore. Updates #51940 Updates #64751 Change-Id: I503090f7a2efb5723e8a79523b143dc7cdb4edd0 Reviewed-on: https://go-review.googlesource.com/c/go/+/610596 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: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2024-09-04cmd/internal: add hash packageCuong Manh Le
To be used in compiler toolchain instead of notsha256. Change-Id: Iceeacb6df7dfa7111ec98f070eba8e27a4ddbe8b Reviewed-on: https://go-review.googlesource.com/c/go/+/610595 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-04all: fix printf(var) mistakes detected by latest printf checkerAlan Donovan
These will cause build failures once we vendor x/tools. In once case I renamed a function err to errf to indicate that it is printf-like. Updates golang/go#68796 Change-Id: I04d57b34ee5362f530554b7e8b817f70a9088d12 Reviewed-on: https://go-review.googlesource.com/c/go/+/610739 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Tim King <taking@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2024-09-04cmd/internal/obj: drop NOFRAME TODOMichael Pratt
NOFRAME is long since implemented beyond ppc64x. Change-Id: Ia02c732badc3330bf876723bb64eff390f3e6622 Reviewed-on: https://go-review.googlesource.com/c/go/+/610695 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-09-03cmd: replace many sort.Interface with slices.Sort and SortFuncZxilly
with slices there's no need to implement sort.Interface Change-Id: I59167e78881cb1df89a71e33d738d6aeca7adb71 GitHub-Last-Rev: 507ba84453f7305b6b2bf6317292111c00c93ffe GitHub-Pull-Request: golang/go#68724 Reviewed-on: https://go-review.googlesource.com/c/go/+/602895 Reviewed-by: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2024-09-03all: omit unnecessary 0 in slice expressionnlwkobe30
All changes are related to the code, except for the comments in src/regexp/syntax/parse.go and src/slices/slices.go. Change-Id: I73c5d3c54099749b62210aa7f3182c5eb84bb6a6 GitHub-Last-Rev: 794aa9b0539811d00e1cd42be1e8d9fe9afe0281 GitHub-Pull-Request: golang/go#69170 Reviewed-on: https://go-review.googlesource.com/c/go/+/609678 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-08-23cmd/internal/obj/loong64: add support for instructions BSTRPICK.{W/D} and ↵Xiaolin Zhao
BSTRINS.{W/D} Go asm syntax: BSTRPICK{W/V} $msb, RJ, $lsb, RD BSTRINS{W/V} $msb, RJ, $lsb, RD Equivalent platform assembler syntax: bstrpick.{w/d} rd, rj, $msb, $lsb bstrins.{w/d} rd, rj, $msb, $lsb Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: I8b89b766ed22a96da7d8d5b2b2873382a49208de Reviewed-on: https://go-review.googlesource.com/c/go/+/604735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-08-21cmd/objdump: add s390x GNU disasm supportSrinivas Pokala
This CL provides vendor support for s390x disassembler gnu syntax. go get golang.org/x/arch@master go mod tidy go mod vendor For #15255 Change-Id: Ia75fa515e7ea7d56913a28147c65650a7ab3062c Reviewed-on: https://go-review.googlesource.com/c/go/+/581015 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Auto-Submit: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
2024-08-20src: fix typosAlexander Cyon
Fix typos in ~30 files Change-Id: Ie433aea01e7d15944c1e9e103691784876d5c1f9 GitHub-Last-Rev: bbaeb3d1f88a5fa6bbb69607b1bd075f496a7894 GitHub-Pull-Request: golang/go#68964 Reviewed-on: https://go-review.googlesource.com/c/go/+/606955 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-20cmd/internal/testdir: add a -gomodversion flagTim King
Adds a -gomodversion flag to testdir. This sets the go version in generated go.mod files. This is just runindir tests at the moment. This is a building block so that tests can be written for exported type parameterized aliases (like reproducing #68526). This also adds a test that uses this feature. A type parameterized alias is used so aliastypeparams and gotypesalias must be enabled. gotypesalias is enabled by the go module version. The alias is not exported and will not appear in exportdata. The test shows the package containing the alias can be imported. This encapsulates the level of support of type parameterized aliases in 1.23. Updates #68526 Updates #68778 Change-Id: I8e20df6baa178e1d427d0fff627a16714d9c3b18 Reviewed-on: https://go-review.googlesource.com/c/go/+/604102 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com>
2024-08-20cmd/compile/internal/ssagen: improve intrinsic architecture handlingJoel Sing
The architecture handling code for intrinsics is more complex than it needs to be. sys.Archs is already an array of *sys.Arch and the existing InFamily function can be used instead of a reimplementation. Add some test coverage for sys.Arch.InFamily while here. Change-Id: Ia764f211114fea65424c09a421c5ccb02b7187b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/605476 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-19all: remove duplicated words in commentsOleksandr Redko
Change-Id: Id991ec0826a4e2857f00330b4b7ff2b71907b789 Reviewed-on: https://go-review.googlesource.com/c/go/+/606615 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-08-15cmd/internal/obj/loong64: add testcases for assemblerlimeidan
Change-Id: Ib2c8e0bc314c0f2b58f69a5340355cac4786a91f Reviewed-on: https://go-review.googlesource.com/c/go/+/604175 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-14cmd/internal/obj/arm64: Emit UDF instruction for undefined Prog nodesSebastian Nickolls
UDF provides a stronger guarantee for generating the Undefined Instruction exception than the current value being emitted. Change-Id: I234cd70ce04f21311959c1061ae24992438105f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/605155 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-08-13cmd/link, runtime: support library mode on wasip1Cherry Mui
This CL adds support of "library", i.e. c-shared, build mode on wasip1. When -buildmode=c-shared is set, it builds a Wasm module that is intended to be used as a library, instead of an executable. It does not have the _start function. Instead, it has an _initialize function, which initializes the runtime, but not call the main function. This is similar to the c-shared build mode on other platforms. One difference is that unlike cgo callbacks, where Ms are created on- demand, on Wasm we have only one M, so we just keep the M (and the G) for callbacks. For #65199. Change-Id: Ieb21da96b25c1a9f3989d945cddc964c26f9085b Reviewed-on: https://go-review.googlesource.com/c/go/+/604316 Reviewed-by: Achille Roussel <achille.roussel@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-08-13cmd/compile/internal/types2: change inference error messageTim King
Changes the type inference error message so that the position is proceeded by a space. cmd/go rewrites the output of gc to replace absolute paths at the beginning of lines and those proceeded by a space or a tab to relative paths. Updates testdir to do the same post processing on the output of tests as cmd/go. Fixes #68292 Change-Id: Ie109b51143e68f6e7ab4cd19064110db0e609a7e Reviewed-on: https://go-review.googlesource.com/c/go/+/603097 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-12cmd/internal/obj/wasm: handle stack unwinding in wasmexportCherry Mui
CL 603055 added basic support of wasmexport. This CL follows it and adds stack unwinding handling. If the wasmexport Go function returns normally, we directly return to the host. If the Go function unwinds the stack (e.g. goroutine switch, stack growth), we need to run a PC loop to call functions on the new stack, similar to wasm_pc_f_loop. One difference is that when the wasmexport function returns normally, we need to exit the loop and return to the host. Now a wasmimport function can call back into the Go via wasmexport. During the callback the stack could have moved. The wasmimport code needs to read a new SP after the host function returns, instead of assuming the SP doesn't change. For #65199. Change-Id: I62c1cde1c46f7eb72625892dea41e8137b361891 Reviewed-on: https://go-review.googlesource.com/c/go/+/603836 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
2024-08-09cmd/compile: add basic wasmexport supportCherry Mui
This CL adds a compiler directive go:wasmexport, which applies to a Go function and makes it an exported function of the Wasm module being built, so it can be called directly from the host. As proposed in #65199, parameter and result types are limited to 32-bit and 64-bit integers and floats, and there can be at most one result. As the Go and Wasm calling conventions are different, for a wasmexport function we generate a wrapper function does the ABI conversion at compile time. Currently this CL only adds basic support. In particular, - it only supports executable mode, i.e. the Go wasm module calls into the host via wasmimport, which then calls back to Go via wasmexport. Library (c-shared) mode is not implemented yet. - only supports wasip1, not js. - if the exported function unwinds stacks (goroutine switch, stack growth, etc.), it probably doesn't work. TODO: support stack unwinding, c-shared mode, js. For #65199. Change-Id: Id1777c2d44f7d51942c1caed3173c0a82f120cc4 Reviewed-on: https://go-review.googlesource.com/c/go/+/603055 Reviewed-by: Than McIntosh <thanm@golang.org> Reviewed-by: Randy Reddig <randy.reddig@fastly.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-06cmd/internal/objabi, cmd/link/internal: add new relocations used in internal ↵limeidan
linking Change-Id: I1b7c258f0ea3b847a92ccd6644b653e11e7a5ef0 Reviewed-on: https://go-review.googlesource.com/c/go/+/555115 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
2024-08-06cmd/internal/obj: minor refactor of wasmimport codeCherry Mui
This CL does some minor refactoring of the code handling wasmimport. - Put the WasmImport aux reading and writing code together for symmetry. - Define WasmFuncType, embedded in WasmImport. WasmFuncType could also be used (later) for wasmexport. - Move code generation code to a separate function. The containing function is already pretty large. - Simplify linker code a little bit. The loader convention is to return the 0 Sym for nonexistent symbol, instead of a separate boolean. No change in generated code. Passes toolstash -cmp (GOARCH=wasm GOOS=wasip1 go build -toolexec "toolstash -cmp" -a std cmd). Change-Id: Idc2514f84a08621333841ae4034b81130e0ce411 Reviewed-on: https://go-review.googlesource.com/c/go/+/603135 Reviewed-by: Than McIntosh <thanm@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2024-08-05cmd/internal/testdir: fix failure when GOAMD64=v3 is specified in goenv filekhr@golang.org
Fixes #68548 Add GOENV=off, GOFLAGS= to the build of the stdlib, so that it matches what runcmd does. This ensures that the runtime and the test are built with the same flags. As opposed to before this CL, where flags were used in the stdlib build but not the runcmd build. (Part of the problem here is that cmd/internal/testdir/testdir_test.go plays fast and loose with the build cache to make the tests run faster. Maybe some of that fast-and-loose mechanism can be removed now that we have a better build cache? I'm not sure.) Change-Id: I449d4ff517c69311d0aa4411e7fb96c0cca49269 Reviewed-on: https://go-review.googlesource.com/c/go/+/600276 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-03cmd/internal/obj/loong64: add FLDX,FSTX,LDX.STX instructions supportGuoqi Chen
The LDX.{B,BU,H,HU,W,WU,D},STX.{B,H,W,D}, FLDX.{S,D}, FSTX.{S,D} instruction on Loong64 implements memory access operations using register offset Go asm syntax: MOV{B,BU,H,HU,W,WU,V} (RJ)(RK), RD MOV{B,H,W,V} RD, (RJ)(RK) MOV{F,D} (RJ)(RK), FD MOV{F,D} FD, (RJ)(RK) Equivalent platform assembler syntax: ldx.{b,bu,h,hu,w,wu,d} rd, rj, rk stx.{b,h,w,d} rd, rj, rk fldx.{s,d} fd, rj, rk fstx.{s,d} fd, rj, rk Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: Ic7d13bf45dab8342f034b6469465e6337a087144 Reviewed-on: https://go-review.googlesource.com/c/go/+/588215 Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn> Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2024-08-03cmd/internal/obj/loong64: add support for instructions ↵Xiaolin Zhao
FTINT{RM/RP/RZ/RNE}.{W/L}.{S/D} These instructions convert floating-point numbers to fixed-point numbers with the specified rounding pattern. Go asm syntax: FTINT{RM/RP/RZ/RNE}{W/V}{F/D} FJ, FD Equivalent platform assembler syntax: ftint{rm/rp/rz/rne}.{w/l}.{s/d} fd, fj Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: I6d650d1b48b10296d01a98fadf9d806206f9b96e Reviewed-on: https://go-review.googlesource.com/c/go/+/590995 Auto-Submit: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
2024-08-03cmd/internal/obj/loong64: add support for instructions FFINT.{S/D}.{W/L} and ↵Xiaolin Zhao
FTINT.{W/L}.{S/D} Go asm syntax: FFINT{F/D}{W/V} FJ, FD FTINT{W/V}{F/D} FJ, FD Equivalent platform assembler syntax: ffint.{s/d}.{w/l} fd, fj ftint.{w/l}.{s/d} fd, fj Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: Ie7646c5d49645c63b274b34b66539f10370f4930 Reviewed-on: https://go-review.googlesource.com/c/go/+/590996 Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Auto-Submit: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-03cmd/internal/obj/loong64: add support for instructions FCOPYSIGN.{S/D} and ↵Xiaolin Zhao
FCLASS.{S/D} Go asm syntax: FCOPYSG{F/D} FK, FJ, FD FCLASSF{F/D} FJ, FD Equivalent platform assembler syntax: fcopysign.{s/d} fd, fj, fk fclass.{s/d} fd, fj Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: Ied34b71c9d0b34456ac5782a59d29d2d0229e326 Reviewed-on: https://go-review.googlesource.com/c/go/+/590675 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn> 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>
2024-08-02cmd/internal/obj/loong64: adjust the order of class nameslimeidan
Change-Id: I0ff9a4f7b4758f44eaedfd821ad80a86b58e55a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/565625 Reviewed-by: Qiqi Huang <huangqiqi@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> Auto-Submit: abner chenc <chenguoqi@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-08-02cmd/internal/obj/loong64: add support for instructions F{MAX/NIN}.{S/D}Xiaolin Zhao
Go asm syntax: F{MAX/MIN}{F/D} FK, FJ, FD Equivalent platform assembler syntax: f{max/min}.{s/d} fd, fj, fk Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: Ib11fed1fe3700be5ebba33b5818661c4071b7b7c Reviewed-on: https://go-review.googlesource.com/c/go/+/590676 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2024-08-02cmd/internal/obj/loong64: add support for MOV{GR2FCSR/FCSR2GR/FR2CF/CF2FR} ↵Xiaolin Zhao
instructions Go asm syntax example: MOVV R4, FCSR0 MOVV FCSR1, R5 MOVV F4, FCC0 MOVV FCC1, F5 Equivalent platform assembler syntax: movgr2fcsr fcsr0, r4 movfcsr2gr r5, fcsr1 movfr2cf fcc0, f4 movcf2fr f5, fcc1 Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html This change also merges the case of floating point move instructions and add checks for the range of special registers. Change-Id: Ib08fbce83e7a31dc0ab4857bf9ba959855241d1c Reviewed-on: https://go-review.googlesource.com/c/go/+/580279 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-08-01cmd/internal/obj/loong64: remove Class C_LEXT and C_SEXTlimeidan
There is no need to check whether the symbol is empty, since we have already checked it before. In addition, it is enough to use C_ADDR to represent memory access, C_LEXT and C_SEXT are not needed. Change-Id: I7158d6b549482b35cd9ac5fba781648fb3f21922 Reviewed-on: https://go-review.googlesource.com/c/go/+/565615 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
2024-08-01cmd/internal/obj/loong64: optimize the code logic of jump instructionslimeidan
If p.To.Sym is nil, that means we can get the target offset from p.To.Target().pc - c.pc,only when p.To.Sym is not nil, we need relocation to get the true address of target symbol. Change-Id: Ied52f675c6aa6e8fb8d972b7699f5cadd1ecb268 Reviewed-on: https://go-review.googlesource.com/c/go/+/565627 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn>
2024-08-01cmd/internal/obj/loong64: merge two branch classes into onelimeidan
When the kind of the operand is TYPE_BRANCH, we cannot determine whether it is a long branch or a short branch, so we merge these two classes into one. Change-Id: I7d7fa8f62ff02791ec3de4e3e3f7610bc9cb1743 Reviewed-on: https://go-review.googlesource.com/c/go/+/565626 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-08-01cmd/internal/obj/loong64: reclassify three-register operation instructions ↵limeidan
and two-register operation instructions The instructions belonging to case 32 have the same structure as the instructions in case 2. The instructions in case 33 are actually two-register operation instructions. We move their definitions from function oprrr to oprr and merge their implementation into case 9. Change-Id: Id04aaa497e78d8198a58f8d406876d16b3f393a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/565616 Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-07-31cmd/internal/obj/loong64: optimize instruction implementationlimeidan
The plan9 instructions ASLLV and -ASLLV are translated into the same assembly instructions, so -ASLLV can be removed and replaced with ASLLV in the corresponding position. ASRLV and -ASRLV have the same reason as the above two instructions. Change-Id: I4bd79ca7bb070f7a924a0205ef2f19cf2b9ae2c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/565623 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2024-07-31cmd/internal/obj/loong64: remove case 17 in func asmoutlimeidan
There is no relative optab item case 17, remove it. Change-Id: I3ceaa3283c3641afafd46362737ff847a1d80665 Reviewed-on: https://go-review.googlesource.com/c/go/+/565617 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: 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: Michael Knyszek <mknyszek@google.com>
2024-07-31cmd/internal/obj/loong64: rename Class to represent the external symbol addresslimeidan
There is no need to define another C_SECON Class to express short external symbol address, because the external symbol address is unknown in assembler, relocate it in linker. Change-Id: Id9fbd848c43ca63a21f2b6640e947140c26eeaf7 Reviewed-on: https://go-review.googlesource.com/c/go/+/565624 Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: 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> Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2024-07-31cmd: add README generation for compiler + linker script testsThan McIntosh
Add in automatic README generation and README consistency checking for the cmd/compile and cmd/link script tests. This code is adapted from the similar facility in cmd/go (e.g. scriptreadme_test.go); the README helps folks writing new tests understand the mechanics. Updates #68606. Change-Id: I8ff7ff8e814abd4385bd670440511b2c60a4cef6 Reviewed-on: https://go-review.googlesource.com/c/go/+/601756 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-31cmd/internal/script: new hook for adding in toolchain script conditionsThan McIntosh
Introduce a new function AddToolChainScriptConditions that augments a default "script.Cond" set with a collection of useful conditions, including godebug/goexperiment, cgo, race support, buildmode, asan, msan, and so on. Having these conditions available makes it easier to write script tests that deal with specific build-flavor corner cases. The functions backing the new conditions are helper functions migrated over from the Go command's script test setup. Updates #68606. Change-Id: I14def1115b54dc47529c983abcd2c5ea9326b9de Reviewed-on: https://go-review.googlesource.com/c/go/+/601715 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>