aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2020-04-17 17:14:33 -0400
committerAustin Clements <austin@google.com>2020-04-29 21:29:16 +0000
commita6deafaf9e6262e1a9fa390e2cc0b6df1977828c (patch)
treea8bf8c92ab9256c7528c9b1336889d5d458e43bb /src
parent2bad2f7ebaaf9c7112b98bfa48ed8213ef1e5d90 (diff)
downloadgo-a6deafaf9e6262e1a9fa390e2cc0b6df1977828c.tar.xz
cmd/compile: rename issafepoint -> hasStackMap
Currently, this function conflates two (easily conflated!) concepts: whether a Value is a safe-point and whether it has a stack map. In particular, call Values may not be a safe-point, but may need a stack map anyway in case the called function grows the stack. Hence, rename this function to "hasStackMap", since that's really what it represents. For #36365. Change-Id: I89839de0be8db3be3f0d3a7fb5fcf0b0b6ebc98a Reviewed-on: https://go-review.googlesource.com/c/go/+/230540 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/plive.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go
index 845b2bd724..0a889bab86 100644
--- a/src/cmd/compile/internal/gc/plive.go
+++ b/src/cmd/compile/internal/gc/plive.go
@@ -646,7 +646,7 @@ func (lv *Liveness) pointerMap(liveout bvec, vars []*Node, args, locals bvec) {
func (lv *Liveness) markUnsafePoints() {
if compiling_runtime || lv.f.NoSplit {
// No complex analysis necessary. Do this on the fly
- // in issafepoint.
+ // in hasStackMap.
return
}
@@ -801,9 +801,12 @@ func (lv *Liveness) markUnsafePoints() {
}
}
-// Returns true for instructions that are safe points that must be annotated
-// with liveness information.
-func (lv *Liveness) issafepoint(v *ssa.Value) bool {
+// Returns true for instructions that must have a stack map.
+//
+// This does not necessarily mean the instruction is a safe-point. In
+// particular, call Values can have a stack map in case the callee
+// grows the stack, but not themselves be a safe-point.
+func (lv *Liveness) hasStackMap(v *ssa.Value) bool {
// The runtime was written with the assumption that
// safe-points only appear at call sites (because that's how
// it used to be). We could and should improve that, but for
@@ -1049,7 +1052,7 @@ func (lv *Liveness) epilogue() {
// Walk forward through the basic block instructions and
// allocate liveness maps for those instructions that need them.
for _, v := range b.Values {
- if !lv.issafepoint(v) {
+ if !lv.hasStackMap(v) {
continue
}
@@ -1064,7 +1067,7 @@ func (lv *Liveness) epilogue() {
for i := len(b.Values) - 1; i >= 0; i-- {
v := b.Values[i]
- if lv.issafepoint(v) {
+ if lv.hasStackMap(v) {
// Found an interesting instruction, record the
// corresponding liveness information.
@@ -1113,7 +1116,7 @@ func (lv *Liveness) epilogue() {
// of the context register, so it's dead after the call.
index = int32(firstBitmapIndex)
for _, v := range b.Values {
- if lv.issafepoint(v) {
+ if lv.hasStackMap(v) {
live := lv.livevars[index]
if v.Op.IsCall() && live.regs != 0 {
lv.printDebug()
@@ -1185,7 +1188,7 @@ func (lv *Liveness) compact(b *ssa.Block) {
pos++
}
for _, v := range b.Values {
- if lv.issafepoint(v) {
+ if lv.hasStackMap(v) {
lv.livenessMap.set(v, add(lv.livevars[pos]))
pos++
}
@@ -1360,7 +1363,7 @@ func (lv *Liveness) printDebug() {
fmt.Printf("\n")
}
- if !lv.issafepoint(v) {
+ if !lv.hasStackMap(v) {
continue
}