Skip to content

fix(cl): preserve Go storage for ordinary linkname variables - #2894

Draft
cpunion wants to merge 15 commits into
xgo-dev:mainfrom
cpunion:fix/linkname-go-storage-20261021
Draft

cpunion wants to merge 15 commits into
xgo-dev:mainfrom
cpunion:fix/linkname-go-storage-20261021

Conversation

@cpunion

@cpunion cpunion commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Follow the variable-storage rules in #2879: ordinary go:linkname renames Go storage, including declarations without initializers.

// In separate packages, both define the same zero-initialized storage:
//go:linkname A shared
var A int
//go:linkname B shared
var B int

Zero definitions coalesce, one nonzero static definition wins, duplicate static definitions fail, and each dynamic initializer still runs. Function variables keep Go closures. Explicit cgo imports remain exceptions, including default package symbols and Windows import slots.

Use weak zero definitions on Wasm and Darwin (which preserves debugger addresses), indexed linkname-target lookup, and source-positioned duplicate diagnostics. Pin the C-prefixed bindings from goplus/lib#53 across all module roots so old native variables cannot become Go storage; migrate castdump to the maintained clang-c bindings.

Validated with shared gc/LLGo tests in test/go, compiler/linker and six-target IR tests, Windows import lowering, Wasm checks, Linux process/environment probes, and the Darwin debugger suite (293/293). Built on merged #2882; native function rules follow in #2895. The broader #2878 audit remains separate.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cl/compile.go 95.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FennoAI Review — preserve Go storage and initialization for linknamed variables

The core change is sound and well-tested: InitSharedGo coalesces zero definitions under CommonLinkage, promotes a nonzero static initializer to ExternalLinkage, and correctly defers to a dynamic import only for zero storage — matching gc's "static definition beats dynamic import" semantics. The cross-target IR test matrix (cl/linkname_storage_test.go), the go/cgo integration suites, and the duplicate-definition negative test give good coverage. The C.-prefix migration of bare native linknames (runtime/..., clite/c.go) is consistent with the new varName routing where a bare symbol now defaults to goVar/define=true.

Findings below are non-blocking quality/robustness notes. No correctness defect was found in the generated-IR control flow, and the documentation/comment review found no inaccuracies.

Also considered (no action needed):

  • Security: no exploitable memory-safety or trust-boundary defect. CommonLinkage is only ever assigned to zero storage, so distinct symbols cannot silently merge; the duplicate-nonzero case panics rather than coalescing. The setup-deps change sources the repo's own vendored install.sh via $GITHUB_ACTION_PATH (no remote fetch).
  • The duplicate-definition panic (ssa/decl.go:291) is recovered and converted to an error by runPackageJob, so the normal build reports it cleanly rather than crashing — see the inline note on its message quality.

Comment thread cl/compile.go Outdated
Comment thread cl/compile.go Outdated
Comment thread ssa/decl.go
Comment thread ssa/decl.go Outdated
Comment thread ssa/decl.go Outdated
Comment thread cl/import.go
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

LLGo baseline benchmarks

