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);
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.