]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: only clobber dead slots at call sites
authorCherry Zhang <cherryyz@google.com>
Wed, 29 Aug 2018 15:55:55 +0000 (11:55 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 30 Aug 2018 18:27:08 +0000 (18:27 +0000)
We now have safepoints at nearly all the instructions. When
GOEXPERIMENT=clobberdead is on, it inserts clobbers nearly at
every instruction. Currently this doesn't work. (Maybe the stack
maps at non-call safepoints are still imprecise. I haven't
investigated.) For now, only use call-based safepoints if the
experiment is on.

Updates #27326.

Change-Id: I72cda9b422d9637cc5738e681502035af7a5c02d
Reviewed-on: https://go-review.googlesource.com/131956
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/plive.go

index f78d051b060c7a664c2f2ba7f1858947299ab36d..be53384c1f68087b99d891aaa60683f8145ff5f4 100644 (file)
@@ -671,7 +671,7 @@ func (lv *Liveness) pointerMap(liveout bvec, vars []*Node, args, locals bvec) {
 
 // markUnsafePoints finds unsafe points and computes lv.unsafePoints.
 func (lv *Liveness) markUnsafePoints() {
-       if compiling_runtime || lv.f.NoSplit {
+       if compiling_runtime || lv.f.NoSplit || objabi.Clobberdead_enabled != 0 {
                // No complex analysis necessary. Do this on the fly
                // in issafepoint.
                return
@@ -830,7 +830,7 @@ func (lv *Liveness) issafepoint(v *ssa.Value) bool {
        // go:nosplit functions are similar. Since safe points used to
        // be coupled with stack checks, go:nosplit often actually
        // means "no safe points in this function".
-       if compiling_runtime || lv.f.NoSplit {
+       if compiling_runtime || lv.f.NoSplit || objabi.Clobberdead_enabled != 0 {
                return v.Op.IsCall()
        }
        switch v.Op {