How do are callers patched when a method is recompiled?
yzhang1985 at gmail.com
Sun Oct 5 13:36:12 PDT 2008
Hi. I'm trying to build a dynamic optimization framework for LLVM and have
been looking at HotSpot for ideas on how to patch the callers when a method
is recompiled. I've spent over an hour looking at functions like
new_nmethod, register_method and I can't figure it out.
I've been thinking about the following approaches:
1. lazy relinking - keep the old code and patch callers only when they refer
to the old code. I guess you can do this by patching the old code to find
the call site and patch it. Then there's the question of
when to throw away the old fragment. Could use reference counting or garbage
2. relink immediately - upon recompiling, all callers are patched. This
would be expensive because it would entail either going through every
function looking for such a call (more processing) or maintaining a list of
callers for each function (more storage).
So, how does HotSpot do it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-dev