Compact MoonBit async task state storage#1665
Merged
alexcrichton merged 1 commit intoJul 24, 2026
Merged
Conversation
peter-jerry-ye
marked this pull request as ready for review
July 24, 2026 12:10
alexcrichton
approved these changes
Jul 24, 2026
Merged
via the queue into
bytecodealliance:main
with commit Jul 24, 2026
ce2815c
28 of 29 checks passed
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.
Why
The generated MoonBit WASI P3 async core stored one component task's state across several maps keyed by the same waitable-set handle. Scheduling and wakeup paths therefore repeated the same lookups, while ownership and terminal cleanup were spread across multiple sources of truth.
This cannot be replaced with one global scheduler queue: P3 may have multiple host-driven component tasks alive at the same time, and each task needs an isolated queue and wakeup path.
What changed
ComponentTaskStateregistry entry.TaskLanecontaining its scheduler queue and wakeup state, and let coroutines retain that lane directly.Why this is correct and minimal
The component-task registry is now the single source of truth for task lifecycle state, while
TaskLanepreserves the per-task isolation required by P3. Coroutines retain only the smaller scheduling lane rather than the full registry entry, and terminal cleanup explicitly disconnects the remaining scheduler ownership once no queued, blocking, or owned coroutine work remains.The production changes are confined to MoonBit async-core generation. There are no WIT surface changes, stream-buffering changes, new dependencies, or assumptions of tracing GC.
Upstream note
End-to-end WASI HTTP stress testing also encountered pre-existing Wasmtime serve/lifecycle behavior tracked by wasmtime#13345. Those results are unrelated to this change and were not attributed to it.