What is a 1.java virtual machine
- Abstract specification
- A concrete implementation
- A running instance of a virtual machine
The life cycle of a 2.java virtual machine
When a Java program is started, a virtual machine instance is born, and when all non-daemon threads in the program terminate, the virtual machine instance exits
3.java Architecture of virtual machines
4. Data type
5. Word length
The most basic unit of data in a virtual machine is a word, and a two-character unit must hold a long or double-type value
6. Class Loader Subsystem
User-defined classes need to be derived from the Java.lang.ClassLoader class, and each loaded type is created with a Java.lang.Class instance
Four important methods in ClassLoader:
7. Method area
Also stores:
- Constant pool
- Field information
- Method information
- Class static variables
- A reference to the ClassLoader
- A reference to a class instance: A method in class that obtains the class's way: Class.forName (String className); object's GetClass () method
- Method table
8. Heap
Two ways to design a heap space:
The first object is easy to move, but requires two pointer passes, and the second requires only one pointer, but moving the object requires updating the reference to the object in the entire runtime data area
Method table:
In addition, the heap is also responsible for storing object locks, waiting for the collection
The representation of the array on the heap:
9. Program counter
10. Stack
The stack frame consists of three parts:
- Local variable area: the corresponding parameter and local variable of the method
- Operand stacks
- Frame data area: Support constant pool parsing, normal method return, abnormal dispatch data
The way the stack is grown:
Java Virtual machine