Like the program counter, the Java Virtual machine stack is also thread-private, with the same life cycle as the thread. The virtual machine stack describes the memory model that Java executes: Each method is executed to create a stack frame for storing local variable tables, operations stacks, dynamic links, method exits, and so on. Each method is called until the completion of the process, corresponding to a virtual machine stack from the stack into the stack process.
The local variable table holds the various basic data types (boolean,byte,char,short,int,long,double), the object reference (reference type, which is different from the object itself, according to the different virtual machine implementations. It may be a reference pointer to the start address of an object, or it may point to a handle to a Table object or other location associated with the object, and the ReturnAddress type (the address of a self-directed instruction).
Where 64-bit long and double-type data consumes 2 local variable spaces (slots), the rest of the data types occupy only one, and the memory space required by the local variable table is allocated between the compilers, and when a method is entered, This method requires that the local variable space allocated in the frame is fully deterministic and does not change the size of the local variable table while the method is running.
In the Java Virtual Machine specification, there are two exceptions to this area: if the thread requests a stack depth greater than the virtual machine allows, the STACKOVERFLOWERROR exception will be thrown, and if the virtual machine stack can be dynamically extended (most of the current Java virtual machines can be dynamically extended, However, a fixed-length virtual machine stack is also allowed in the Java Virtual Machine specification, which throws a Outofmemorryerror exception when the extension fails to request enough memory.
Java Virtual Machine stack