Skip to content

feat(wasm): add private threaded root execution substrate #34

Closed

Description

@zackees

Child of #32; ordered before the owned child-thread bootstrap.

Scope

Implement the private, feature-gated root execution substrate for the exact ThreadedRustV1 artifact admitted by #31/#33. Retain the admitted Wasmtime engine/module privately, allocate exactly one engine-owned SharedMemory with the required 17 initial / 16,384 maximum pages, and define it as env.memory.

Build one Linker<ThreadStoreState> and one reusable InstancePre. Use an Arc<ThreadController> with OnceLock<Arc<InstancePre<ThreadStoreState>>> to break the host-function/prelink cycle: host callbacks obtain the controller through store state, rather than capturing an uninitialized prelink.

Add only deterministic, no-authority compatibility shims for the exact closed imports: kernal-api:v1::kernel-yield, wasi::thread-spawn, and P1 clock_time_get, environ_get, environ_sizes_get, fd_write, proc_exit, and sched_yield. Environment is empty; fd output is not forwarded; no filesystem, network, random, process, or ambient clock authority is granted. In this slice thread-spawn is a deterministic typed rejection stub; it must not bootstrap children.

Root execution creates one fresh Store, instantiates the prelink, and therefore runs the module start. Do not separately call kernal-api-run: Wasmtime start execution is distinct from exported _start, and the deterministic Rust command reaches its main from start. Contain proc_exit(0) as controlled root completion and map nonzero exit/trap/prelink/allocation failures to facade-owned semantic errors. Store state clones the caller-provided kernal_api::async_engine::RuntimeHandle; it never constructs a Tokio runtime.

RED → GREEN

  • RED: the existing direct, real Soldr-built artifact admits but has no private root execution path.
  • GREEN: direct real artifact test proves exactly one compilation/prelink, an engine-owned shared memory with 17/16,384 pages linked as env.memory, one root Store/Instance, start execution, one facade RuntimeHandle identity, deterministic no-authority P1 behavior, and typed proc_exit/trap outcomes.
  • thread-spawn returns the documented deterministic rejection and creates no TID, Store, Instance, native thread, or registration.
  • Public API exposes semantic run/result/error values only—no Wasmtime, Tokio, Linker, Store, InstancePre, or SharedMemory types.

Platform and safety

Target Linux/macOS/Windows on x86-64 and ARM64 using Wasmtime 45 Cranelift. Use synchronous Wasmtime calls for v1. Shared-memory concurrent bytes are accessed only with atomics. No Store/Instance crosses a native thread boundary.

Non-goals

No owned child threads, thread joins, async resources/streams, capabilities, pooling, broad WASI, Tauri, worker-process containment, forced teardown, quotas, fuel, or epoch policy.

Dependencies and related work

Activity

  1. added
    enhancement
    on Aug 27, 2026
  2. zackees commented on Aug 27, 2026

    @zackees
    CollaboratorAuthor

    Implementation merged in #39 (squash merge 9aacf67).

    Validation passed locally on Windows/Soldr and in managed Linux Bosn 0.1.3 with CARGO_BUILD_JOBS=1: fmt, all-features lint/test, and focused threaded-root/artifact tests all returned 0. The issue remains open intentionally: the Cargo-built real Rust threaded-artifact execution proof is blocked by forge-ci/soldr#2919.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions