]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't clobber dead slots in runtime.wbBufFlush
authorCherry Zhang <cherryyz@google.com>
Wed, 29 Aug 2018 16:09:34 +0000 (12:09 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 30 Aug 2018 18:27:20 +0000 (18:27 +0000)
runtime.wbBufFlush must not modify its arguments, because the
argument slots are also used as spill slots in runtime.gcWriteBarrier.
So, GOEXPERIMENT=clobberdead must not clobber them.

Updates #27326.

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

index be53384c1f68087b99d891aaa60683f8145ff5f4..e070a5cd1af086396473d953c3436f7bba192728 100644 (file)
@@ -1203,13 +1203,16 @@ func (lv *Liveness) clobber() {
                }
                fmt.Printf("\t\t\tCLOBBERDEAD %s\n", lv.fn.funcname())
        }
-       if lv.f.Name == "forkAndExecInChild" {
+       if lv.f.Name == "forkAndExecInChild" || lv.f.Name == "wbBufFlush" {
                // forkAndExecInChild calls vfork (on linux/amd64, anyway).
                // The code we add here clobbers parts of the stack in the child.
                // When the parent resumes, it is using the same stack frame. But the
                // child has clobbered stack variables that the parent needs. Boom!
                // In particular, the sys argument gets clobbered.
                // Note to self: GOCLOBBERDEADHASH=011100101110
+               //
+               // runtime.wbBufFlush must not modify its arguments. See the comments
+               // in runtime/mwbbuf.go:wbBufFlush.
                return
        }