mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: explode GOEXPERIMENT=regabi into 5 sub-experiments
This separates GOEXPERIMENT=regabi into five sub-experiments: regabiwrappers, regabig, regabireflect, regabidefer, and regabiargs. Setting GOEXPERIMENT=regabi now implies the working subset of these (currently, regabiwrappers, regabig, and regabireflect). This simplifies testing, helps derisk the register ABI project, and will also help with performance comparisons. This replaces the -abiwrap flag to the compiler and linker with the regabiwrappers experiment. As part of this, regabiargs now enables registers for all calls in the compiler. Previously, this was statically disabled in regabiEnabledForAllCompilation, but now that we can control it independently, this isn't necessary. For #40724. Change-Id: I5171e60cda6789031f2ef034cc2e7c5d62459122 Reviewed-on: https://go-review.googlesource.com/c/go/+/302070 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
c71acbfe83
commit
eaa1ddee84
20 changed files with 131 additions and 60 deletions
|
|
@ -146,7 +146,28 @@ func init() {
|
|||
|
||||
// regabi is only supported on amd64.
|
||||
if GOARCH != "amd64" {
|
||||
Regabi_enabled = 0
|
||||
Experiment.regabi = false
|
||||
Experiment.RegabiWrappers = false
|
||||
Experiment.RegabiG = false
|
||||
Experiment.RegabiReflect = false
|
||||
Experiment.RegabiDefer = false
|
||||
Experiment.RegabiArgs = false
|
||||
}
|
||||
// Setting regabi sets working sub-experiments.
|
||||
if Experiment.regabi {
|
||||
Experiment.RegabiWrappers = true
|
||||
Experiment.RegabiG = true
|
||||
Experiment.RegabiReflect = true
|
||||
// Not ready yet:
|
||||
//Experiment.RegabiDefer = true
|
||||
//Experiment.RegabiArgs = true
|
||||
}
|
||||
// Check regabi dependencies.
|
||||
if Experiment.RegabiG && !Experiment.RegabiWrappers {
|
||||
panic("GOEXPERIMENT regabig requires regabiwrappers")
|
||||
}
|
||||
if Experiment.RegabiArgs && !(Experiment.RegabiWrappers && Experiment.RegabiReflect && Experiment.RegabiDefer) {
|
||||
panic("GOEXPERIMENT regabiargs requires regabiwrappers,regabireflect,regabidefer")
|
||||
}
|
||||
|
||||
// Set GOEXPERIMENT to the parsed and canonicalized set of experiments.
|
||||
|
|
@ -186,9 +207,42 @@ var (
|
|||
Fieldtrack_enabled int
|
||||
Preemptibleloops_enabled int
|
||||
Staticlockranking_enabled int
|
||||
Regabi_enabled int
|
||||
)
|
||||
|
||||
// Experiment contains flags for GOEXPERIMENTs.
|
||||
//
|
||||
// TODO(austin): Move the package-level experiment flags into this.
|
||||
var Experiment ExpFlags
|
||||
|
||||
type ExpFlags struct {
|
||||
// regabi is split into several sub-experiments that can be
|
||||
// enabled individually. GOEXPERIMENT=regabi implies the
|
||||
// subset that are currently "working". Not all combinations work.
|
||||
regabi bool
|
||||
// RegabiWrappers enables ABI wrappers for calling between
|
||||
// ABI0 and ABIInternal functions. Without this, the ABIs are
|
||||
// assumed to be identical so cross-ABI calls are direct.
|
||||
RegabiWrappers bool
|
||||
// RegabiG enables dedicated G and zero registers in
|
||||
// ABIInternal.
|
||||
//
|
||||
// Requires wrappers because it makes the ABIs incompatible.
|
||||
RegabiG bool
|
||||
// RegabiReflect enables the register-passing paths in
|
||||
// reflection calls. This is also gated by intArgRegs in
|
||||
// reflect and runtime (which are disabled by default) so it
|
||||
// can be used in targeted tests.
|
||||
RegabiReflect bool
|
||||
// RegabiDefer enables desugaring defer and go calls
|
||||
// into argument-less closures.
|
||||
RegabiDefer bool
|
||||
// RegabiArgs enables register arguments/results in all
|
||||
// compiled Go functions.
|
||||
//
|
||||
// Requires wrappers, reflect, defer.
|
||||
RegabiArgs bool
|
||||
}
|
||||
|
||||
// Toolchain experiments.
|
||||
// These are controlled by the GOEXPERIMENT environment
|
||||
// variable recorded when the toolchain is built.
|
||||
|
|
@ -199,7 +253,12 @@ var exper = []struct {
|
|||
{"fieldtrack", &Fieldtrack_enabled},
|
||||
{"preemptibleloops", &Preemptibleloops_enabled},
|
||||
{"staticlockranking", &Staticlockranking_enabled},
|
||||
{"regabi", &Regabi_enabled},
|
||||
{"regabi", &Experiment.regabi},
|
||||
{"regabiwrappers", &Experiment.RegabiWrappers},
|
||||
{"regabig", &Experiment.RegabiG},
|
||||
{"regabireflect", &Experiment.RegabiReflect},
|
||||
{"regabidefer", &Experiment.RegabiDefer},
|
||||
{"regabiargs", &Experiment.RegabiArgs},
|
||||
}
|
||||
|
||||
var defaultExpstring string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue