Re: Re: add code to existing method code

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Le 26/09/2010 14:33, Eugene Kuleshov a écrit :
>
>  Your assumption is correct. The order of visit calls is documented at 
> http://asm.ow2.org/asm33/javadoc/user/org/objectweb/asm/MethodVisitor.html 
>
>
>  regards,
>  Eugene

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);
}

Rémi

>
>
> luc peuvrier at home wrote:
>> Hi,
>>
>> Is it guarantee that MethodVisitor.visitMaxs is call after the last 
>> method instruction visit ?
>> It is the right place to put additional code to the method ?
>>
>> Best regards
>> Luc Peuvrier
>
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.