Details

Description

We have a bunch of Magic.objectAsXXX methods. It would be nice to generalize these. We would like to be able to do:

RVMThread t = (RVMThread)Magic.eatCast(o);

instead of:

RVMThread t = Magic.objectAsThread(o);

since this results in fewer Magic methods. The semantics of eatCast would be as follows:

ignored in baseline compiler (because we don't care about performance there, and this will be used in runtime code that is opt compiled anyway),

any checkcast on the result of the eatCast() call is eliminated.

Included is a patch that appears to implement this. Please review if you have a chance. I'm using it in my branch but it would be nice to get this into the trunk to simplify work for others doing similar things as me.

David Grove
added a comment - 25/Feb/09 5:24 AM If defining magic methods wasn't such an annoyance, then we wouldn't need this?
if one could just write:
@Intrinsic(typeconversion = "foo.bar.Baz" )
public native Baz castToBaz( Object o);
and be done with it, then I'd think that we'd prefer that to eatCast.
Asking because this should be possible after the next couple steps of magic implementation re-working that I'm doing in support of the VEE'09 paper.
It's a shame that type erasure prevents us from writing
@Intrinsic
native T castTo[T]( Object o);