class execution mechanism
- The JVM executes class bytecode based on the stack architecture, and after the thread is created, the program counter (PC) and stack (stack) are generated.
- The PC holds the offset of the next executed instruction within the method, the stack holds a stack frame, each stack frame corresponds to each call of each method, and the stack frame holds local variables and the operand stack
The structure of the stack is as follows:
JVM Memory Structure
The Java Virtual machine specification for Java Virtual machine memory is actually the Java Virtual Runtime data area, its schema is as follows:
All the memory of objects created by new is allocated in the heap;
Each thread executes each method by applying a stack frame in the stack, each of which includes the local variable area and the operand stack.
Used to hold temporary variables, parameters, and intermediate results during this method call
Store information such as class information, static variables, final type constants, properties, and methods, and the method area is also known as the Permanent Generation (Permanent Generation)
The local method stack is the operating system local method service that is called for the virtual machine, storing the state of each native method call
jvm--class execution mechanism and JVM memory composition structure