a0590272fef3 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 8336 B 0 B / +0.0% 387 B 0 B / +0.0% 937.135 ms +153.1 ms / +19.5% (worse) 1.303 ms +54.85 us / +4.4% (worse)
Linux cprintf-lto 8120 B 0 B / +0.0% 368 B 0 B / +0.0% 884.887 ms +77.1 ms / +9.5% (worse) 1.266 ms +7.763 us / +0.6% (worse)
Linux fmtprintf 2499368 B -104 B / -0.004161% (better) 506877 B +16 B / +0.003157% (worse) 5.932 s +434 ms / +7.9% (worse) 4.117 ms +421.9 us / +11.4% (worse)
Linux fmtprintf-lto 1959472 B +88 B / +0.004491% (worse) 444796 B +8 B / +0.001799% (worse) 26.858 s +233.3 ms / +0.9% (worse) 3.905 ms +162.1 us / +4.3% (worse)
Linux println 229120 B +16 B / +0.006984% (worse) 17095 B 0 B / +0.0% 977.684 ms +82.53 ms / +9.2% (worse) 1.760 ms +185.7 us / +11.8% (worse)
Linux println-lto 92320 B -8 B / -0.008665% (better) 14484 B 0 B / +0.0% 1.710 s +116.8 ms / +7.3% (worse) 1.707 ms +64.87 us / +4.0% (worse)
macOS cprintf 50672 B 0 B / +0.0% 4413 B +4 B / +0.1% (worse) 1.255 s +198.6 ms / +18.8% (worse) 12.313 ms +9.294 ms / +307.8% (worse)
macOS cprintf-lto 50592 B -16 B / -0.03162% (better) 161 B 0 B / +0.0% 962.793 ms -179.7 ms / -15.7% (better) 3.511 ms -287.2 us / -7.6% (better)
macOS fmtprintf 1874480 B +214672 B / +12.9% (worse) 886364 B +2744 B / +0.3% (worse) 3.815 s -1.832 s / -32.4% (better) 33.490 ms -6.329 ms / -15.9% (better)
macOS fmtprintf-lto 1362192 B +16 B / +0.001175% (worse) 766716 B -4 B / -0.0005217% (better) 10.257 s -773.6 ms / -7.0% (better) 71.951 ms -13.07 ms / -15.4% (better)
macOS println 96512 B 0 B / +0.0% 24591 B +72 B / +0.3% (worse) 1.081 s -296 ms / -21.5% (better) 4.772 ms +173 us / +3.8% (worse)
macOS println-lto 84112 B -16 B / -0.01902% (better) 21732 B 0 B / +0.0% 1.033 s -179.4 ms / -14.8% (better) 3.057 ms -1.463 ms / -32.4% (better)
Windows MinGW cprintf 679424 B +3584 B / +0.5% (worse) 4390 B 0 B / +0.0% 1.294 s -57.84 ms / -4.3% (better) 2.769 ms +21.1 us / +0.8% (worse)
Windows MinGW cprintf-lto 44544 B 0 B / +0.0% 4342 B 0 B / +0.0% 1.298 s -137.7 ms / -9.6% (better) 2.778 ms +10.5 us / +0.4% (worse)
Windows MinGW fmtprintf 5475840 B +4608 B / +0.1% (worse) 606006 B +48 B / +0.007921% (worse) 4.252 s -223.4 ms / -5.0% (better) 8.670 ms -969.7 us / -10.1% (better)
Windows MinGW fmtprintf-lto 4158976 B 0 B / +0.0% 553094 B 0 B / +0.0% 10.637 s +132 ms / +1.3% (worse) 8.723 ms +196.5 us / +2.3% (worse)
Windows MinGW println 734208 B +1536 B / +0.2% (worse) 25286 B 0 B / +0.0% 1.289 s -80.43 ms / -5.9% (better) 4.956 ms -583.9 us / -10.5% (better)
Windows MinGW println-lto 210944 B 0 B / +0.0% 22166 B 0 B / +0.0% 1.488 s -112.4 ms / -7.0% (better) 5.104 ms -454.7 us / -8.2% (better)
Windows MinGW 386 cprintf 630272 B +3584 B / +0.6% (worse) 5352 B 0 B / +0.0% 1.676 s -532.9 us / -0.03179% (better) 5.214 ms -3 us / -0.1% (better)
Windows MinGW 386 cprintf-lto 104448 B 0 B / +0.0% 5112 B 0 B / +0.0% 1.718 s +13.14 ms / +0.8% (worse) 5.055 ms -584.6 us / -10.4% (better)
Windows MinGW 386 fmtprintf 4778496 B +5120 B / +0.1% (worse) 473902 B +16 B / +0.003376% (worse) 5.641 s +60.95 ms / +1.1% (worse) 13.026 ms +603.4 us / +4.9% (worse)
Windows MinGW 386 fmtprintf-lto 4160512 B 0 B / +0.0% 452294 B 0 B / +0.0% 12.676 s -19.96 ms / -0.2% (better) 12.906 ms -236.3 us / -1.8% (better)
Windows MinGW 386 println 682496 B +1536 B / +0.2% (worse) 21694 B 0 B / +0.0% 1.703 s +29.05 ms / +1.7% (worse) 9.146 ms +154.5 us / +1.7% (worse)
Windows MinGW 386 println-lto 260608 B 0 B / +0.0% 19514 B 0 B / +0.0% 1.976 s +34.81 ms / +1.8% (worse) 9.605 ms +1.006 ms / +11.7% (worse)
Windows MinGW ARM64 cprintf 689664 B +3584 B / +0.5% (worse) 4204 B 0 B / +0.0% 1.837 s -42.82 ms / -2.3% (better) 6.060 ms -64.4 us / -1.1% (better)
Windows MinGW ARM64 cprintf-lto 44032 B 0 B / +0.0% 4156 B 0 B / +0.0% 1.833 s -69.01 ms / -3.6% (better) 5.818 ms -368.7 us / -6.0% (better)
Windows MinGW ARM64 fmtprintf 5384192 B +5120 B / +0.1% (worse) 514160 B +112 B / +0.02179% (worse) 5.256 s -224.8 ms / -4.1% (better) 14.694 ms -1.356 ms / -8.5% (better)
Windows MinGW ARM64 fmtprintf-lto 4325376 B 0 B / +0.0% 480140 B 0 B / +0.0% 11.889 s -408.1 ms / -3.3% (better) 14.650 ms -632.6 us / -4.1% (better)
Windows MinGW ARM64 println 739840 B +1024 B / +0.1% (worse) 23928 B 0 B / +0.0% 1.767 s -111.2 ms / -5.9% (better) 10.002 ms -924.3 us / -8.5% (better)
Windows MinGW ARM64 println-lto 218112 B 0 B / +0.0% 21284 B 0 B / +0.0% 2.090 s -32.04 ms / -1.5% (better) 11.234 ms +537.8 us / +5.0% (worse)
Windows MSVC cprintf 924160 B +3584 B / +0.4% (worse) 66003 B 0 B / +0.0% 1.524 s -49.24 ms / -3.1% (better) 3.452 ms -93.8 us / -2.6% (better)
Windows MSVC cprintf-lto 292352 B 0 B / +0.0% 65971 B 0 B / +0.0% 1.563 s -33.85 ms / -2.1% (better) 2.981 ms -2.257 ms / -43.1% (better)
Windows MSVC fmtprintf 5776384 B +5120 B / +0.1% (worse) 701910 B +48 B / +0.006839% (worse) 5.073 s -329.3 ms / -6.1% (better) 12.539 ms +348.6 us / +2.9% (worse)
Windows MSVC fmtprintf-lto 4482048 B 0 B / +0.0% 652806 B 0 B / +0.0% 11.881 s -297.5 ms / -2.4% (better) 11.413 ms -836.2 us / -6.8% (better)
Windows MSVC println 1045504 B +1536 B / +0.1% (worse) 121334 B 0 B / +0.0% 1.526 s -62.32 ms / -3.9% (better) 7.224 ms -253.7 us / -3.4% (better)
Windows MSVC println-lto 531456 B 0 B / +0.0% 118870 B 0 B / +0.0% 1.808 s -46.83 ms / -2.5% (better) 7.245 ms -569 us / -7.3% (better)
Windows MSVC 386 cprintf 541696 B +3584 B / +0.7% (worse) 3947 B 0 B / +0.0% 1.197 s -118.5 ms / -9.0% (better) 5.624 ms +1.5 us / +0.02668% (worse)
Windows MSVC 386 cprintf-lto 44544 B 0 B / +0.0% 3901 B 0 B / +0.0% 1.221 s +41.2 ms / +3.5% (worse) 5.774 ms +723 us / +14.3% (worse)
Windows MSVC 386 fmtprintf 4510720 B +5120 B / +0.1% (worse) 457314 B 0 B / +0.0% 4.239 s +2.452 ms / +0.1% (worse) 13.492 ms +1.561 ms / +13.1% (worse)
Windows MSVC 386 fmtprintf-lto 3909120 B 0 B / +0.0% 427681 B 0 B / +0.0% 9.707 s -41.75 ms / -0.4% (better) 13.037 ms -119 us / -0.9% (better)
Windows MSVC 386 println 594944 B +1536 B / +0.3% (worse) 20566 B 0 B / +0.0% 1.204 s +25 ms / +2.1% (worse) 9.365 ms -131.4 us / -1.4% (better)
Windows MSVC 386 println-lto 200192 B 0 B / +0.0% 18711 B 0 B / +0.0% 1.434 s +32.86 ms / +2.3% (worse) 8.999 ms +524.7 us / +6.2% (worse)
Windows MSVC ARM64 cprintf 690176 B +3584 B / +0.5% (worse) 4240 B 0 B / +0.0% 1.684 s +36.38 ms / +2.2% (worse) 7.359 ms +334.4 us / +4.8% (worse)
Windows MSVC ARM64 cprintf-lto 49664 B +512 B / +1.0% (worse) 4140 B 0 B / +0.0% 1.699 s +39.74 ms / +2.4% (worse) 7.060 ms +532.2 us / +8.2% (worse)
Windows MSVC ARM64 fmtprintf 5380608 B +4608 B / +0.1% (worse) 514244 B +96 B / +0.01867% (worse) 5.230 s +89.84 ms / +1.7% (worse) 17.966 ms +1.557 ms / +9.5% (worse)
Windows MSVC ARM64 fmtprintf-lto 4332544 B 0 B / +0.0% 480976 B 0 B / +0.0% 11.957 s +408 ms / +3.5% (worse) 17.729 ms -3.827 ms / -17.8% (better)
Windows MSVC ARM64 println 742912 B +1536 B / +0.2% (worse) 24200 B 0 B / +0.0% 1.694 s +24.37 ms / +1.5% (worse) 12.902 ms +875 us / +7.3% (worse)
Windows MSVC ARM64 println-lto 223232 B 0 B / +0.0% 21688 B 0 B / +0.0% 1.908 s +29.86 ms / +1.6% (worse) 12.831 ms +575 us / +4.7% (worse)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.680 ns/op -0.38 ns/op / -2.5% (better)
Linux BenchmarkMergeCompilerFlags 204.200 ns/op -21.4 ns/op / -9.5% (better)
Linux BenchmarkMergeLinkerFlags 133.600 ns/op -3.7 ns/op / -2.7% (better)
Linux BenchmarkChannelBuffered 55.180 ns/op -2.97 ns/op / -5.1% (better)
Linux BenchmarkChannelHandoff 13879 ns/op -229 ns/op / -1.6% (better)
Linux BenchmarkDefer 57.090 ns/op -0.38 ns/op / -0.7% (better)
Linux BenchmarkDirectCall 1.177 ns/op +0.003 ns/op / +0.3% (worse)
Linux BenchmarkGlobalRead 1.954 ns/op +0.37 ns/op / +23.4% (worse)
Linux BenchmarkGlobalWrite 7.903 ns/op -0.024 ns/op / -0.3% (better)
Linux BenchmarkGoroutine 25374 ns/op -3968 ns/op / -13.5% (better)
Linux BenchmarkInterfaceCall 6.393 ns/op +0.321 ns/op / +5.3% (worse)
Linux BenchmarkRuntimeGetG 2.906 ns/op -0.097 ns/op / -3.2% (better)
macOS BenchmarkLookupPCRandom 14.350 ns/op -0.1 ns/op / -0.7% (better)
macOS BenchmarkMergeCompilerFlags 114.700 ns/op -29.6 ns/op / -20.5% (better)
macOS BenchmarkMergeLinkerFlags 76.930 ns/op -7.87 ns/op / -9.3% (better)
macOS BenchmarkChannelBuffered 31.320 ns/op -4.8 ns/op / -13.3% (better)
macOS BenchmarkChannelHandoff 11310 ns/op -1575 ns/op / -12.2% (better)
macOS BenchmarkDefer 39.090 ns/op -9.46 ns/op / -19.5% (better)
macOS BenchmarkDirectCall 1.168 ns/op -0.013 ns/op / -1.1% (better)
macOS BenchmarkGlobalRead 1.234 ns/op +0.057 ns/op / +4.8% (worse)
macOS BenchmarkGlobalWrite 1.323 ns/op +0.141 ns/op / +11.9% (worse)
macOS BenchmarkGoroutine 70550 ns/op +34673 ns/op / +96.6% (worse)
macOS BenchmarkInterfaceCall 4.694 ns/op -0.297 ns/op / -6.0% (better)
macOS BenchmarkRuntimeGetG 2.491 ns/op -0.473 ns/op / -16.0% (better)
Windows MinGW BenchmarkLookupPCRandom 9.595 ns/op +0.01 ns/op / +0.1% (worse)
Windows MinGW BenchmarkMergeCompilerFlags 371.600 ns/op -44.4 ns/op / -10.7% (better)
Windows MinGW BenchmarkMergeLinkerFlags 333.400 ns/op -16.2 ns/op / -4.6% (better)
Windows MinGW BenchmarkChannelBuffered 23.820 ns/op -0.1 ns/op / -0.4% (better)
Windows MinGW BenchmarkChannelHandoff 1190 ns/op +18 ns/op / +1.5% (worse)
Windows MinGW BenchmarkDefer 43.630 ns/op +0.77 ns/op / +1.8% (worse)
Windows MinGW BenchmarkDirectCall 1.357 ns/op 0 ns/op / +0.0%
Windows MinGW BenchmarkGlobalRead 1.358 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalWrite 2.164 ns/op 0 ns/op / +0.0%
Windows MinGW BenchmarkGoroutine 58564 ns/op -225 ns/op / -0.4% (better)
Windows MinGW BenchmarkInterfaceCall 7.069 ns/op +0.274 ns/op / +4.0% (worse)
Windows MinGW BenchmarkRuntimeGetG 1.901 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkLookupPCRandom 26.670 ns/op +0.06 ns/op / +0.2% (worse)
Windows MinGW 386 BenchmarkMergeCompilerFlags 773.100 ns/op +26.7 ns/op / +3.6% (worse)
Windows MinGW 386 BenchmarkMergeLinkerFlags 672.500 ns/op -23.4 ns/op / -3.4% (better)
Windows MinGW 386 BenchmarkChannelBuffered 39.310 ns/op -0.01 ns/op / -0.02543% (better)
Windows MinGW 386 BenchmarkChannelHandoff 872.500 ns/op +68 ns/op / +8.5% (worse)
Windows MinGW 386 BenchmarkDefer 42.270 ns/op -1.73 ns/op / -3.9% (better)
Windows MinGW 386 BenchmarkDirectCall 1.551 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkGlobalRead 1.861 ns/op +0.308 ns/op / +19.8% (worse)
Windows MinGW 386 BenchmarkGlobalWrite 7.795 ns/op +0.004 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkGoroutine 111942 ns/op -10823 ns/op / -8.8% (better)
Windows MinGW 386 BenchmarkInterfaceCall 8.402 ns/op +0.292 ns/op / +3.6% (worse)
Windows MinGW 386 BenchmarkRuntimeGetG 2.173 ns/op -0.307 ns/op / -12.4% (better)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.090 ns/op -0.06 ns/op / -0.5% (better)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 585 ns/op +0.7 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 534.700 ns/op -12.9 ns/op / -2.4% (better)
Windows MinGW ARM64 BenchmarkChannelBuffered 38.350 ns/op +1.34 ns/op / +3.6% (worse)
Windows MinGW ARM64 BenchmarkChannelHandoff 5148 ns/op +1095 ns/op / +27.0% (worse)
Windows MinGW ARM64 BenchmarkDefer 53.640 ns/op +2.94 ns/op / +5.8% (worse)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op -0.0113 ns/op / -1.9% (better)
Windows MinGW ARM64 BenchmarkGlobalRead 0.737 ns/op -0.0009 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.590 ns/op -0.0242 ns/op / -3.9% (better)
Windows MinGW ARM64 BenchmarkGoroutine 64557 ns/op +5787 ns/op / +9.8% (worse)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.236 ns/op +0.089 ns/op / +2.1% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.799 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC BenchmarkLookupPCRandom 13.090 ns/op -0.05 ns/op / -0.4% (better)
Windows MSVC BenchmarkMergeCompilerFlags 604.100 ns/op -44.7 ns/op / -6.9% (better)
Windows MSVC BenchmarkMergeLinkerFlags 549.300 ns/op -24.8 ns/op / -4.3% (better)
Windows MSVC BenchmarkChannelBuffered 29.460 ns/op +0.24 ns/op / +0.8% (worse)
Windows MSVC BenchmarkChannelHandoff 1180 ns/op -12 ns/op / -1.0% (better)
Windows MSVC BenchmarkDefer 56.700 ns/op +1.43 ns/op / +2.6% (worse)
Windows MSVC BenchmarkDirectCall 1.549 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGlobalRead 1.546 ns/op -0.005 ns/op / -0.3% (better)
Windows MSVC BenchmarkGlobalWrite 2.472 ns/op 0 ns/op / +0.0%
Windows MSVC BenchmarkGoroutine 92960 ns/op +4750 ns/op / +5.4% (worse)
Windows MSVC BenchmarkInterfaceCall 8.066 ns/op -0.931 ns/op / -10.3% (better)
Windows MSVC BenchmarkRuntimeGetG 2.481 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkLookupPCRandom 60.230 ns/op +0.15 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkMergeCompilerFlags 647.100 ns/op -30.8 ns/op / -4.5% (better)
Windows MSVC 386 BenchmarkMergeLinkerFlags 596.700 ns/op -16.9 ns/op / -2.8% (better)
Windows MSVC 386 BenchmarkChannelBuffered 46.910 ns/op +0.24 ns/op / +0.5% (worse)
Windows MSVC 386 BenchmarkChannelHandoff 1385 ns/op +2 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkDefer 36.980 ns/op +0.17 ns/op / +0.5% (worse)
Windows MSVC 386 BenchmarkDirectCall 0.866 ns/op -0.0515 ns/op / -5.6% (better)
Windows MSVC 386 BenchmarkGlobalRead 0.892 ns/op +0.0072 ns/op / +0.8% (worse)
Windows MSVC 386 BenchmarkGlobalWrite 14.830 ns/op +0.02 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGoroutine 83151 ns/op -2919 ns/op / -3.4% (better)
Windows MSVC 386 BenchmarkInterfaceCall 6.209 ns/op +0.175 ns/op / +2.9% (worse)
Windows MSVC 386 BenchmarkRuntimeGetG 1.663 ns/op +0.029 ns/op / +1.8% (worse)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.020 ns/op -0.14 ns/op / -1.2% (better)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 562.100 ns/op -5.7 ns/op / -1.0% (better)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 534.500 ns/op -1 ns/op / -0.2% (better)
Windows MSVC ARM64 BenchmarkChannelBuffered 39.230 ns/op +1.01 ns/op / +2.6% (worse)
Windows MSVC ARM64 BenchmarkChannelHandoff 2119 ns/op -90 ns/op / -4.1% (better)
Windows MSVC ARM64 BenchmarkDefer 65.350 ns/op +0.82 ns/op / +1.3% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.589 ns/op -0.0737 ns/op / -11.1% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.590 ns/op -0.0001 ns/op / -0.01695% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.795 ns/op +0.001 ns/op / +0.02636% (worse)
Windows MSVC ARM64 BenchmarkGoroutine 60184 ns/op +823 ns/op / +1.4% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.138 ns/op -0.001 ns/op / -0.02416% (better)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.805 ns/op +0.003 ns/op / +0.2% (worse)
Timer runtime benchmarks
Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 911.300 ns/op -10.6 ns/op / -1.1% (better)
Linux AfterFuncZeroDelivery/LLGo 50972 ns/op +9054 ns/op / +21.6% (worse)
Linux CreateStop/Go 300.200 ns/op -11 ns/op / -3.5% (better)
Linux CreateStop/LLGo 1752 ns/op +91 ns/op / +5.5% (worse)
Linux RearmStopped/Go 115.600 ns/op -0.7 ns/op / -0.6% (better)
Linux RearmStopped/LLGo 1278 ns/op +61 ns/op / +5.0% (worse)
Linux ResetActive/Go 68.640 ns/op -0.41 ns/op / -0.6% (better)
Linux ResetActive/LLGo 648.300 ns/op -114.7 ns/op / -15.0% (better)
Linux ResetHeap1024/Go 67.360 ns/op -0.33 ns/op / -0.5% (better)
Linux ResetHeap1024/LLGo 160.100 ns/op +0.7 ns/op / +0.4% (worse)
macOS AfterFuncZeroDelivery/Go 501.900 ns/op -114.5 ns/op / -18.6% (better)
macOS AfterFuncZeroDelivery/LLGo 42937 ns/op -4194 ns/op / -8.9% (better)
macOS CreateStop/Go 156.100 ns/op -5.4 ns/op / -3.3% (better)
macOS CreateStop/LLGo 406 ns/op -167.3 ns/op / -29.2% (better)
macOS RearmStopped/Go 65.160 ns/op -24.78 ns/op / -27.6% (better)
macOS RearmStopped/LLGo 315.500 ns/op -107.7 ns/op / -25.4% (better)
macOS ResetActive/Go 45.370 ns/op -12.84 ns/op / -22.1% (better)
macOS ResetActive/LLGo 213.200 ns/op +64.6 ns/op / +43.5% (worse)
macOS ResetHeap1024/Go 47.570 ns/op -16.69 ns/op / -26.0% (better)
macOS ResetHeap1024/LLGo 80.790 ns/op -26.21 ns/op / -24.5% (better)
Windows MinGW AfterFuncZeroDelivery/Go 383.300 ns/op +11.8 ns/op / +3.2% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 110242 ns/op +499 ns/op / +0.5% (worse)
Windows MinGW CreateStop/Go 89.830 ns/op -2.03 ns/op / -2.2% (better)
Windows MinGW CreateStop/LLGo 356 ns/op +9.3 ns/op / +2.7% (worse)
Windows MinGW RearmStopped/Go 24.490 ns/op +0.01 ns/op / +0.04085% (worse)
Windows MinGW RearmStopped/LLGo 192.100 ns/op -14.3 ns/op / -6.9% (better)
Windows MinGW ResetActive/Go 14.790 ns/op 0 ns/op / +0.0%
Windows MinGW ResetActive/LLGo 120.600 ns/op +2.4 ns/op / +2.0% (worse)
Windows MinGW ResetHeap1024/Go 14.940 ns/op +0.1 ns/op / +0.7% (worse)
Windows MinGW ResetHeap1024/LLGo 105.100 ns/op +1.9 ns/op / +1.8% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/Go 959.500 ns/op +9.5 ns/op / +1.0% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 206214 ns/op -405 ns/op / -0.2% (better)
Windows MinGW 386 CreateStop/Go 191.400 ns/op +1.4 ns/op / +0.7% (worse)
Windows MinGW 386 CreateStop/LLGo 493.200 ns/op +25.2 ns/op / +5.4% (worse)
Windows MinGW 386 RearmStopped/Go 63.630 ns/op +0.21 ns/op / +0.3% (worse)
Windows MinGW 386 RearmStopped/LLGo 327.500 ns/op +10.9 ns/op / +3.4% (worse)
Windows MinGW 386 ResetActive/Go 39.130 ns/op +0.11 ns/op / +0.3% (worse)
Windows MinGW 386 ResetActive/LLGo 1010 ns/op +29.3 ns/op / +3.0% (worse)
Windows MinGW 386 ResetHeap1024/Go 39.510 ns/op -0.36 ns/op / -0.9% (better)
Windows MinGW 386 ResetHeap1024/LLGo 176.300 ns/op +1.7 ns/op / +1.0% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 661.300 ns/op -11.4 ns/op / -1.7% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 144654 ns/op +674 ns/op / +0.5% (worse)
Windows MinGW ARM64 CreateStop/Go 199.300 ns/op -0.6 ns/op / -0.3% (better)
Windows MinGW ARM64 CreateStop/LLGo 326.500 ns/op +15.5 ns/op / +5.0% (worse)
Windows MinGW ARM64 RearmStopped/Go 70.590 ns/op +0.02 ns/op / +0.02834% (worse)
Windows MinGW ARM64 RearmStopped/LLGo 208.900 ns/op +2.2 ns/op / +1.1% (worse)
Windows MinGW ARM64 ResetActive/Go 30.980 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW ARM64 ResetActive/LLGo 99.660 ns/op -1.04 ns/op / -1.0% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.110 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 ResetHeap1024/LLGo 111.700 ns/op +0.5 ns/op / +0.4% (worse)
Windows MSVC AfterFuncZeroDelivery/Go 554.500 ns/op +8.8 ns/op / +1.6% (worse)
Windows MSVC AfterFuncZeroDelivery/LLGo 177307 ns/op -1471 ns/op / -0.8% (better)
Windows MSVC CreateStop/Go 117.900 ns/op +1.5 ns/op / +1.3% (worse)
Windows MSVC CreateStop/LLGo 386 ns/op -6 ns/op / -1.5% (better)
Windows MSVC RearmStopped/Go 31.520 ns/op +0.07 ns/op / +0.2% (worse)
Windows MSVC RearmStopped/LLGo 273.400 ns/op +28.6 ns/op / +11.7% (worse)
Windows MSVC ResetActive/Go 20.100 ns/op -0.17 ns/op / -0.8% (better)
Windows MSVC ResetActive/LLGo 158 ns/op -2.3 ns/op / -1.4% (better)
Windows MSVC ResetHeap1024/Go 20.400 ns/op -0.2 ns/op / -1.0% (better)
Windows MSVC ResetHeap1024/LLGo 117.700 ns/op -0.8 ns/op / -0.7% (better)
Windows MSVC 386 AfterFuncZeroDelivery/Go 870.100 ns/op -93.1 ns/op / -9.7% (better)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 180343 ns/op +728 ns/op / +0.4% (worse)
Windows MSVC 386 CreateStop/Go 223.600 ns/op +5.3 ns/op / +2.4% (worse)
Windows MSVC 386 CreateStop/LLGo 1058 ns/op +55 ns/op / +5.5% (worse)
Windows MSVC 386 RearmStopped/Go 81.380 ns/op +0.96 ns/op / +1.2% (worse)
Windows MSVC 386 RearmStopped/LLGo 280 ns/op -10.9 ns/op / -3.7% (better)
Windows MSVC 386 ResetActive/Go 38.730 ns/op -0.04 ns/op / -0.1% (better)
Windows MSVC 386 ResetActive/LLGo 251.900 ns/op +3.6 ns/op / +1.4% (worse)
Windows MSVC 386 ResetHeap1024/Go 39.270 ns/op -2.93 ns/op / -6.9% (better)
Windows MSVC 386 ResetHeap1024/LLGo 129.500 ns/op -0.1 ns/op / -0.1% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 660 ns/op -2 ns/op / -0.3% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 149846 ns/op +1898 ns/op / +1.3% (worse)
Windows MSVC ARM64 CreateStop/Go 209.500 ns/op +6.1 ns/op / +3.0% (worse)
Windows MSVC ARM64 CreateStop/LLGo 405.600 ns/op -0.8 ns/op / -0.2% (better)
Windows MSVC ARM64 RearmStopped/Go 70.570 ns/op +0.23 ns/op / +0.3% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 229.300 ns/op -8.7 ns/op / -3.7% (better)
Windows MSVC ARM64 ResetActive/Go 31.160 ns/op +0.16 ns/op / +0.5% (worse)
Windows MSVC ARM64 ResetActive/LLGo 121.200 ns/op -1.2 ns/op / -1.0% (better)
Windows MSVC ARM64 ResetHeap1024/Go 31.250 ns/op +0.28 ns/op / +0.9% (worse)
Windows MSVC ARM64 ResetHeap1024/LLGo 115.600 ns/op -1.4 ns/op / -1.2% (better)

