jacksu said:
For the rest of the code, I would like the JIT to do the magic, but
for certain portion of the java code, I would make it untouched by the
JIT.
Since there's no mention of the JITer in either the Java standard or the JVM
standard (i.e. the use of a JIT, or any alternative technology is purely an
implementation detail) there can be no standard way of doing that. Any such
feature would be provided by the /specific/ implementation of the JVM that you
are using. Perhaps as a runtime -XX option that specified a file containing a
list of methods that should/should not be optimised.
It's not an inherently silly thing to want, but I don't know of any JVM
implementation that provides it -- probably because there's little need for it
in general.
If you really /need/ to avoid the space/time costs of compiling some chunks of
bytecode (and don't want to implement your own JVM) then you could always write
a small interpreter (in Java) and embed that, plus the stuff you want it to
interpret, into your program. If you go that route then I'd advise against
using the JVM bytecode set as the target for your interpreter -- it is
complicated and not particularly compact.
-- chris