• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stack Map Frame in bytecode

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, this is my over sight.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic