Interesting idea...
"Andreas Raab" andreas.raab@gmx.de wrote:
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.
[*] One might even argue that the test should be there to begin with since without it the VM will crash if you ever store anything but CMs in the method dictionaries.
I'm reasonably sure I agree with that.
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. 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). Then again I suspect that wasn't quite what you were thinking of at the time anyway.
tim