Optimisation work on Zero/ARM
gbenson at redhat.com
Fri Jul 10 03:19:31 PDT 2009
Edward Nevill wrote:
> I am not clear how Shark (or any JIT for that matter) replaces a
> threaded method (ie if you are executing say, SieveAtom, how does
> it hijack control from the interpreter?).
So each method is defined in HotSpot with a methodOop object (defined
in hotspot/src/share/vm/oops/methodOop.hpp). Each methodOop has two
volatile pointers, _from_interpreted_entry and _from_compiled_entry,
which are the entry points from interpreted and compiled code. When
a bytecode method is loaded these are initialized to point to the code
in the interpreter that executes methods (CppInterpreter::normal_entry
in Zero). When methods are compiled these pointers are replaced.
> And how does it replace methods which might be lower down on the
> machine stack. I can see how you might do this non portably by
> grubbing around on the machine stack.
HotSpot can do this, but Shark doesn't yet -- ie, I haven't looked at
it so I don't know how it works :) If you grep for OnStackReplacement
or OSR you should find somewhere to start.
More information about the zero-dev