How many types of stack are there in a running JVM program?

the question is pretty obvious. As I am ready JVM specification I came across Java Stacks

"2.5.2 Java Virtual Machine Stacks"

Each Java Virtual Machine thread has a private Java Virtual Machine stack, created at the same time as the thread. A Java Virtual Machine stack stores frames (§2.6). A Java Virtual Machine stack is analogous to the stack of a conventional language such as C: it holds local variables and partial results, and plays a part in method invocation and return. Because the Java Virtual Machine stack is never manipulated directly except to push and pop frames, frames may be heap allocated. The memory for a Java Virtual Machine stack does not need to be contiguous.

So apart from thread stack is there any types of stacks that are used or that we can classify?


Some types of the stacks from the specification are:

1) Operand Stacks: Each frame contains a last-in-first-out (LIFO) stack known as its operand stack. The maximum depth of the operand stack of a frame is determined at compile-time and is supplied along with the code for the method associated with the frame.

2) Native Method Stacks: An implementation of the Java Virtual Machine may use conventional stacks, colloquially called "C stacks," to support native methods (methods written in a language other than the Java programming language). Native method stacks may also be used by the implementation of an interpreter for the Java Virtual Machine's instruction set in a language such as C. Java Virtual Machine implementations that cannot load native methods and that do not themselves rely on conventional stacks need not supply native method stacks. If supplied, native method stacks are typically allocated per thread when each thread is created.

3) Java Virtual Machine Stacks: you mentioned in the question.

链接地址: http://www.djcxy.com/p/82748.html

上一篇: 如何确定Hotspot VM的默认线程堆栈大小

下一篇: 正在运行的JVM程序中有多少种类型的堆栈?