Features of the Java Virtual machine stack
Thread Private
Last in, first out (LIFO) stacks
Storage stack frames, support for Java method invocation, execution, and exit
OutOfMemoryError and Stackoverflowerror exceptions may occur
Features of the Java native method stack
Thread Private
Last in, first out (LIFO) stacks
The function is to support the invocation, execution, and exit of the native method.
OutOfMemoryError and Stackoverflowerror exceptions may occur
Some virtual machines, such as hotspots, merge the Java Virtual machine stack and the local method stack to implement
Concept and characteristics of stack frames
The content stored in the Java Virtual machine stack, which is used to store data and data structures for partial process results, and also to handle dynamic links, method return values, and exception dispatch
A complete stack frame contains: local variable table, operand stack, dynamic connection information, method of normal completion information and method exception completion information
Local variable table concepts and features
Consists of several slots, the length of which is determined by the compilation period
A single slot can store data of type boolean,byte,char,short,float,reference and ReturnAddress, and two slots can store data of a type long or double
Local variable tables are used for inter-method parameter passing, as well as for values that store the underlying data type and references to objects during method execution
Concept and characteristics of the operand stack
is a last-in-first-out stack consisting of several entry, the length of which is determined by the compilation period
A single entry can store values for any data type defined in a Java virtual machine, including the long and double types, but the entry depth of the stored long and double types is 2, and the other types have a depth of 1
During the execution of the method, the stack frame is used to store the calculation parameters and the results of the calculation; When the method is called, the operand stack is also used to prepare the parameters of the calling method and the Receive method to return the result
Java Virtual machine stack and local method stack