1
0
mirror of https://github.com/golang/go synced 2024-09-30 18:28:32 -06:00

go/ssa/interp: don't let target calls to runtime.GOMAXPROCS set host state

...otherwise the interpreted program can make the whole test suite
slow.  Just ignore the argument and return the current GOMAXPROCS
value.

Change-Id: Ife2ad6c53e6fdf9feea1d1b231d8d796b3db3a24
Also: add missing intrinsic for os.runtime_beforeExit.
Reviewed-on: https://go-review.googlesource.com/8591
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Alan Donovan 2015-04-07 18:18:44 -04:00
parent 4a08fb6fc3
commit 8a634c5831

View File

@ -79,6 +79,7 @@ func init() {
"math.Log": ext۰math۰Log,
"math.Min": ext۰math۰Min,
"os.runtime_args": ext۰os۰runtime_args,
"os.runtime_beforeExit": ext۰os۰runtime_beforeExit,
"reflect.New": ext۰reflect۰New,
"reflect.SliceOf": ext۰reflect۰SliceOf,
"reflect.TypeOf": ext۰reflect۰TypeOf,
@ -228,6 +229,10 @@ func ext۰os۰runtime_args(fr *frame, args []value) value {
return fr.i.osArgs
}
func ext۰os۰runtime_beforeExit(fr *frame, args []value) value {
return nil
}
func ext۰runtime۰Breakpoint(fr *frame, args []value) value {
runtime.Breakpoint()
return nil
@ -328,7 +333,9 @@ func ext۰sync۰runtime_Semrelease(fr *frame, args []value) value {
}
func ext۰runtime۰GOMAXPROCS(fr *frame, args []value) value {
return runtime.GOMAXPROCS(args[0].(int))
// Ignore args[0]; don't let the interpreted program
// set the interpreter's GOMAXPROCS!
return runtime.GOMAXPROCS(0)
}
func ext۰runtime۰Goexit(fr *frame, args []value) value {