runtime/wasm: add opt-in non-moving collector (based on #100) - #105
Draft
cpunion wants to merge 8 commits into
Draft
runtime/wasm: add opt-in non-moving collector (based on #100)#105cpunion wants to merge 8 commits into
cpunion wants to merge 8 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 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 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 (stage T). It intentionally depends on W but not B, keeping collector work independent from channel/sync changes and avoiding CI load on
xgo-dev/llgo. The old upstream xgo-dev#2203 draft remains frozen.Problem
Wasm currently selects
nogcbecause BDWGC is unavailable. J32, J64, and P1 therefore lack a runtime-owned allocator, reclamation, memory statistics, and linear-memory growth policy.Default collection is not yet semantically safe: a live Go pointer may exist only in an SSA/wasm local, and suspended-G roots are not published until stage D. This PR keeps the collector behind the temporary internal
llgo_wasm_gctag; all default wasm, native, and embedded paths remain unchanged.Implementation
runtime/internal/runtime/tinygogcpackage and add wasm-only adapters instead of duplicating the allocator in the scheduler or build packages.-sMALLOC=noneis injected only for tagged JS/wasm.LLGO_WASI_THREADS=1; this collector is single-worker.wasm-toolsand executed under Wasmtime rather than only file-checked.The collector currently scans globals and the active linear stack. It does not claim visibility into wasm locals or suspended Asyncify contexts. Stage D supplies compiler-maintained root records before any default enablement.
Validation
All local builds used
GOMAXPROCS=2,GOMEMLIMIT=6GiB,-p=1, fresh-abuilds, andLLGO_BUILD_CACHE=off. The Ubuntu container used 2 CPUs and a 6 GiB hard memory limit.configureWasmGC,hasBuildTag, andeffectiveTypeSizesare each 100% covered.wasm gc ok.wasm-tools validate --features alland Wasmtime execution.LLGO_WASI_THREADS=1fails with the intended single-worker diagnostic.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.0fa359652has the same final result: 39 passing checks, one expected release-publication skip, and no failures; the PR is clean, mergeable, and has no unresolved review threads.Default-path cost
Using identical inputs against #100:
text/data/bss = 140/0/10).Opt-in size
Using the same
wasm-runtimeinput in default and tagged modes:Independent diff over #100: 29 files, +546/-62. No previously runnable test is skipped or ignored.