Hi Tim,
The test itself takes advantage of CompiledMethod's special object format so the cost is very close to zero here - if you take the mcache hit rate into account it's exactly zero (as in: not measurable).
I hope this stays true if the clean CompiledMethod stuff is used; 'twould be a pity otherwise.
I'm pretty sure it would. The current test uses the format of the CM but one could equally well just compare the class - which is *slightly* slower if you start counting cycles but I'd expect this to be neglectable considering that we're in the full lookup anyways.
PS. It just so occured to me that going this way one might have a completely different interpreter/bytecode set running next to the current one. Even methods compiled completely to native code. Sort of like a trap. Hm...
I haven't had time to look at your code and won't have time today as I have to run off to a party RealSoonNow but it sounds from your description that this is not quite what one might want for supporting a native code method facility.
Oh it depends on what you're after. I could (for example) imagine that for a numeric compiler there's a 'special kind of stub' instead of the CMs which holds both on to the byte code representation as well as the native representation. Probably not what you want to do for the general case but quite powerful (and simple!) if you are looking at relatively few methods.
Sure, one could compile bytecodes to native and _replace_ the original method this way but you'd have to do some extra stuff to keep the original around (assuming you have any need for it in the future - depends on caching etc).
See above. In some situations the overhead for housekeeping is absolutely acceptable, in fact advantageous (as one could lazily switch between representations depending on the environmental factors).
Then again I suspect that wasn't quite what you were thinking of at the time anyway.
No, certainly not ;-) Actually, I was thinking about E and it's dual function/object representation. I wanted to be able to experiment along those lines.
Cheers, - Andreas