Re: how to let asm compute frame automatically?

lucefe <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi Hao Zuo
I use the next code to let asm compute frames automatically.
But I still can only  get  FRAME APPEND,  FRAME SAME
            ClassReader cr = new ClassReader(new FileInputStream(file));
            cn = new ClassNode();
            cr.accept(cn, 0);
            ClassWriter cw = new ClassWriter(cr,
ClassWriter.COMPUTE_FRAMES);
            cn.accept(cw);

what I want to get is:
when I analysis source code:    30:  node.key = data;
The corresponding byte code is :
   L1
    LINENUMBER 30 L1
    ALOAD 2
    ILOAD 1
    PUTFIELD SE/BinarySearchTree$Node.key : I
I want to get the def and use information of line 30.
data, the variable at the top of the frame stack is a use, and
node, the variable at  the top-1 of the frame stack is a def, so
this is why I want to get the information about the frame stack.
Is there a convenient way?

2010/8/28 Hao Zuo <[email protected]>

> Hi lucefe,
>
> You would use the COMPUTE_FRAMES flag with ClassWriter when you're done
> with all you transformations. For example:
>
> ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
> cn.accept(cw);
>
> When you get the bytes from the cw, they will represent a class in which
> all the frames have been computed for you.
>
> On Fri, Aug 27, 2010 at 11:14 AM, lucefe <[email protected]> wrote:
>
>> Hi all,
>>
>>     I want to let asm compute frame for me.
>>     I use the tree API to instrument a file, the code is followed:
>>
>>             ClassReader cr = new ClassReader(new FileInputStream(file));
>>             cn = new ClassNode();
>>             cr.accept(cn, 0);
>>
>>    I know from the asm guide that the COMPUTE_FRAMES option of ClassWriter
>>    can let asm compute frame automatically. But how to accomplish it when
>> I use
>>    the tree API?
>>
>>
>> --
>> 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.