[dev.typeparams] internal/buildcfg: always enable regabi on AMD64

In Go 1.17 we added register ABI on AMD64 on Linux/macOS/Windows
as a GOEXPERIMENT, on by default. In Go 1.18, we commit to always
enabling register ABI on AMD64.

Now "go build" for AMD64 always have goexperiment.regabi* tags
set. However, at bootstrapping cmd/dist does not set the tags
when building go_bootstrap. For this to work, unfortunately, we
need to hard-code AMD64 to use register ABI in runtime code.

Change-Id: I0b31e678e186b9cdeeb8502cd9e38ed0d7e72d4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/341151
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Cherry Mui 2021-08-02 12:18:19 -04:00
parent 0888a8cd2d
commit eeb7899137
4 changed files with 7 additions and 14 deletions

View file

@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build goexperiment.regabireflect
// +build goexperiment.regabireflect
package abi
const (

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !goexperiment.regabireflect
// +build !goexperiment.regabireflect
//go:build !goexperiment.regabireflect && !amd64
// +build !goexperiment.regabireflect,!amd64
package abi

View file

@ -105,9 +105,11 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (flags, baseline goexperiment
}
}
// regabiwrappers is always enabled on amd64.
// regabi is always enabled on amd64.
if goarch == "amd64" {
flags.RegabiWrappers = true
flags.RegabiReflect = true
flags.RegabiArgs = true
}
// regabi is only supported on amd64 and arm64.
if goarch != "amd64" && goarch != "arm64" {

View file

@ -6,6 +6,7 @@ package runtime
import (
"internal/abi"
"internal/goarch"
"internal/goexperiment"
"unsafe"
)
@ -419,12 +420,5 @@ func sigpanic0()
// structure that is at least large enough to hold the
// registers the system supports.
//
// Currently it's set to zero because using the actual
// constant will break every part of the toolchain that
// uses finalizers or Windows callbacks to call functions
// The value that is currently commented out there should be
// the actual value once we're ready to use the register ABI
// everywhere.
//
// Protected by finlock.
var intArgRegs = abi.IntArgRegs * goexperiment.RegabiArgsInt
var intArgRegs = abi.IntArgRegs * (goexperiment.RegabiArgsInt | goarch.IsAmd64)