Skip to content

Tagged GC Pointers #919

Closed
Closed
@sebmarkbage

Description

@sebmarkbage

I noticed in the GC doc that there is no mention of tagged pointers. I wanted to make the case for it. When compiling languages that might heavily rely on tagged unions (such as Rust or OCaml) with GC interop you will have to store the tag as a separate field which can be quite inefficient.

Even as part of the initial proposal for opaque reference types, it would be nice to expose a way to allow a tag to be associated with the reference.

I realize that not all architectures or VM implementations will be able to take advantage of this and might even need to box in some cases. The available space for a tag may also already be used by the JS VM to store its type information. However, for environments that can take advantage, it would be very helpful to have the appropriate affordances.

I could imagine this being related to a possible JavaScript enum proposal as well (which I'm interested in exploring in TC39). That could be the JavaScript representation of this value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions