Skip to content

Commit 25ec110

Browse files
randall77gopherbot
authored andcommitted
[release-branch.go1.21] cmd/compile: ensure empty blocks in write barriers are marked unpreemptible
Fixes #61958 Change-Id: I242ab77ad2f1ea1dad2d14ef756fa92f9378429f Reviewed-on: https://go-review.googlesource.com/c/go/+/518755 Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Keith Randall <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 6634ce2 commit 25ec110

File tree

1 file changed

+15
-2
lines changed
  • src/cmd/compile/internal/ssagen

1 file changed

+15
-2
lines changed

src/cmd/compile/internal/ssagen/ssa.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7083,8 +7083,21 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
70837083
// for an empty block this will be used for its control
70847084
// instruction. We won't use the actual liveness map on a
70857085
// control instruction. Just mark it something that is
7086-
// preemptible, unless this function is "all unsafe".
7087-
s.pp.NextLive = objw.LivenessIndex{StackMapIndex: -1, IsUnsafePoint: liveness.IsUnsafe(f)}
7086+
// preemptible, unless this function is "all unsafe", or
7087+
// the empty block is in a write barrier.
7088+
unsafe := liveness.IsUnsafe(f)
7089+
if b.Kind == ssa.BlockPlain {
7090+
// Empty blocks that are part of write barriers need
7091+
// to have their control instructions marked unsafe.
7092+
c := b.Succs[0].Block()
7093+
for _, v := range c.Values {
7094+
if v.Op == ssa.OpWBend {
7095+
unsafe = true
7096+
break
7097+
}
7098+
}
7099+
}
7100+
s.pp.NextLive = objw.LivenessIndex{StackMapIndex: -1, IsUnsafePoint: unsafe}
70887101

70897102
if idx, ok := argLiveBlockMap[b.ID]; ok && idx != argLiveIdx {
70907103
argLiveIdx = idx

0 commit comments

Comments
 (0)