mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: handle new panicindex/slice names in optimizations
These new calls should not prevent NOSPLIT promotion, like the old ones. These new calls should not prevent racefuncenter/exit removal. (The latter was already true, as the new calls are not yet lowered to StaticCalls at the point where racefuncenter/exit removal is done.) Add tests to make sure we don't regress (again). Fixes #31219 Change-Id: I3fb6b17cdd32c425829f1e2498defa813a5a9ace Reviewed-on: https://go-review.googlesource.com/c/go/+/170639 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
This commit is contained in:
parent
60736733ec
commit
48ef01051a
5 changed files with 52 additions and 9 deletions
|
|
@ -1129,17 +1129,20 @@ func needRaceCleanup(sym interface{}, v *Value) bool {
|
|||
for _, v := range b.Values {
|
||||
switch v.Op {
|
||||
case OpStaticCall:
|
||||
switch v.Aux.(fmt.Stringer).String() {
|
||||
case "runtime.racefuncenter", "runtime.racefuncexit", "runtime.panicindex",
|
||||
"runtime.panicslice", "runtime.panicdivide", "runtime.panicwrap",
|
||||
"runtime.panicshift":
|
||||
// Check for racefuncenter will encounter racefuncexit and vice versa.
|
||||
// Allow calls to panic*
|
||||
default:
|
||||
// If we encountered any call, we need to keep racefunc*,
|
||||
// for accurate stacktraces.
|
||||
return false
|
||||
s := v.Aux.(fmt.Stringer).String()
|
||||
switch s {
|
||||
case "runtime.racefuncenter", "runtime.racefuncexit",
|
||||
"runtime.panicdivide", "runtime.panicwrap",
|
||||
"runtime.panicshift":
|
||||
continue
|
||||
}
|
||||
// If we encountered any call, we need to keep racefunc*,
|
||||
// for accurate stacktraces.
|
||||
return false
|
||||
case OpPanicBounds, OpPanicExtend:
|
||||
// Note: these are panic generators that are ok (like the static calls above).
|
||||
case OpClosureCall, OpInterCall:
|
||||
// We must keep the race functions if there are any other call types.
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue