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.
Fram
A frame is used to store data and partial results, as well as to perform dynamic
linking, return values for methods, and dispatch exceptions.
A new frame is created each time a method is invoked. A frame is destroyed when
its method invocation completes, whether that completion is normal or abrupt (it
throws an uncaught exception). Frames are allocated from the Java Virtual Machine
stack (§2.5.2) of the thread creating the frame. Each frame has its own array of
local variables (§2.6.1), its own operand stack (§2.6.2), and a reference to the run-
time constant pool (§2.5.5) of the class of the current method.
Heap
The Java Virtual Machine has a heap that is shared among all Java Virtual Machine
threads. The heap is the run-time data area from which memory for all class
instances and arrays is allocated.
Method Area
The Java Virtual Machine has a method area that is shared among all Java Virtual
Machine threads. The method area is analogous to the storage area for compiled
code of a conventional language or analogous to the "text" segment in an operating
system process. It stores per-class structures such as the run-time constant pool,
field and method data, and the code for methods and constructors, including
the special methods (§2.9) used in class and instance initialization and interface
initialization.
Run-Time Constant Pool
A run-time constant pool is a per-class or per-interface run-time representation
of the constant_pool table in a class file (§4.4). It contains several kinds of
constants, ranging from numeric literals known at compile-time to method and field
references that must be resolved at run-time. The run-time constant pool serves a
function similar to that of a symbol table for a conventional programming language,
although it contains a wider range of data than a typical symbol table.作者: 杜鹏飞 时间: 2013-4-14 20:31
现在同时考虑win32api和汇编语言.
jvm栈相当于.stack,frame相当于独立于方法的stack,动态分配内存都是从堆里取的(winos32apiheapalloc),
method area就是.code,run-time constant pool相当于.data作者: mvplee 时间: 2013-4-14 20:42
太没营养了!作者: 刘胜寒 时间: 2013-4-14 21:00
你能解释一下什么是数据结构吗??
你说的我怎么没看到数据结构的影子啊... 作者: 高新星 时间: 2013-4-14 21:21
可以看看这篇博客http://uule.iteye.com/blog/1417299作者: 王亚东 时间: 2013-4-14 21:43
用不着搞那么清楚,现在。分清栈和堆就可以了,栈里放变量和引用,堆里放对象,至于更细节的,学完基础再研究去吧,也就是增加点理解,对前期编程没啥影响。作者: 黄玉昆 时间: 2013-4-15 12:08
如果问题未解决,请继续追问,如果没有问题了,请将帖子分类 改为“已解决”,谢谢作者: itheima01 时间: 2013-4-15 22:02