[Based on #100] runtime/wasm: add experimental Go-style resumable core - #127
Closed
cpunion wants to merge 25 commits into
Closed
[Based on #100] runtime/wasm: add experimental Go-style resumable core#127cpunion wants to merge 25 commits into
cpunion wants to merge 25 commits into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Aug 2, 2026
Open
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Compared only with the latest matching platform in the main series. Warning
|
Owner
Author
|
Superseded by #134, which rebases the resumable backend onto the complete H runtime baseline, adds the B/C/D/S/H integration, and passes the full fork CI matrix (39 required checks plus one expected release skip). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #100.
Tracks the K feasibility milestone in xgo-dev#2152.
Problem
The J32/J64/P1 single-worker backend in #100 preserves each goroutine through Asyncify. That is deployable, but every resident G carries stack/Asyncify state and every suspendable path depends on whole-module post-link rewriting.
This draft provides an opt-in compiler-owned resumable ABI so LLGo can measure and validate a non-Asyncify continuation backend against the same scheduler boundary. Without it, the proposal has no executable baseline for frame memory, dispatch cost, panic/defer behavior, or later GC/worker integration.
Design
LLGO_WASM_RESUME=1selects the experiment for J32, J64, or P1. Default wasm, native, embedded, and explicit P1 pthread builds are unchanged.ssamarks resumable Go functions and calls while retaining synchronous C/runtime boundaries.internal/wasmresumeinventories calls, plans persistent values, emits{parent, descriptor, pc}frames, and lowers direct/indirect calls to explicit state machines.Contextowns a lazy segmented frame arena plus the active/returned frame chain. Normal dispatch is an O(1) PC switch with no parent-chain search.Goexituse one scheduler catch and compiler-recorded defer-owner state; a resumable defer does not retain a nativesigjmp_buf.--translate-to-exnref); Asyncify is disabled.The runtime core covers normal return,
Gosched, park/ready, panic/defer/recover,Goexit, deadlock diagnostics, and single-worker G/M/P ownership. Blocking, timers, precise roots, safepoints, multi-worker STW, and complete toolchain acceptance intentionally remain in the next integration PR based on #125.Scope
Independent delta over #100:
+6,627/-49+3,021/-45+3,606/-4The lowering and runtime frame machinery are isolated in
internal/wasmresumeandruntime/internal/wasmresume; existing build and SSA packages only contain selection and integration hooks.Validation
All local heavy work used
GOMAXPROCS=2,GOMEMLIMIT=4GiB, and-p=1.go test ./internal/build: pass (1343.203s)go test ./ssa: pass; coverage93.3%, all K SSA helpers100%internal/wasmresume: pass, coverage94.7%runtime/internal/wasmresume: pass, coverage91.9%go test ./...: passwasm-toolsand executes under Wasmtime 39.0.1.Goexit, and G/M/P state.-O0,-O3, ThinLTO, and FullLTO with the same normal/deadlock behavior.3.346-3.369 ns/op; hot frame-arena allocate/release3.873-3.918 ns/op; both0 B/op,0 allocs/op.The full fork CI matrix passes on
49cb0c795, including both Go versions and J32/J64/P1 wasm-runtime lanes.The old upstream experimental PR xgo-dev#2236 validated this logical delta before its base became stale. This fork draft rebuilds it exactly on the refreshed #100 stack; it does not add integration changes from the production Asyncify chain.