1 / 19

JVM arkitektur

JVM arkitektur. 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. JVM blokdiagram. Grundlæggende datatyper. Grundlæggende datatyper.

Télécharger la présentation

JVM arkitektur

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JVM arkitektur

  2. 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. JVM blokdiagram

  4. Grundlæggende datatyper

  5. Grundlæggende datatyper Table 5-1. Ranges of the Java virtual machine's data types

  6. 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

  7. Objekt layout 1 • 2 gange indirekte adressering • Ved garbage collection skal kun én reference opdateres

  8. Objekt layout 2 • Kun én gang indirekte adressering • Dyrt at lave garbage collection (alle referencer til et objekt skal opdateres)

  9. Objekt layout 3 Svarer til VFT i C++

  10. Stakke

  11. 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; } }

  12. 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

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

  14. iadd iadd Operation Add int Formatiadd 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.

  15. istore_<n> istore_<n> Operation Store int into local variable Formatistore_<n> Forms istore_0 = 59 (0x3b) istore_1 = 60 (0x3c) istore_2 = 61 (0x3d) istore_3 = 62 (0x3e) Operand Stack ..., value ... Description The <n> 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 <n> is set to value.

  16. Kald af native funktioner

  17. JVM virkemåde og specifikation • Inside the Java 2 Virtual Machine (Bill Venners) • The Java Virtual Machine Specification (Sun)

More Related