This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Stack Map Frame in bytecode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stack Map Frame in bytecode" Watch "Stack Map Frame in bytecode" New topic
Author

Stack Map Frame in bytecode

Ananda Raja Ravi
Greenhorn

Joined: Sep 02, 2013
Posts: 2
Hi,

I have an advanced bytecode question. Consider the below code:



Compiling this using Oracle JDK 7 and 8 outputs the following code for the main method:

0 invokestatic #2 <java/util/Calendar/getInstance()Ljava/util/Calendar;>
3 invokevirtual #3 <java/util/Calendar/getTimeInMillis()J>
6 lstore_1
7 lload_1
8 ldc2_w #4 <2>
11 lrem
12 lconst_0
13 lcmp
14 ifne 36 (+22)
17 getstatic #6 <java/lang/System/out Ljava/io/PrintStream;>
20 ldc #7 <Time is even>
22 invokevirtual #8 <java/io/PrintStream/println(Ljava/lang/String;)V>
25 goto 44 (+19)
28 astore_3
29 aload_3
30 invokevirtual #10 <java/lang/Exception/printStackTrace()V>
33 goto 44 (+11)
36 getstatic #6 <java/lang/System/out Ljava/io/PrintStream;>
39 ldc #11 <Time is odd>
41 invokevirtual #8 <java/io/PrintStream/println(Ljava/lang/String;)V>
44 return

And the stack map for the method is:

FullFrame [frameType=255, offsetDelta=28, numberOfLocals=2, locals=
ObjectVariableInfo [[Ljava/lang/String;]
DoubleVariableInfo []
, numberOfStackItems=1, stack=
ObjectVariableInfo [java/lang/Exception]
]
SameFrame [frameType=7]
SameFrame [frameType=7]

My question is around the generation of the DoubleVariableInfo instead of LongVariableInfo by the compiler. Is this a bug or am I missing something?

Regards,
Anand.
Ananda Raja Ravi
Greenhorn

Joined: Sep 02, 2013
Posts: 2
Sorry, this is my over sight.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stack Map Frame in bytecode
 
Similar Threads
string question
Compiler Issue ?
Help with returning one string from three methods of type string?
java.lang.NullPointerException
Convert decimal value to binary