Compared with 477f959633c2 measured in the same runner job.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

a0590272fef3 | workflow run | long-term charts

WebAssembly output sizes
Example, profile and compiler Wasm module vs base Generated JS glue vs base
cprintf/j32-emscripten/LLGo 147058 B 0 B / +0.0% 88541 B 0 B / +0.0%
cprintf/j32-goos-js/LLGo 145666 B 0 B / +0.0% 72985 B 0 B / +0.0%
cprintf/j64-emscripten-memory64/LLGo 134527 B 0 B / +0.0% 91712 B 0 B / +0.0%
cprintf/w32-goos-wasip1/LLGo 156385 B 0 B / +0.0% 0 B 0 B / 0.0%
cprintf/w32-wasi/LLGo 157083 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-emscripten/LLGo 2984026 B 0 B / +0.0% 120989 B 0 B / +0.0%
fmtprintf/j32-goos-js/Go 2526852 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-goos-js/LLGo 3074787 B 0 B / +0.0% 92052 B 0 B / +0.0%
fmtprintf/j64-emscripten-memory64/LLGo 2748865 B 0 B / +0.0% 125530 B 0 B / +0.0%
fmtprintf/w32-goos-wasip1/Go 2500019 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-goos-wasip1/LLGo 2343597 B +14 B / +0.0005974% (worse) 0 B 0 B / 0.0%
fmtprintf/w32-wasi/LLGo 2340296 B +17 B / +0.0007264% (worse) 0 B 0 B / 0.0%
j32-emscripten/LLGo 146575 B 0 B / +0.0% 88541 B 0 B / +0.0%
j32-goos-js/Go 1895533 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-goos-js/LLGo 145416 B 0 B / +0.0% 72985 B 0 B / +0.0%
j64-emscripten-memory64/LLGo 134082 B 0 B / +0.0% 91712 B 0 B / +0.0%
reflectcall/j32-emscripten/LLGo 1510137 B 0 B / +0.0% 95329 B 0 B / +0.0%
reflectcall/j32-goos-js/Go 2191221 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/j32-goos-js/LLGo 1562300 B 0 B / +0.0% 79769 B 0 B / +0.0%
reflectcall/j64-emscripten-memory64/LLGo 1391239 B 0 B / +0.0% 99026 B 0 B / +0.0%
reflectcall/w32-goos-wasip1/Go 2205707 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-goos-wasip1/LLGo 1273774 B +4 B / +0.000314% (worse) 0 B 0 B / 0.0%
reflectcall/w32-wasi/LLGo 1271415 B +4 B / +0.0003146% (worse) 0 B 0 B / 0.0%
w32-goos-wasip1/Go 1909947 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-goos-wasip1/LLGo 156059 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-wasi/LLGo 156757 B 0 B / +0.0% 0 B 0 B / 0.0%
LLGo WebAssembly build measurements
Example and profile Build vs base
j32-emscripten 8.246 s -153.7 ms / -1.8% (better)
j32-goos-js 7.687 s +69.59 ms / +0.9% (worse)
j64-emscripten-memory64 7.372 s -1.664 s / -18.4% (better)
reflectcall/w32-wasi 24.356 s -1.456 s / -5.6% (better)
w32-goos-wasip1 5.021 s -188.2 ms / -3.6% (better)
w32-wasi 4.530 s -494.8 ms / -9.8% (better)

Compared with 2905593ea979 measured in the same runner job.

Reuse the callback-store fix from c87f706 in PR xgo-dev#2895 without the unrelated linkname changes. Clearing or restoring a C callback must not write a two-word Go funcval over adjacent native storage.

Add deterministic adjacent-slot and closure-rejection regressions, plus pointer-width IR checks on Linux, Darwin and all six Windows ABI targets.
@cpunion

cpunion commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Fixed the macOS CI crash in a059027 by reusing #2895's native callback store fix. Clearing/restoring a C callback now writes one native pointer and preserves adjacent native slots; capturing Go closures are still rejected. The new adjacent-slot/closure regressions pass on macOS ARM64, and the IR checks pass for Linux, Darwin, and all six Windows ABI targets. Validation is complete for a059027: 116 checks succeeded; the tag-only release job was skipped. The completed LLGo rerun passes, including all six native Windows ABI/architecture lanes.

@cpunion
cpunion marked this pull request as draft October 22, 2026 08:55
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