Presentation is loading. Please wait.

Presentation is loading. Please wait.

31.01.2006 - BA1 JVM arkitektur. 31.01.2006 - BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper.

Similar presentations


Presentation on theme: "31.01.2006 - BA1 JVM arkitektur. 31.01.2006 - BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper."— Presentation transcript:

1 31.01.2006 - BA1 JVM arkitektur

2 31.01.2006 - BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper –Bytekoder –Classfile formatet –Classloader subsystemet –Execution engine ("CPU") –Runtime dataområde

3 31.01.2006 - BA3 JVM blokdiagram

4 31.01.2006 - BA4 Grundlæggende datatyper

5 31.01.2006 - BA5 Grundlæggende datatyper TypeRange byte 8-bit signed two's complement integer (-2 7 to 2 7 - 1, inclusive) short 16-bit signed two's complement integer (-2 15 to 2 15 - 1, inclusive) int 32-bit signed two's complement integer (-2 31 to 2 31 - 1, inclusive) long 64-bit signed two's complement integer (-2 63 to 2 63 - 1, inclusive) char 16-bit unsigned Unicode character (0 to 2 16 - 1, inclusive) float 32-bit IEEE 754 single-precision float double 64-bit IEEE 754 double-precision float returnAddress address of an opcode within the same method reference reference to an object on the heap, or null Table 5-1. Ranges of the Java virtual machine's data types

6 31.01.2006 - BA6

7 7 Method area The fully qualified name of the type The fully qualified name of the type's direct superclass (unless the type is an interface or class java.lang.Object, neither of which have a superclass) Whether or not the type is a class or an interface The type's modifiers ( some subset of` public, abstract, final) An ordered list of the fully qualified names of any direct superinterfaces In addition to the basic type information listed previously, the virtual machine must also store for each loaded type: The constant pool for the type Field information Method information All class (static) variables declared in the type, except constants A reference to class ClassLoader A reference to class Class

8 31.01.2006 - BA8 Objekt layout 1 2 gange indirekte adressering Ved garbage collection skal kun én reference opdateres

9 31.01.2006 - BA9 Objekt layout 2 Kun én gang indirekte adressering Dyrt at lave garbage collection (alle referencer til et objekt skal opdateres)

10 31.01.2006 - BA10 Objekt layout 3 Svarer til VFT i C++

11 31.01.2006 - BA11 Stakke

12 31.01.2006 - BA12 Parametre og lokale variable class Example3a { public static int runClassMethod(int i, long l, float f, double d, Object o, byte b) { return 0; } public int runInstanceMethod(char c, double d, short s, boolean b) { return 0; } }

13 31.01.2006 - BA13 Simple stakoperationer iload_0 // push the int in local variable 0 iload_1 // push the int in local variable 1 iadd // pop two ints, add them, push result istore_2 // pop int, store into local variable 2

14 31.01.2006 - BA14 iload_ Operation Load int from local variable Format iload_ Forms iload_0 = 26 (0x1a) iload_1 = 27 (0x1b) iload_2 = 28 (0x1c) iload_3 = 29 (0x1d) Operand Stack......, value Description The must be an index into the local variable array of the current frame (§3.6). The local variable at must contain an int. The value of the local variable at is pushed onto the operand stack.(§3.6)

15 31.01.2006 - BA15 iadd Operation Add int Format iadd Forms iadd = 96 (0x60) Operand Stack..., value1, value2..., result Description Both value1 and value2 must be of type int. The values are popped from the operand stack. The int result is value1 + value2. The result is pushed onto the operand stack. The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's- complement format, represented as a value of type int. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical sum of the two values. Despite the fact that overflow may occur, execution of an iadd instruction never throws a runtime exception.

16 31.01.2006 - BA16 istore_ Operation Store int into local variable Format istore_ Forms istore_0 = 59 (0x3b) istore_1 = 60 (0x3c) istore_2 = 61 (0x3d) istore_3 = 62 (0x3e) Operand Stack..., value... Description The must be an index into the local variable array of the current frame (§3.6). The value on the top of the operand stack must be of type int. It is popped from the operand stack, and the value of the local variable at is set to value.(§3.6)

17 31.01.2006 - BA17 Kald af native funktioner

18 31.01.2006 - BA18 JVM virkemåde og specifikation Inside the Java 2 Virtual Machine (Bill Venners) The Java Virtual Machine Specification (Sun)

19 31.01.2006 - BA19


Download ppt "31.01.2006 - BA1 JVM arkitektur. 31.01.2006 - BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper."

Similar presentations


Ads by Google