On Apr 23, 2007, at 3:19 PM, Eugene Kuleshov wrote:
Hi Bill,
I understand your challenge, but it also doesn't seem appropriate
to introduce such hack method into the ASM API. However we can try
some other alternatives. For example:
-- introduce some accessor/field in the ClassReader that would
return current bytecode offset, so you can read it from the
adapter. though this option need to be verified for performance impact
-- introduce a hook into the ClassReader (same place you've
suggested to add new visit*() call), which you can implement in
your own subclass of ClassReader, i.e.
protected void beforeInsnVisit(MethodVisitor mv, int offset) {
}
default implementation could be empty, so hotspot compiler should
be able to optimize it out.
Anyways, if any of those options are acceptable for you, I can
check for the performance impact.
Thanks
Eugene
Either of those would be fine. I think the idea of allowing
ClassReader to be extended might be best; just add a protected empty
stub method to ClassReader that gets called at the appropriate points
(e.g, the beforeInsnVisit method). It might be nice to provide the
raw opcode as well as the offset. Not sure if we'd need the opcode,
but you only want to do this kind of extension once.
I'm pretty sure this would have no performance impact due to the way
hotspot inlines non-overridden empty methods.
Bill
|
|