Skip to content

Track boa_gc to oscars API parity gaps for Boa integration #63

Open

Description

@Flamki

This issue tracks parity gaps between the current Boa-facing boa_gc API surface and the active oscars mark-sweep APIs.

Context:

  • #38 documents the boa_gc surface currently used by Boa.
  • #26 tracks integration into Boa.
  • #28 tracks the staged integration path.
  • #60 drafted the parity analysis in docs form; per maintainer feedback, this issue replaces that notes-file approach so we can track concrete follow-up tasks here.

The goal here is not to restate the entire API surface. The goal is to identify the gaps that matter for staged Boa integration and split them into reviewable follow-up work.

Main parity gaps

1. Allocation / collector context model

  • Decide how staged Boa integration should handle the current mismatch between:
    • Boa-style implicit allocation (Gc::new(value))
    • Oscars-style explicit collector threading (Gc::new_in(value, collector))

2. Gc<T> API parity

  • Gc::ptr_eq parity helper (#62)
  • Gc::new_cyclic
  • Gc::into_raw
  • Gc::from_raw
  • Gc::downcast
  • Gc::cast_unchecked
  • Gc::cast_ref_unchecked

3. Weak API parity

  • WeakGc::new / constructor shape parity
  • WeakGc::upgrade parity
  • WeakMap constructor / insertion shape parity where needed for Boa-facing integration

4. Runtime utility parity

  • force_collect()
  • finalizer_safe()

5. Macro / tracing helper parity

  • unsafe_empty_trace!

Notes

  • This issue is intentionally focused on API parity and adoption shape, not allocator redesign.
  • Active allocator / layout work should continue under their existing PRs and issues.
  • Follow-up work from here should prefer small, focused PRs that close one parity gap at a time.

Candidate follow-up issues

Potential follow-up issues from this tracker include:

  • add Gc::new_cyclic parity helper
  • add raw-pointer roundtrip helpers for Gc<T>
  • add weak upgrade parity for WeakGc<T>
  • add runtime utility parity for integration/test support

Activity

  1. nekevss commented on Mar 27, 2026

    @nekevss
    Member

    Just to note, I believe force_collect should be covered by the collect method on MarkSweepGarbageCollector

  2. nekevss commented on Mar 27, 2026

    @nekevss
    Member

    Okay, I think we should have pretty good parity at this point. The changes a made do still need tests for them probably just to make sure if someone wants reads this and wants to take a stab at adding some tests.

  3. Flamki commented on Mar 27, 2026

    @Flamki
    ContributorAuthor

    Added tests in #67 for the parity helpers merged in #64/#65/#66:

    • Gc::into_raw / Gc::from_raw
    • Gc::downcast / Gc::cast_unchecked
    • WeakGc::upgrade

    Coverage is included for both mark_sweep and mark_sweep2, and cargo test --workspace passes locally.

    If there are specific edge cases you want covered as follow-up, I can add those too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions