File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stack Map Frame in bytecode

 
Ananda Raja Ravi
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, this is my over sight.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic