This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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

JavaRanch » Java Forums » Java » Java in General
Bookmark "Stack Map Frame in bytecode" Watch "Stack Map Frame in bytecode" New topic

Stack Map Frame in bytecode

Ananda Raja Ravi

Joined: Sep 02, 2013
Posts: 2

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?

Ananda Raja Ravi

Joined: Sep 02, 2013
Posts: 2
Sorry, this is my over sight.
subject: Stack Map Frame in bytecode