|
|
|
|
Reasons for learning JVM |
|
Resource |
|
The Java TM Virtual Machine Specification (2 nd Ed),
by Tim Lindholm & Frank Yellin, Addison-Wesley,1999
http://java.sun.com/docs/books/vmspec/ |
|
|
|
|
|
byte, char, short, int, float, reference, and returnAddress
in one word |
|
boolean, byte, char, and short are converted to int |
|
Special representations for byte, char, and short
arrays are possible |
|
long and double in two words |
|
|
|
|
|
|
|
|
Method area (shared by all threads) |
|
One record for each loaded class that contains: |
|
Constant pool |
|
Code for methods and constructors |
|
Heap (shared by all threads) |
|
One record for each class instance or array |
|
Stack (one per thread) |
|
Hold frames associated with method invocations |
|
|
|
|
|
|
|
|
|
|
Class, method, and field names are all stored
symbolically as strings |
|
A descriptor is a string representing the type
of a field or method |
|
Class names |
|
Class names are always fully qualified |
|
Use forward slash rather than dot as the
delimeter |
|
Ex: Java.util.Vector =>
java/util/Vector |
|
|
|
|
|
Primitive types |
|
B, C, D, F, I,J(long), S, Z(boolean), V(void) |
|
Arrays |
|
Use [ |
|
Classes |
|
Lclassname |
|
Ex: |
|
Type: String valueOf(char[] , int offset, int
count) |
|
Descriptor:([CII)Ljava/lang/String; |
|
|
|
|
CONSTANT_Class |
|
CONSTANT_Fieldref |
|
CONSTANT_Methodref |
|
CONSTANT_InterfaceMthodref |
|
CONSTANT_String, |
|
CONSTANT_Integer |
|
CONSTANT_Float |
|
CONSTANT_Long |
|
CONSTANT_Double |
|
CONSTANT_NameAndType |
|
CONSTANT_Utf8 |
|
|
|
|
|
field_info |
|
Access flags |
|
Name |
|
Descriptor |
|
Static values |
|
|
|
method_info |
|
Access flags |
|
Name |
|
Descriptor |
|
Code |
|
|
|
|
|
|
Load and store (e.g., iload, istore ldc, iconst_<i>) |
|
Arithmetic (e.g., iadd, isub, imul, idiv, irem) |
|
Type conversion (e.g., i2b, i2f, i2d) |
|
Object creation and manipulation
(e.g,
new, newarray, iaload, iastore , getfield,
putfield) |
|
Operand stack manipulation (e.g., pop, dup, dup_x1,
swap) |
|
Control transfer (e.g., goto, ifeq, tableswitch) |
|
Method invocation and return
(invokevirtual,
invokeinterface, invokespecial, invokestatic, ireturn) |
|
Exception handling and synchronization (e.g.,athrow) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Does the efficiency of a program change after an
int variable is changed to byte? |
|
When does dynamic loading take place? |
|
When does dynamic linking take place? |
|
Why are run-time byte-code verification and type
checking necessary? |
|
How are exceptions handled in JVM? |
|
How different is the JVM from a stack machine
for Pascal? |
|