[oscars-integration] Thread MutationContext through core engine and ByteCompiler - #5478
Draft
shruti2522 wants to merge 3 commits into
Draft
[oscars-integration] Thread MutationContext through core engine and ByteCompiler#5478shruti2522 wants to merge 3 commits into
shruti2522 wants to merge 3 commits into
Conversation
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.
stacked on #5474
part of integrating the
oscars::mark_sweep_brandedGC backend. To make the GC safe at compile time using the<'gc>lifetime, we are removingMutationContext::global()and passingMutationContextdown through the engine instead.this PR threads the context through the Engine Core, Object/Shape Constructors, ByteCompiler and VM
It changes the following:
gc_collector()inboa_gc(for theoscars_backend) return a dummy staticMutationContext. This acts as a safe bridge to pass the context around before we fully support closure lifetimes.MutationContextdown fromContextBuilder::build()intoRealm::create(),Intrinsics,StandardConstructors, andIntrinsicObjects._inversions 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.ByteCompilernow safely stores a reference toMutationContext(using aMcWrapperto fixDebugbounds). We replacedunsafe { MutationContext::global() }inclass.rsandfunction.rsblock allocations withself.mc.0.ByteCompiler::newand its callers were updated.Vm::newto 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
MutationContextduring setup, compilation and execution. Next PRs will update the Standard Library builtins (likeArray,Date,Map) to use the new_invariants and completely remove the remainingMutationContext::global()fallbacks