Re: Get the runtime return value of a method.

Peter Veentjer <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Duplicating the return value on the stack looks like a good solution to me.

The only thing you need to do is to transform all IRETURN/ARETURN etc by
duplicating the value on the stack and add your additional logic in front of
the XRETURN. Make sure that the size of the stack after your logic has
consumed the duplicate value is the same as before making the change. And
also make sure that you deal with category 1 (int, float, Object etc) and
category 2 operands (Long/Double) on the stack (so DUP and DUP2).

On Mon, Jun 28, 2010 at 6:25 PM, Zhongxian Gu <[email protected]> wrote:

> Hi,
>
> I am thinking to use ASM to get the return value of a method call in
> run-time. What I've thought is to dup the value in stack before return, and
> use one to print to a log file, and return the other. I am not sure whether
> it is correct or not? I wonder if someone has used ASM to do that. Could you
> guys give me some hint?
>
> Thanks.
>
> Best
>
> Zhongxian
>
> --
> Zhongxian Gu
> http://wwwcsif.cs.ucdavis.edu/~gu/ <http://wwwcsif.cs.ucdavis.edu/%7Egu/>
> Ph.D. Student in Computer Science, UC Davis
> 2249 Kemper Hall
>
>
> --
> 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
>
>
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.