Skip to content

refactor: add 'gc lifetime to core gc types - #5446

Merged
jedel1043 merged 1 commit into
boa-dev:dev/oscars-gcfrom
shruti2522:integration-2
Jul 24, 2026
Merged

refactor: add 'gc lifetime to core gc types#5446
jedel1043 merged 1 commit into
boa-dev:dev/oscars-gcfrom
shruti2522:integration-2

Conversation

@shruti2522

@shruti2522 shruti2522 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

adding the 'gc lifetime to core boa_gc types (like Gc, GcErased, WeakMap) to make sure Gc pointers are safely tied to the lifetime of the arena they belong to.

to keep this PR small and easy to review, I've used a temporary 'static lifetime for all the Gc pointers. I'll replace these placeholders with the real arena lifetimes in a follow up PR when updating to MutationContext

@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers 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-GC Issue related to garbage collection C-Runtime Issues and PRs related to Boa's runtime features and removed Waiting On Review Waiting on reviews from the maintainers labels Jul 23, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Jul 23, 2026
@shruti2522
shruti2522 marked this pull request as ready for review July 23, 2026 23:17
@shruti2522
shruti2522 requested a review from a team as a code owner July 23, 2026 23:17

@jedel1043 jedel1043 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice to see the beginnings of the integration with the new Gc!

@jedel1043
jedel1043 merged commit 5d2350e into boa-dev:dev/oscars-gc Jul 24, 2026
2 checks passed
jedel1043 pushed a commit that referenced this pull request Jul 25, 2026
<!---
Thank you for contributing to Boa! Please fill out the template below,
and remove or add any
information as you feel necessary.
--->
this is a follow up to the previous PR #5446 that introduced the `'gc`
lifetime, we now require a valid `MutationContext` for all gc pointers
in boa_gc
We must pass it to `Gc::new`, `WeakGc::upgrade`, `Ephemeron` and
`WeakMap`, this stops pointers from living longer than they are supposed
to.

To keep the engine compiling, I added a fake `MutationContext::dummy()` 
to use as a temporary patch until we pass the real context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Builtins PRs and Issues related to builtins/intrinsics C-GC Issue related to garbage collection 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants