Re: Error in changed bytecode

Ivo Anjo <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CA+iO_8m0gH1sLp+zM3iUjV=eRgD-9LwjWXVJeuMGBGRSM3fPvw@mail.gmail.com>
Hello,

I think your error is that you're forgetting that longs and doubles take two
"slots" on the stack and on the locals, so you have to space them
accordingly -- i.e., when you LSTORE 11, you occupy 11 and 12, and if you
previously LSTORED to 10, you've clobbered half your long.

You might want to code a simple java method that stores multiple longs in
local variables to see what is the generated bytecode.

Ivo

On Sun, Jul 24, 2011 at 2:37 PM, Jayanga Wagaarachchi <
[email protected]> wrote:

> Hi,
>
> I am having a confusing error when I tried to add some code to calculate
> time consumed by a section of method. I am adding some bytecodes. But when I
> run the changed program I receive an error An unexpected error has been
> detected by Java Runtime Environmen# EXCEPTION_ACCESS_VIOLATION
> (0xc0000005)# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode,
> sharing)
>
> Then I tried to analyze the code using *CheckClassAdapter. *when I am
> trying to verify the code it shows me an error in the changed byte code as Expected
> J, but found . I figured this is caused when accessing uninitialized
> variable.  here is a part of output from CheckClassAdapter
>
> 00072 LOriginal; [[I [[I [[I I I I . . . J . . . . .  :  :    L1
> 00073 LOriginal; [[I [[I [[I I I I . . . J . . . . .  :  :    FRAME FULL
> [Original [[I [[I [[I I I I T T T J] []
> 00074 LOriginal; [[I [[I [[I I I I . . . J . . . . .  :  :     INVOKESTATIC
> java/lang/System.nanoTime ()J
> 00075 LOriginal; [[I [[I [[I I I I . . . J . . . . .  : J  :     LSTORE 11
> 00076 LOriginal; [[I [[I [[I I I I . . . . J . . . .  :  :     LLOAD 11
> 00077 LOriginal; [[I [[I [[I I I I . . . . J . . . .  : J  :     LLOAD 10
> 00078 ?                       :     LSUB
>
> Here if you look at the instruction 75 which is LSTORE 11 at that point I
> have already added anther long value initialized and stored at position 10.
> But when the LSTORE 11 executes the long value at the position 10 disappears
> causing the above mentioned error at instruction 77. Isn't this confusing? I
> am stuck at this point because I cant find any reason why this happens.
>
> Can you show me what is wrong here?
> Thank you.
> --
> Jayanga Wagaarachchi
> Computer Science and Engineering
> University of Moratuwa.
>
>
> --
> 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.