Re: instrumentation on anonymous class.

Sai Zhang <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Zhongxian -:

Be aware of the type: double and long, these types are 2-sized on stack.

You may have a look at the code  below and get a rough idea (I did not clean
it up, it is still a bit messy):

http://code.google.com/p/tpalus/source/browse/trunk/%20tpalus%20--username%20racezhang/Palus/src/palus/instrument/ObjectStateMonitor.java

thanks

-Sai



On Mon, Nov 1, 2010 at 10:15 AM, Zhongxian Gu <[email protected]> wrote:

> Hi,
>
> I encountered some problems when instrument the byte code of some anonymous
> classes. The scenario is like the following,
>
> in a function call, if it is not a static function, I want to record the
> receiver of this function call, which usually be local variable 0.
>
> So my code is like the following:
>
> mv.visitVarInsn(ALOAD, 0);
> mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "identityHashCode",
> "(Ljava/lang/Object;)I");
> mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf",
> "(I)Ljava/lang/Integer;");
> mv.visitMethodInsn(INVOKESTATIC, "OutputWrapper", "writeToFile",
> "(Ljava/lang/Object;)V");
>
> Is there any problem with this?
>
> I got the following exception: Exception in thread "main"
> java.lang.VerifyError: (class: Test$1, method: <init> signature: (I)V)
> Expecting to find object/array on stack
>
> Thank you guys.
>
> 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
>
>


-- 

          Thanks

                    Sai
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.