2. Intermediate Representation
0 Supplementary Materials¶
0.1 P25 (invoke in JVM)¶
invokespecial: call constructor, call superclass methods, call private methodsinvokevirtual: call instance methods (virtual dispatch)invokeinterface: cannot optimization, checking interface implementationinvokestatic: call static methodsinvokedynamic:Java 7Java static typing, dynamic language runs on JVM
0.2 P25 (Method signature)¶
className: returnType methodName(parameter1Type, parameter2Type, ...)
e.g.
specialinvoke $r3.<java.lang.StringBuilder: void <init>()>();
$r4 = virtualinvoke $r3.<java.lang.StringBuilder: java.lang.StringBuilder append(java.lang.String)>(r1);
The name of the constructor in JVM is
<init>
0.3 P28 (<init> and <clinit> in JVM)¶
<init>is the (or one of the) constructor(s) for the instance and non-static field initialization.
<clinit>are the static initialization blocks for the class and static field initialization.
class X {
static Log log = LogFactory.getLog(); // <clinit>
private int x = 1; // <init>
X(){
// <init>
}
static {
// <clinit>
}
}
class A {
B b = ...; // JVM call the <clinit> method of class B
}