Skip to content

Support cppgc members and pointer arguments #1144

@simonask

Description

@simonask

Slightly related to #787.

It seems there's currently no way to take a Ptr<T: GarbageCollected> as an argument in an op as anything other than &T or Option<&T>.

That's fine, except it's not possible to create something equivalent to v8::cppgc::Member<T> from the &T.

Proposal:

  • Introduce deno_core::cppgc::Member<T> (wrapping v8::cppgc::Member<CppGcObject<T>>), implementing Traced etc.
  • Extend the op2 machinery even more with the ability to get a &deno_core::cppgc::Ptr<T> as an argument (note the reference - it has to be bound to the stack by the caller, and must be !Clone as it already is).
  • Allow creating a deno_core::cppgc::Member<T> from a &deno_core::cppgc::Ptr<T>.

I tried to implement this myself, but I have to admit I get lost very quickly inside the op2 proc macro implementation, and it isn't obvious to me what the correct course of action is. There are some surprising aspects of the design that I would love to learn more about if someone wants to guide.

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