The concept of JVM
- JVM is a Java Virtual Machine for short. Means Java virtual machine.
- JVM software emulation of the Java bytecode instruction set.
specification
java language specification
- Syntax
if-else-else if, and so the function syntax - Lexical
line terminators, white space, comments, identifiers, keywords, etc. - java memory model
- Class loading process is connected
- abnormal
- ...
JVM specification
The main class file defines a binary JVM and JVM instruction set. Java language and the JVM is relatively independent, Groovy, Clojure, Scala, etc. can also be run in the JVM.
- Class File Format
- And storing the digital internal representation
Byte -128 to 127 (-27 to 27 - 1) - returnAddress data type definition
pointer operation code. Java does not correspond to the data type can not be modified at runtime. Finally need to achieve - The definition of PC, heap, stack, method area
- Integer, floating-point representations and definitions
- Special methods
- <clinit>
- <init>
- VM instruction set
- The type of conversion
l2i
- Pop stack operation
aload astore - Operation
iadd isub - Process control
ifeq ifne - 函数调用
invokevirtual invokeinterface invokespecial invokestatic
- The type of conversion
- JVM need to provide the following support for Java Library
- Reflection java.lang.reflect
- ClassLoader
- Initialize class and interface
- Safety-related java.security
- Multithreading
- Weak references
- JVM compilation
- JVM instructions corresponding to the source format
- Jvp
- JVM disassembly format
(index) (opcode) [( operand1) [(operand2) ...]] [(comment)]