mirror of
https://github.com/golang/go
synced 2024-11-26 08:07:57 -07:00
cmd/internal/objabi,runtime: simplify sys.GOEXPERIMENT parsing
Previously, the runtime had to understand the full syntax of the GOEXPERIMENT environment variable. Now, sys.GOEXPERIMENT is the pre-processed experiment list produced by objabi, so we can simplify the runtime parser. Change-Id: I0d113a4347dde50a35b8b1f2b0110c88fe802921 Reviewed-on: https://go-review.googlesource.com/c/go/+/303049 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>
This commit is contained in:
parent
0c93b16d01
commit
095ba22597
@ -171,6 +171,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set GOEXPERIMENT to the parsed and canonicalized set of experiments.
|
// Set GOEXPERIMENT to the parsed and canonicalized set of experiments.
|
||||||
|
// This format must be parseable by runtime.haveexperiment.
|
||||||
GOEXPERIMENT = expList()
|
GOEXPERIMENT = expList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +185,7 @@ func init() {
|
|||||||
var FramePointerEnabled = GOARCH == "amd64" || GOARCH == "arm64"
|
var FramePointerEnabled = GOARCH == "amd64" || GOARCH == "arm64"
|
||||||
|
|
||||||
func addexp(s string) {
|
func addexp(s string) {
|
||||||
// Could do general integer parsing here, but the runtime.haveexperiment doesn't yet.
|
// We could do general integer parsing here, but there's no need yet.
|
||||||
v, vb := 1, true
|
v, vb := 1, true
|
||||||
name := s
|
name := s
|
||||||
if len(name) > 2 && name[:2] == "no" {
|
if len(name) > 2 && name[:2] == "no" {
|
||||||
|
@ -6027,6 +6027,9 @@ func setMaxThreads(in int) (out int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func haveexperiment(name string) bool {
|
func haveexperiment(name string) bool {
|
||||||
|
// GOEXPERIMENT is a comma-separated list of enabled
|
||||||
|
// experiments. It's not the raw environment variable, but a
|
||||||
|
// pre-processed list from cmd/internal/objabi.
|
||||||
x := sys.GOEXPERIMENT
|
x := sys.GOEXPERIMENT
|
||||||
for x != "" {
|
for x != "" {
|
||||||
xname := ""
|
xname := ""
|
||||||
@ -6039,9 +6042,6 @@ func haveexperiment(name string) bool {
|
|||||||
if xname == name {
|
if xname == name {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if len(xname) > 2 && xname[:2] == "no" && xname[2:] == name {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user