|
[
Permlink
| « Hide
]
Zvi Effron added a comment - 17/Jul/08 01:30 PM
Another way to create ObjectReferences is to convert an Address into and ObjectReference. Since Address supports plus, any Address can be made and thus any ObjectReference. I currently use invalid ObjectReferences at one point in some of the code I'm working on to reuse a field in the MiscHeader that no longer needs to serve it's primary purpose without having to write a second function that takes different arguments. So it's possible there might be other cases where invalid ObjectReferences created from Addresses could be useful.
I don't really understand what you're saying here. You are creating an ObjectReference from an Address but the thing referenced isn't an Object. I'd suggest not using an ObjectReference then as I think it should be a simple invariant that ObjectReferences reference objects. The cost of casting an ObjectReference to an Address is 0, and if ObjectReferences encapsulate what is being referenced then maybe you can provide another magic unboxed type for this purpose.
Maintaining and checking as many invariants as possible is a very powerful way to track down the root cause of bugs. Currently we're failing with errors like: I think you're right that storing it as an Address and converting to an ObjectReference when it really is one is probably a much better way to go. I merely wanted to point out that currently ObjectReferences can be created from Addresses to not actually reference an object, since it is possible, and you hadn't mentioned it, and it would need checks as well if you want to guarantee only valid ObjectReferences. (The reason I am using ObjectReferences that don't refer to Objects is because I am modifying the Merlin algorithm and trying to reuse some of its header information for different purposes to reduce overhead. I'm trying to do this at first with as little modification as I can, to get it to work, then fix things like how the functions take in their arguments.)
r14761 adds the checks of object reference validity to baseline compiled code running in a non-production scenario.
Fixed for baseline compilation on IA32 in r14761. Creating new issue to track opt compilation.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||