runtime/wasm: support blocking primitives (based on #100) - #102
Closed
cpunion wants to merge 6 commits into
Closed
Conversation
…/fork-wasm-blocking-primitives-20260801
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Aug 1, 2026
Open
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Compared only with the latest matching platform in the main series. Warning
|
This was referenced Aug 1, 2026
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.
Fork-only staging PR for xgo-dev#2152. The base branch is the validated W staging head, so this PR shows only the B increment and does not add CI load to
xgo-dev/llgo. The old upstream xgo-dev#2198 draft remains frozen.Problem
#100 can schedule multiple goroutines on one wasm worker, but channels and standard synchronization still use pthread waits. A blocking receive, Mutex, WaitGroup, Cond, or semaphore can therefore sleep the only M instead of parking only the current G; default P1 also must not depend on WASI pthread imports.
Implementation
SchedulerWaiter; it does not learn channel, semaphore, or notify-list policy.LLGO_WASI_THREADS=1compatibility.The lock-free Go maps used for wasm wait queues are valid only for the default one-M single-worker backend selected by these files. Explicit threads select the pthread implementation. Multi-worker synchronization remains a later M1/M2 stage.
Validation
All local commands used
GOMAXPROCS=2,GOMEMLIMIT=6GiB,-p=1, fresh-abuilds, andLLGO_BUILD_CACHE=offwhere applicable.effectiveTypeSizesis 100% covered andbuildSourcePatchOverlayForGOROOTis 84.6% covered.runtime/internal/clite/pthread/sync,runtime/internal/runtime, andruntime/internal/lib/runtimepass/build; all six changed pthread attribute methods are 100% covered.-target wasm), J64 (GOOS=js GOARCH=wasm), and P1 (GOOS=wasip1 GOARCH=wasm) execute the complete scheduler plus blocking fixture.wasm-tools validate --features alland runs under Wasmtime.LLGO_WASI_THREADS=1P1 builds the blocking fixture.text/data/bss = 140/0/10).50866cd89has 39 passing checks across Ubuntu/macOS, Go 1.24/1.26, wasm runtime, LTO, coverage, release artifacts, and embedded targets; only release publication is intentionally skipped.8a406388balso has 39 passing checks across the same complete matrix; only release publication is intentionally skipped.Independent diff over #100: 19 files, +892/-70. No previously runnable test is skipped or ignored.