Skip to content

[Based on #143] test/wasm: complete resumable ABI and debug acceptance - #144

Closed
cpunion wants to merge 5 commits into
codex/fork-wasm-resumable-workers-20260802from
codex/fork-wasm-resumable-acceptance-20260802
Closed

[Based on #143] test/wasm: complete resumable ABI and debug acceptance#144
cpunion wants to merge 5 commits into
codex/fork-wasm-resumable-workers-20260802from
codex/fork-wasm-resumable-acceptance-20260802

Conversation

@cpunion

@cpunion cpunion commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Depends on #143.

Completes the K4 acceptance layer from xgo-dev#2152 for the opt-in LLVM-coroutine wasm backend.

What changes

  • Preserve function and parameter DWARF metadata when resumable functions are lowered, and give generated calls a function-scope fallback location when no source location exists.
  • Count concrete map range values and exclude function-address intrinsics from suspended-frame GC roots.
  • Keep wasm caller-frame instrumentation enabled so runtime.Callers and pclntab lookup still work after suspension and resumption.
  • Classify synchronous runtime map, nil-check, and caller-frame helpers as non-suspending boundaries.
  • Add the wasm generic math source fallback and a no-libffi wasm compatibility layer.
  • Add an end-to-end acceptance workload for indirect variadic suspension, GC roots, reflection metadata and typed method calls, C exports, pclntab, bytes/base64/regexp, and math rounding.
  • Run the acceptance workload for J32, J64, and WASI P1, plus a bounded -O0 DWARF fixture for all three ABIs.

The independent K4 diff relative to #143 is 24 files, +581/-16, in five commits.

P1 size fix

Before the runtime-boundary classification, unicode.init acquired 24,772 resume points, including 23,480 RecordPanicLocation calls. Its lowered function reached about 4.25 MiB and Wasmtime rejected it as too large.

After keeping those synchronous helpers outside the suspension set, only real suspension points remain. The largest generated function is about 746 KiB and the P1 module falls from about 6.8 MiB to 3.2 MiB in the local acceptance build.

Compatibility boundaries

The wasm libffi shim allows reflection metadata, typed method values/expressions, and reflection map operations to link and run. Raw P1 still has no compatible libffi calling backend, so dynamic reflect.Value.Call and reflect.MakeFunc are not claimed by this PR.

J32 and J64 debug fixtures pass llvm-dwarfdump --verify. P1 is validated and executed, and its .debug_info and .debug_line sections are asserted. Full post-link P1 range verification remains limited by existing Binaryen/WASI DWARF range rewriting.

Local verification

All commands used GOMAXPROCS=2, GOMEMLIMIT=4GiB, and -p=1 where applicable.

  • go test -p=1 ./internal/wasmresume
  • go test -p=1 ./ssa
  • targeted cl caller-frame and GC-root tests
  • go test -p=1 ./internal/build
  • go test ./internal/clite/ffi
  • default non-resumable P1 -tags=nogc cross-compile/runtime regression
  • J32, J64, and P1 acceptance at -O0, -O2, and -O3
  • J32/J64 DWARF verification and P1 debug-section/runtime validation
  • Ubuntu container: ./internal/wasmresume passed; the broader native Ubuntu matrix is left to CI because the local amd64 image runs through Rosetta under a 7.75 GiB VM cap.

Changed helper coverage is 100%; internal/wasmresume is 95.2% and ssa is 93.3%.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

LLGo baseline benchmarks

ee519ab23efe | workflow run | long-term charts

Program measurements

Platform Workload File size vs main Build vs main Run vs main
Linux cprintf 18816 B +1.5% (worse) 347.917 ms -15.6% (better) 1.272 ms -18.1% (better)
Linux fmtprintf 2219448 B +0.3% (worse) 3.370 s -12.6% (better) 2.449 ms -25.5% (better)
Linux println 71776 B -1.2% (better) 343.503 ms -14.1% (better) 1.612 ms -3.7% (better)
macOS cprintf 84672 B +0.0% 330.599 ms -20.2% (better) 2.534 ms -29.4% (better)
macOS fmtprintf 2361968 B +0.7% (worse) 2.834 s -28.1% (better) 17.440 ms -25.4% (better)
macOS println 125712 B -1.0% (better) 320.541 ms -22.7% (better) 3.173 ms -56.3% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs main
Linux BenchmarkLookupPCRandom 13.220 ns/op -1.9% (better)
Linux BenchmarkMergeCompilerFlags 151.400 ns/op -2.0% (better)
Linux BenchmarkMergeLinkerFlags 95.060 ns/op -6.2% (better)
Linux BenchmarkChannelBuffered 33.660 ns/op -3.2% (better)
Linux BenchmarkChannelHandoff 27261 ns/op -14.9% (better)
Linux BenchmarkDefer 43.330 ns/op -23.1% (better)
Linux BenchmarkDirectCall 1.556 ns/op -0.4% (better)
Linux BenchmarkGlobalRead 1.870 ns/op +19.9% (worse)
Linux BenchmarkGlobalWrite 2.486 ns/op -0.3% (better)
Linux BenchmarkGoroutine 31204 ns/op -58.7% (better)
Linux BenchmarkInterfaceCall 8.092 ns/op +3.8% (worse)
Linux BenchmarkRuntimeGetG 1.871 ns/op -64.7% (better)
macOS BenchmarkLookupPCRandom 11.160 ns/op -10.3% (better)
macOS BenchmarkMergeCompilerFlags 105.700 ns/op -15.1% (better)
macOS BenchmarkMergeLinkerFlags 67.180 ns/op -3.1% (better)
macOS BenchmarkChannelBuffered 48.390 ns/op +74.5% (worse)
macOS BenchmarkChannelHandoff 6690 ns/op -4.6% (better)
macOS BenchmarkDefer 78.790 ns/op +110.5% (worse)
macOS BenchmarkDirectCall 1.933 ns/op +33.0% (worse)
macOS BenchmarkGlobalRead 1.390 ns/op +14.8% (worse)
macOS BenchmarkGlobalWrite 1.957 ns/op +31.6% (worse)
macOS BenchmarkGoroutine 32241 ns/op +1.8% (worse)
macOS BenchmarkInterfaceCall 8.330 ns/op +54.3% (worse)
macOS BenchmarkRuntimeGetG 3.654 ns/op +41.8% (worse)

Compared only with the latest matching platform in the main series.

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