Skip to content

cmd/compile: keep defer results live at safepoints - #87

Merged
zhouguangyuan0718 merged 1 commit into
go1.27.masterfrom
codex/defer-result-liveness
Aug 5, 2026
Merged

cmd/compile: keep defer results live at safepoints#87
zhouguangyuan0718 merged 1 commit into
go1.27.masterfrom
codex/defer-result-liveness

Conversation

@zhouguangyuan0718

Copy link
Copy Markdown

Summary

  • mark pointer-containing named result homes in functions with defer and keep them in every statepoint gc-live set
  • emit volatile result reloads in defer recovery successors so O2 retains the alloca home
  • use the existing alloca deopt pointer-map protocol and verify that no StackObject is emitted when the result is live at every call
  • qualify fixedbugs/issue27518b on Darwin/arm64

This depends on goallc/llvm-project#43 because O2 may merge the normal and recovery callbr destinations.

Validation

  • rebuilt the GoALLC toolchain with the LLVM cmd: qualify the LLVM backend on linux/amd64 #43 build
  • all 58 GoALLC statepoint plugin tests pass
  • targeted LLVM codegen and runtime tests pass under default
  • fixedbugs/issue27518b passes through the whitelist harness and ran successfully 10 consecutive times
  • GoObj inspection confirms the result slot bit is present at runtime.panicmem and no StackObjects record is emitted
  • cmd/compile/internal/ssa, cmd/compile/internal/gc, and cmd/llvmtoolexec tests pass

@zhouguangyuan0718
zhouguangyuan0718 merged commit 8d681af into go1.27.master Aug 5, 2026
@zhouguangyuan0718
zhouguangyuan0718 deleted the codex/defer-result-liveness branch August 5, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant