WASI 0.3 prep: 0.2 component build, scheduler timer queue, async design notes#497
Closed
stevedekorte wants to merge 4 commits into
Closed
WASI 0.3 prep: 0.2 component build, scheduler timer queue, async design notes#497stevedekorte wants to merge 4 commits into
stevedekorte wants to merge 4 commits into
Conversation
make component builds build/bin/io_component.wasm via wasi-sdk's wasm32-wasip2 target and wasm-component-ld; make check-component runs the Io correctness suite against it under wasmtime. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Object wait now parks the calling coroutine on a Scheduler timer queue with a deadline. Expired timers re-enter the run queue on yield/pause; when nothing is runnable but timers are pending, the VM blocks in a single host wait until the nearest deadline (Scheduler idleUntilNextTimer). That idle point is where a WASI 0.3 future<T> will be awaited once host/toolchain support lands. Timed coroutines now run concurrently (two overlapping 1s waits: ~1.1s wall, ~4% CPU, previously a 100% CPU busy-spin or fully serialized sleeps). wait uses condition-variable semantics — a finished child coroutine resumes its parent directly, so pause can return early; wait re-parks for the remaining time and removes stale timer entries. Two eval-loop fixes this exposed: - Dead-ancestor walk: when a coroutine finishes after the coroutine that started it already finished, the parent-resume walk hit the dead link and took the nestedEvalDepth early-return, stranding all parked coroutines. The walk now skips ancestors with no saved frames. - Stale run-queue entries: a coroutine woken by the child-death walk while still queued in yieldingCoros leaves a stale entry; resuming it after it finished restarted its body (frameless coros look never-started). IoCoroutineData gains a hasFinished flag set by the eval loop on body completion (cleared at every deliberate restart site), exposed as Coroutine isFinished; pause/yield drop finished entries instead of resuming them. Adds SchedulerTimerTest covering concurrent waits, timer wakeups during yields, actor waits, and a regression test for the dead-ancestor walk (verified to fail with the walk disabled). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds a WASI 0.3 section to the Technical Notes WASM page evaluating how the native-async component model fits Io (stackless evaluator, actor futures, the new scheduler idle point) and records the landed migration steps. agents/WASI_ASYNC_PLAN.md maps future<T>/stream<T> onto the scheduler seam, documents the VM contracts to preserve, and lists the upgrade triggers (wasmtime 46, C toolchain async support). Static HTML and llms-full.txt regenerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the source JPEGs for the chapter art (_originals), unused assets (_unused), and the previous Introduction image. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
Superseded: this work was split into two separate merges on master — code ( |
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.
Summary
Prep work toward WASI 0.3's native async, implementing the two migration steps that are buildable and testable with today's toolchain (wasi-sdk 25, wasmtime 42), plus a design doc for the 0.3 step itself.
make componentproducesbuild/bin/io_component.wasm(a real layer-1 component viawasm32-wasip2+wasm-component-ld);make check-componentruns the full Io suite against it.Object waitparks the calling coroutine with a deadline instead of busy-yielding. Expired timers re-enter the run queue onyield/pause; when nothing is runnable the VM blocks in one host wait until the nearest deadline (Scheduler idleUntilNextTimer) — the exact seam where a WASI 0.3future<T>plugs in later. Two overlapping 1s waits: ~1.1s wall at ~4% CPU (previously 100% CPU spin or serialized sleeps).hasFinishedflag on coroutines (exposed asCoroutine isFinished);pause/yielddrop stale run-queue entries instead of resuming a finished coroutine, which restarted its body.agents/WASI_ASYNC_PLAN.mdwith the 0.3 integration design, VM contracts to preserve, and upgrade triggers (wasmtime ≥ 46, wit-bindgen C async support).Test plan
io_static: 243/243 (238 existing + 5 new inSchedulerTimerTest)🤖 Generated with Claude Code