JVM Specification 第二天(Frame)
来源:互联网 发布:淘宝产品增加人气 编辑:程序博客网 时间:2024/05/11 03:24
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 of the thread creating the frame. Each frame has its own array of local variables , its own operand stack (§2.6.2), and a reference to the runtime constant pool of the class of the current method
1. Local variables
Each frame contains an array of variables known as its local variables.
A single local variable can hold a value of type boolean, byte, char, short, int, float, reference, or returnAddress. A pair of local variables can hold a value of type longor double.
2.Operand Stacks
Each frame (§2.6) 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
The operand stack is empty when the frame that contains it is created. The Java virtual machine supplies instructions to load constants or values from local variables or fields onto the operand stack. Other Java virtual machine instructions take operands from the operand stack, operate on them, and push the result back onto the operand stack. The operand stack is also used to prepare parameters to be passed to methods and to receive method results.
For example, the iaddinstruction (§iadd) adds two intvalues together. It requires that the intvalues to be added be the top two values of the operand stack, pushed there by previous instructions. Both of the intvalues are popped from the operand stack. They are added, and their sum is pushed back onto the operand stack. Subcomputations may be nested on the operand stack, resulting in values that can be used by the encompassing computation.
3.Dynamic Linking
Each frame (§2.6) contains a reference to the runtime constant pool (§2.5.5) for the type of the current method to support dynamic linkingof the method code.
The classfile code for a method refers to methods to be invoked and variables to be accessed via symbolic references. Dynamic linking translates these symbolic method references into concrete method references, loading classes as necessary to resolve as-yet-undefined symbols, and translates variable accesses into appropriate offsets in storage structures associated with the runtime location of these variables.This late binding of the methods and variables makes changes in other classes that a method uses less likely to break this code.
Reference:http://blog.csdn.net/vernonzheng/article/details/8458483
- JVM Specification 第二天(Frame)
- JVM Specification
- JVM Specification 整体架构
- JVM Specification Reading 1
- JVM Specification Reading 2
- JVM specification对JVM内存的描述
- JVM specification对JVM内存的描述
- jvm中的帧frame
- JVM Specification(JVM规范)对JVM内存的描述
- Jvm Specification-Runtime Data Areas(1)
- Jvm Specification-Runtime Data Areas(2)
- 理解jvm中的帧frame
- JVM Specification 第一天(JVM数据类型&运行时数据区)
- JVM规范 java virtual machine specification 中文版扫描版
- 认识JVM--第二篇
- jvm虚拟机第二章
- jvm第二节-jvm参数设置和跟踪
- JVM---第二篇垃圾收集
- matlab矩阵中每一行数除以一个数
- poj 3278 Catch That Cow
- 学习笔记-NODE.JS, EXPRESS, JADE, AND MONGODB
- 23种设计模式详解
- iOS 纯代码适配iPhone6,6+
- JVM Specification 第二天(Frame)
- Android应用程序的签名
- mongo的表添加字段,并赋值保存
- Django中url的逆向解析 -> Reverse resolution of URLs
- Nginx 内存池(pool)分析
- SQL查询之限制结果集行数(分页)
- java中transient关键字简介
- Ubuntu系统中Qt连Postgresql的问题解决
- JVM Specification 第一天(JVM数据类型&运行时数据区)