Skip to content

Provide alternatives to ObjectReference methods without VM type parameter? #1258

@k-sareen

Description

@k-sareen

For simple/most VMs, ObjectReference == Address so the object.to_address::<VM>() function call is unnecessary in ObjectReference methods. Indeed I have found cases where we don't have a VM type parameter but want to print the liveness of an object for debugging. Smuggling the VM type parameter into such places may require changing many places or just be impossible because nothing in the call stack above has a VM type parameter.

I think we should provide alternative methods in ObjectReference that remove the use of to_address::<VM>() in favour of directly using Address(self.0.get()) where self is an ObjectReference.

We can add debug asserts to these functions which assert that the object reference and address are indeed the same to prevent developers from misusing this API.

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