Re: Re: Re: add code to existing method code

Eugene Kuleshov <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Rémi Forax wrote:
>>  Your assumption is correct. The order of visit calls is documented 
>> at 
>> http://asm.ow2.org/asm33/javadoc/user/org/objectweb/asm/MethodVisitor.html 
>>
> And if you want to put additional code, the best is to trap all return 
> instructions
> in visitInsn.
>
> public void visitInsn(int opcode) {
>   // trick all return opcodes are between IRETURN and RETURN
>   if (opcode >= IRETURN && opcode <= RETURN) {
>      // don't forget that the return value is already on top of the stack
>      ...
>   }
>   super.visitInsn(opcode);
> }
  Good point Remi. We there is also an AdviceAdapter that takes care of 
that:
  
http://asm.ow2.org/asm33/javadoc/user/org/objectweb/asm/commons/AdviceAdapter.html

  regards,
  Eugene
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.