Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
k-sareen opened this issue Jan 12, 2025 · 2 comments
Closed

Comments

@k-sareen
Copy link
Collaborator

k-sareen commented Jan 12, 2025

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.

@qinsoon
Copy link
Member

qinsoon commented Jan 13, 2025

ObjectReference::to_address was removed in #1195. Now ObjectReference::to_raw_address does not require a VM type parameter. I believe this issue can be closed.

@k-sareen
Copy link
Collaborator Author

Ah right. My bad. I'm on a slightly older version of MMTk (0.27.0) which didn't have that change. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants