Skip to content

feat(rust): add precompiled named modules with per-module stacks and snapshot durability - #159

Merged
kommander merged 3 commits into
devfrom
feat/rust-precompiled-modules-ts
Dec 3, 2026
Merged

kommander merged 3 commits into
devfrom
feat/rust-precompiled-modules-ts

Conversation

@Hona

@Hona Hona commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Adds Rust-only precompiled synchronous named modules with per-module file:line:col stack traces, per-module Function.prototype.toString, and full snapshot/session durability.

API

  • CompiledModule (name(), code(), Clone + Send + Sync)
  • Runtime::compile_module(&self, source, name) (respects Limits::max_source_bytes)
  • Session::eval_compiled / Session::eval_module
  • HostCtx::eval_compiled / HostCtx::eval_module

Rework notes

  • Dropped TypeScript stripping, CompileOptions, duplicate max_source_bytes, and the unrelated super.m\x`` compiler fix.
  • Persisted loaded modules, exact load order (including interleaved Array.fromAsync), and per-module source metadata across Session::save / Runtime::restore_session and suspend/resume snapshots.
  • Inline-compiles nested HostCtx::eval_module calls when remaining stack budget suffices; packs Option<CallSite> into 8 bytes to stay within 0.1% on all 9 callgrind benchmarks.

Copilot AI balanced review requested due to automatic review settings December 2, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Hona
Hona force-pushed the feat/rust-precompiled-modules-ts branch 3 times, most recently from 9023423 to d926fa6 Compare December 2, 2026 04:06
@Hona
Hona force-pushed the feat/rust-persistent-session branch from 880f23f to d3d3303 Compare December 2, 2026 15:28
@Hona
Hona force-pushed the feat/rust-precompiled-modules-ts branch 2 times, most recently from 378204c to afccce9 Compare December 2, 2026 22:00
Base automatically changed from feat/rust-persistent-session to dev December 3, 2026 00:18
@Hona
Hona force-pushed the feat/rust-precompiled-modules-ts branch from afccce9 to 814162a Compare December 3, 2026 00:23
…ility

- Drop TypeScript stripping, CompileOptions, duplicate max_source_bytes, and unrelated super tagged-template fix
- Respect Limits::max_source_bytes in compile_module / eval_module
- Avoid spawning an OS thread per nested eval_module when stack budget allows inline compile
- Reuse first_frame error-location helper for loaded modules
- Persist loaded modules, load order (including Array.fromAsync), and per-module source metadata across Session::save / restore_session and suspend/resume snapshots
- Pack CallSite into 8 bytes (Option<CallSite> == Option<u32>) to stay within 0.1% on all callgrind bench programs
- Document Rust-only precompiled modules and per-module stacks/toString in rust/README.md
@kommander kommander changed the title feat(rust): add precompiled modules with per-module stacks and opt-in TS stripping feat(rust): add precompiled named modules with per-module stacks and snapshot durability Dec 3, 2026
@kommander
kommander merged commit 61fafe4 into dev Dec 3, 2026
2 checks passed
@kommander
kommander deleted the feat/rust-precompiled-modules-ts branch December 3, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants