Skip to content

[oscars-integration] Thread MutationContext through core engine and ByteCompiler - #5478

Draft
shruti2522 wants to merge 3 commits into
boa-dev:dev/oscars-gcfrom
shruti2522:feat/msb-phase1-core
Draft

[oscars-integration] Thread MutationContext through core engine and ByteCompiler#5478
shruti2522 wants to merge 3 commits into
boa-dev:dev/oscars-gcfrom
shruti2522:feat/msb-phase1-core

Conversation

@shruti2522

Copy link
Copy Markdown
Contributor

stacked on #5474

part of integrating the oscars::mark_sweep_branded GC backend. To make the GC safe at compile time using the <'gc> lifetime, we are removing MutationContext::global() and passing MutationContext down through the engine instead.

this PR threads the context through the Engine Core, Object/Shape Constructors, ByteCompiler and VM

It changes the following:

  • GC Context Bridge: Made gc_collector() in boa_gc (for the oscars_backend) return a dummy static MutationContext. This acts as a safe bridge to pass the context around before we fully support closure lifetimes.
  • Threaded MutationContext down from ContextBuilder::build() into Realm::create(), Intrinsics, StandardConstructors, and IntrinsicObjects.
  • added _in versions for all core object and shape constructors (e.g., JsObject::new_in). These new functions take a &MutationContext. The old constructors temporarily fall back to the global context to keep the build green for standard library components.
  • ByteCompiler now safely stores a reference to MutationContext (using a McWrapper to fix Debug bounds). We replaced unsafe { MutationContext::global() } in class.rs and function.rs block allocations with self.mc.0. ByteCompiler::new and its callers were updated.
  • updated Vm::new to accept &MutationContext. Updated environment stack opcodes (PushScope, push_lexical, etc.) to take and use the threaded context instead of the global one.

Next

The engine now correctly passes MutationContext during setup, compilation and execution. Next PRs will update the Standard Library builtins (like Array, Date, Map) to use the new _in variants and completely remove the remaining MutationContext::global() fallbacks

@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Aug 16, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Aug 16, 2026
@github-actions github-actions Bot added C-Dependencies Pull requests that update a dependency file C-Benchmark Issues and PRs related to the benchmark subsystem. C-Tests Issues and PRs related to the tests. C-Builtins PRs and Issues related to builtins/intrinsics C-VM Issues and PRs related to the Boa Virtual Machine. C-Actions Pull requests that update Github Actions code C-GC Issue related to garbage collection C-Intl Changes related to the `Intl` implementation C-Runtime Issues and PRs related to Boa's runtime features labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Actions Pull requests that update Github Actions code C-Benchmark Issues and PRs related to the benchmark subsystem. C-Builtins PRs and Issues related to builtins/intrinsics C-Dependencies Pull requests that update a dependency file C-GC Issue related to garbage collection C-Intl Changes related to the `Intl` implementation C-Runtime Issues and PRs related to Boa's runtime features C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant