Skip to content

cmd/compile: emit LLVM source locations for Go PCLN - #117

Merged
zhouguangyuan0718 merged 8 commits into
go1.27.masterfrom
codex/pcln-debug-info
Aug 12, 2026
Merged

cmd/compile: emit LLVM source locations for Go PCLN#117
zhouguangyuan0718 merged 8 commits into
go1.27.masterfrom
codex/pcln-debug-info

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • emit a line-tables-only Go compile unit with DIFile, DISubprogram, DILocation, and complete frontend inlined-at chains
  • keep an exact subprogram-to-Go-symbol map for pcinline callees without adding source types or variables
  • preserve abstract content-addressable inline callees as weak unreachable Go functions so GoObj still receives FuncInfo carriers
  • preserve imported linkname inline callees as GoObj non-package references instead of reclassifying their export indices as ordinary package symbols
  • set and restore debug locations around SSA value and block lowering so generated instructions do not inherit stale positions
  • preserve the source-call DILocation when expanding explicit LLVM nil checks into compare, branch, and panicmem control flow
  • use a Go-specific late MachineFunction plugin pass to canonicalize shared inline call sites and insert real post-layout anchors before branch relaxation
  • verify object-level inline tables and an O2 panic traceback containing capture, inner, middle, outer, and main in order
  • promote seven formerly PCLN-blocked testdir cases from graylist to required whitelist: devirtualization_nil_panics.go, fixedbugs/issue73916.go, issue73916b.go, issue73917.go, issue73920.go, inline_caller.go, and inline_callers.go

Scope

This PR only feeds pcfile, pcline, and pcinline generation. It intentionally does not generate Go target-object DWARF carriers, type DIEs, variables, dbg.declare records, or variable locations. Target-object DWARF is a separate follow-up.

Generic LLVM DWARF emission is not changed. GoObj-specific collection and inline anchoring stay in the Go handlers and plugin.

LLVM payload

Validation

  • rebased onto go1.27.master at fa951ec and rebuilt the Go toolchain against the pinned payload with ccache
  • post-rebase range-diff preserved all seven original topic commits exactly
  • GoALLC plugin CTest: 60/60 passed
  • cmd/compile/internal/ssa passed, including the newly merged AMD64 map SIMD lowering tests
  • focused GoObj PCLN inline traceback, imported-linkname classification, and explicit nil-check runtime/object checks passed
  • all seven promoted required tests passed locally through llvmtoolexec, the pinned opt/llc payload, default, GoObj link, and execution
  • encoding/gob, encoding/json, and encoding/xml passed locally as LLVM entry packages after fixing imported linkname pcinline callees; the focused object test verifies reflect.(*rtype).Elem and reflect.(*rtype).Kind are non-package references
  • GitHub Actions run 31553776820 passed on linux-amd64 and linux-arm64, including the 60-package, three-run LLVM standard-library gate and the complete required/advisory LLVM policy

zhouguangyuan0718 added a commit that referenced this pull request Aug 10, 2026
Pin GoALLC CI to the published LLVM 23.1.0 v8 payload at revision
445acfc09213ef8f70906a10f32ba96c1d0813c7.

Promote the runtime tests whose backend and GC visibility fixes are
included in
the payload/current main:

- abi/method_wrapper.go (LLVM #59)
- fixedbugs/issue78081.go (LLVM #60)
- stackobj2.go (Go #115)

All three pass the local Darwin/arm64 LLVM `default<O2>` -> GoObj ->
link ->
runtime path. PR CI qualifies the released Linux amd64/arm64 artifacts.

The v8 ARM64 layout places the morestack call before the indirect body
call.
Update the structured AArch64 frame check to derive exact PCDATA ranges
from
call offsets while retaining the strict map association checks:
morestack uses
map 0 and the indirect call uses map 1.

`devirtualization_nil_panics.go` was also evaluated for promotion. Its
nil panic
and recover behavior works, but it fails the required source-line
assertion
(`llvm-ir:1`, want line 28). Keep it explicitly gray until the pending
Go #117
and LLVM #62 PCLN changes are merged and released; the test itself is
not
weakened.

Validation:

- v8 release contains Linux amd64/arm64 archives and SHA256 assets
- JSON/Python parsing and `git diff --check`
- `TestLLVMTestPolicy` PASS
- focused LLVM O2 runtime tests for method_wrapper, issue78081,
stackobj2 PASS
- full standalone plugin CTest with objview: 64/64 PASS
- `devirtualization_nil_panics.go` reproduces only the known pcline gap
@zhouguangyuan0718
zhouguangyuan0718 merged commit f4402e8 into go1.27.master Aug 12, 2026
2 checks passed
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