mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: simplify readonly sym checks in writebarrier pass
CL 220499 started marking readonly syms as SRODATA earlier, so we can use that in the writebarrier pass now. Passes toolstash-check. Change-Id: Ic4d49714b8bffbe03c8e9a75ca96df4475bae732 Reviewed-on: https://go-review.googlesource.com/c/go/+/230559 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
39380e8e01
commit
71e0cd815d
1 changed files with 3 additions and 12 deletions
|
|
@ -7,9 +7,9 @@ package ssa
|
|||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/src"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// A ZeroRegion records parts of an object which are known to be zero.
|
||||
|
|
@ -565,8 +565,7 @@ func IsReadOnlyGlobalAddr(v *Value) bool {
|
|||
// Nil pointers are read only. See issue 33438.
|
||||
return true
|
||||
}
|
||||
// See TODO in OpAddr case in IsSanitizerSafeAddr below.
|
||||
if v.Op == OpAddr && strings.HasPrefix(v.Aux.(*obj.LSym).Name, `""..stmp_`) {
|
||||
if v.Op == OpAddr && v.Aux.(*obj.LSym).Type == objabi.SRODATA {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
@ -614,15 +613,7 @@ func IsSanitizerSafeAddr(v *Value) bool {
|
|||
// read-only once initialized.
|
||||
return true
|
||||
case OpAddr:
|
||||
sym := v.Aux.(*obj.LSym)
|
||||
// TODO(mdempsky): Find a cleaner way to
|
||||
// detect this. It would be nice if we could
|
||||
// test sym.Type==objabi.SRODATA, but we don't
|
||||
// initialize sym.Type until after function
|
||||
// compilation.
|
||||
if strings.HasPrefix(sym.Name, `""..stmp_`) {
|
||||
return true
|
||||
}
|
||||
return v.Aux.(*obj.LSym).Type == objabi.SRODATA
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue