if env != "" {
// Create a map of known experiment names.
- names := make(map[string]reflect.Value)
+ names := make(map[string]func(bool))
rv := reflect.ValueOf(&flags).Elem()
rt := rv.Type()
for i := 0; i < rt.NumField(); i++ {
field := rv.Field(i)
- names[strings.ToLower(rt.Field(i).Name)] = field
+ names[strings.ToLower(rt.Field(i).Name)] = field.SetBool
+ }
+
+ // "regabi" is an alias for all working regabi
+ // subexperiments, and not an experiment itself. Doing
+ // this as an alias make both "regabi" and "noregabi"
+ // do the right thing.
+ names["regabi"] = func(v bool) {
+ flags.RegabiWrappers = v
+ flags.RegabiG = v
+ flags.RegabiReflect = v
+ flags.RegabiDefer = v
+ // Not ready yet:
+ //flags.RegabiArgs = v
}
// Parse names.
if strings.HasPrefix(f, "no") {
f, val = f[2:], false
}
- field, ok := names[f]
+ set, ok := names[f]
if !ok {
fmt.Printf("unknown experiment %s\n", f)
os.Exit(2)
}
- field.SetBool(val)
+ set(val)
}
}
// regabi is only supported on amd64.
if GOARCH != "amd64" {
- flags.Regabi = false
flags.RegabiWrappers = false
flags.RegabiG = false
flags.RegabiReflect = false
flags.RegabiDefer = false
flags.RegabiArgs = false
}
- // Setting regabi sets working sub-experiments.
- if flags.Regabi {
- flags.RegabiWrappers = true
- flags.RegabiG = true
- flags.RegabiReflect = true
- flags.RegabiDefer = true
- // Not ready yet:
- //flags.RegabiArgs = true
- }
// Check regabi dependencies.
if flags.RegabiG && !flags.RegabiWrappers {
panic("GOEXPERIMENT regabig requires regabiwrappers")
StaticLockRanking bool
// 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
+ // enabled individually. Not all combinations work.
+ // The "regabi" GOEXPERIMENT is an alias for all "working"
+ // subexperiments.
+
// 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.