]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: rename issafepoint -> hasStackMap
authorAustin Clements <austin@google.com>
Fri, 17 Apr 2020 21:14:33 +0000 (17:14 -0400)
committerAustin Clements <austin@google.com>
Wed, 29 Apr 2020 21:29:16 +0000 (21:29 +0000)
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>
src/cmd/compile/internal/gc/plive.go

index 845b2bd724f772ae8c17138bbab5bd5d1f3b800e..0a889bab861ab97954c31af945862a1bb9a14e59 100644 (file)
@@ -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
                        }