feat(js2wasm): add embedded Wasmtime module backend - #1
Open
ttraenkler wants to merge 6 commits into
Open
Conversation
Add an opt-in engine_js2wasm backend that compiles linked TypeScript module graphs through js2wasm, owns the resulting Wasmtime instance in the v8x module handle, and exposes the first typed Deno.cwd host seam. Cover both live compilation and compiler-free AOT artifact replay through the rusty_v8 module API. Co-authored-by: Codex <codex@openai.com>
Move the embedded module backend from Wasmtime 45.0.3 to the latest stable release and regenerate the dependency lockfile. Both live js2wasm compilation and compiler-free AOT replay retain their value-level Deno.cwd validation. Co-authored-by: Codex <codex@openai.com>
Move Cranelift behind a development-only precompile feature and load trusted target-specific artifacts in production. Share the Engine, direct Deno host Linker, Module, and InstancePre while retaining a private Store and Instance for each evaluated module. Extend the integration proof to require one module load, two isolated instantiations, exact Deno.cwd host-call counts, and compiler-free artifact replay. Co-authored-by: Codex <codex@openai.com>
ttraenkler
marked this pull request as ready for review
August 12, 2026 08:22
Load the standardized-EH-compatible Deno core artifact through the public classic-script path, retain one Wasmtime runtime per context, and validate the pinned source order and hashes. Expose the first Rust-visible setUpAsyncStub callback bridge while keeping all non-manifest scripts fail-loud. Full Rust/Wasm object identity and extension execution remain follow-up work. Co-authored-by: Codex <codex@openai.com>
ttraenkler
force-pushed
the
codex/js2wasm-module-backend
branch
from
August 20, 2026 15:06
7c07261 to
a9bd02d
Compare
Extend the Rust-owned v8x heap and ABI through the exact deno_core bootstrap path, including weak fail-loud diagnostics, source and synthetic module state, promises, TryCatch, prototypes, typed external buffers, stable namespaces, and function metadata. Keep one prelinked Wasmtime instance alive across the pinned wrappers, module, and usage stages. Bind the exact Rust-owned op_sum and op_print Function handles through a strict scalar bridge, preserving External callback data, serde TypeError behavior, UTF-16 output, and per-store isolation. Add public rusty_v8 value tests and the exact six-source transaction proof without claiming general V8, namespace, async, or Deno API completeness. Co-authored-by: Codex <codex@openai.com>
Require generic precompiled modules to carry SHA-256 bindings for both the exact source graph and artifact bytes, and deserialize the verified bytes under a digest-aware cache key.\n\nMove the retained Deno runtime behind a reentrancy-checked RefCell so callbacks cannot alias ContextState, correct the Windows resolve-module return-slot ABI, and keep backend-only dependencies feature scoped.\n\nCo-authored-by: Codex <codex@openai.com>
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
Add an opt-in
engine_js2wasmbackend that preserves the publicrusty_v8API while executing ahead-of-time js2wasm artifacts through embedded Wasmtime 47.0.3.The latest slice:
deno_core0.407.0 wrapper/module/application transaction in one context-owned Wasmtime instanceext:core/mod.js, and the exacthello_worldusagedeno_core: handles, objects/prototypes, templates/functions, weak handles, TryCatch, promises, synthetic/source modules, metadata, namespaces, external backing stores, and typed arraysDeno.core.ops.op_sumandop_printFunction handles through nine strict scalar imports while preserving their originalExternal(OpCtx*)callback dataContextStatebefore reentrant Wasmtime callbacks and rejects recursive Store access cleanlyWith companion compiler PR loopdive/js2#4766, unchanged pinned
deno_core::hello_worldexits 0 and prints exactly:Verification
Externaldata pointers, ordered 6-print/2-sum callbacks, inner exception consumption, and a clean outer TryCatchScope
This remains a narrow synchronous POC. It does not claim general Rust/Wasm object identity, module live bindings, broad generated op tables, async promise/microtask semantics, dynamic imports, inspector support, or a complete portable Deno distribution.
Related: loopdive/js2#4766 and littledivy#74.