From: Keith Randall Date: Wed, 9 Aug 2023 22:49:48 +0000 (-0700) Subject: cmd/compile: ensure write barrier branches get marked uninterruptible X-Git-Tag: go1.22rc1~1334 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bf2a6d1957915530c73bbc8c863bb29da6c2714e;p=gostls13.git cmd/compile: ensure write barrier branches get marked uninterruptible The branch itself can't be marked, so we ensure we mark the last ssa.Value in the block as uninterruptible, because that's where the branch ends up getting its uninterruptibility from. This is somewhat conservative, as we're marking an instruction as uninterruptible that doesn't need to be. But it is an easy fix. TODO: figure out a test Change-Id: Icd314f0bbdce8f80019bafb9e861baca4e7ecbb1 Reviewed-on: https://go-review.googlesource.com/c/go/+/518055 Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: David Chase Reviewed-by: Michael Knyszek --- diff --git a/src/cmd/compile/internal/liveness/plive.go b/src/cmd/compile/internal/liveness/plive.go index 2d05ed1a4a..e240ba6736 100644 --- a/src/cmd/compile/internal/liveness/plive.go +++ b/src/cmd/compile/internal/liveness/plive.go @@ -558,8 +558,11 @@ func (lv *liveness) markUnsafePoints() { // Mark everything after the load unsafe. found := false - for _, v := range decisionBlock.Values { - if found { + for i, v := range decisionBlock.Values { + if found || i == len(decisionBlock.Values)-1 { + // Note: we need at least one instruction marked so that + // the branch instruction at the end of the block also + // gets marked. lv.unsafePoints.Set(int32(v.ID)) } found = found || v == load