From bf2a6d1957915530c73bbc8c863bb29da6c2714e Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 9 Aug 2023 15:49:48 -0700 Subject: [PATCH] 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 --- src/cmd/compile/internal/liveness/plive.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.50.0