- 浏览: 352353 次
- 性别:
- 来自: 南京
博客专栏
-
设计模式那些事儿
浏览量:5772
文章分类
- 全部博客 (85)
- news (3)
- java面试题 (3)
- java基础 (2)
- 英语短文 (2)
- 英语演讲 (2)
- Weekly Address (5)
- 英语写作 (2)
- 转载 (1)
- 2010 FIFA World Cup (5)
- Scrum (1)
- 计算机基础 (2)
- java引用对象 (1)
- 英语阅读 (1)
- Ext (6)
- Javascript (3)
- Web编程 (4)
- 战国策 (7)
- html (1)
- java (33)
- concurrency (1)
- jvm (31)
- 方法区 (9)
- 栈 (5)
- 堆 (1)
- 程序计数器 (1)
- 本地方法栈 (1)
- class file (5)
- 常量池 (2)
- attributes (1)
- 连接模型 (1)
- applet (1)
- gc (5)
- 垃圾收集 (5)
- 方法调用 (2)
- IBM (0)
- 门户(Portal) (0)
- Solr (1)
- Lucene (1)
- 全文检索 (1)
- 设计模式 (4)
- 责任链模式 (1)
- 责任链 (1)
- COR (1)
- Pattern (1)
最新评论
-
Nabulio:
是不错的
Java的Integer与int互转 -
shihengli2010:
学习了 !Integer i = 100; Integer ...
Java的Integer与int互转 -
flex涵:
还可以,差不多就是这个意思.
Java的Integer与int互转 -
lijingshou:
相当好用。。。
输入年月日格式yyyyMMdd,判断是否是周末 -
denverj:
你好,是这本书的英文版,名字叫<Inside the J ...
JVM学习笔记-帧数据区(Frame Data)
In addition to the local variables and operand stack, the Java stack frame includes data to support constant pool resolution, normal method return, and exception dispatch. This data is stored in the frame data portion of the Java stack frame.
除了局部变量区和操作数栈外,Java栈帧还需要一些数据来支持常量池解析、正常方法返回以及异常派发机制。这些信息都保存在Java栈帧的帧数据区中。
Many instructions in the Java Virtual Machine’s instruction set refer to entries in the constant pool. Some instructions merely push constant values of type int, long, float, double, or String from the constant pool onto the operand stack. Some instructions use constant pool entries to refer to classes or arrays to instantiate, fields to access, or methods to invoke. Other instructions determine whether a particular object is a descendant of a particular class or interface specified by a constant pool entry.
Java虚拟机中的大多数指令都涉及到常量池入口。有些指令仅仅是从常量池中取出数据然后压入Java栈(这些数据的类型包括int,long、float、double和String);还有些指令使用常量池的数据来指示要实例化的类或数组,要访问的字段,或要调用的方法;还有些指令需要常量池中的数据才能确定某个对象是否属于某个类或实现了某个接口。
Whenever the Java Virtual Machine encounters any of the instructions that refer to an entry in the constant pool, it uses the frame dataís pointer to the constant pool to access that information. As mentioned earlier, references to types, fields, and methods in the constant pool are initially symbolic. When the virtual machine looks up a constant pool entry that refers to a class, interface, field, or method, that reference may still be symbolic. If so, the virtual machine must resolve the reference at that time.
每当虚拟机要执行某个需要用到常量池数据的指令时,它都会通过帧数据区中指向常量池的指针来访问它。以前讲过,常量池中对类型、字段和方法的引用在开始时都是符号。当虚拟机在常量池中搜索的时候,如果遇到指向类、接口、字段或者方法的入口,假若它们仍然是符号,虚拟机那时才会(也必须)进行解析。
Aside from constant pool resolution, the frame data must assist the virtual machine in processing a normal or abrupt method completion. If a method completes normally (by returning), the virtual machine must restore the stack frame of the invoking method. It must set the pc register to point to the instruction in the invoking method that follows the instruction that invoked the completing method. If the completing method returns a value, the virtual machine must push that value onto the operand stack of the invoking method.
除了用于常量池的解析外,帧数据区还要帮助虚拟机处理Java方法的正常结束或异常中止。如果是通过return正常结束,虚拟机必须恢复发起调用的方法的栈帧,包括设置PC寄存器指向发起调用的方法中的指令——即紧跟着调用了完成方法的指令的下一个指令。假如方法有返回值,虚拟机必须将它压入到发起调用的方法的操作数栈。
The frame data must also contain some kind of reference to the method’s exception table, which the virtual machine uses to process any exceptions thrown during the course of execution of the method. An exception table, which is described in detail in Chapter 17, "Exceptions," defines ranges within the bytecodes of a method that are protected by catch clauses. Each entry in an exception table gives a starting and ending position of the range protected by a catch clause, an index into the constant pool that gives the exception class being caught, and a starting position of the catch clauseís code.
为了处理Java方法执行期间的异常退出情况,帧数据区还必须保存一个对此方法异常表的引用。异常表定义了在这个方法的字节码中受catch子句保护的范围,异常表中的每一项都有一个被catch子句保护的代码的起始和结束位置(译者注:即try子句内部的代码),可能被catch的异常类在常量池中的索引值,以及catch子句内的代码开始的位置。
When a method throws an exception, the Java Virtual Machine uses the exception table referred to by the frame data to determine how to handle the exception. If the virtual machine finds a matching catch clause in the method’s exception table, it transfers control to the beginning of that catch clause. If the virtual machine doesnít find a matching catch clause, the method completes abnormally. The virtual machine uses the information in the frame data to restore the invoking methodís frame. It then rethrows the same exception in the context of the invoking method.
当某个方法抛出异常时,虚拟机根据帧数据区对应的异常表来决定如何处理。如果在异常表中找到了匹配的catch子句,就会把控制权转交给catch子句内的代码。如果没有发现,方法会立即异常中止。然后虚拟机使用帧数据区的信息回复发起调用的方法的帧,然后在发起调用的方法的上下文中重新抛出同样的异常。
In addition to data to support constant pool resolution, normal method return, and exception dispatch, the stack frame may also include other information that is implementation dependent, such as data to support debugging.
除了上述信息(支持常量池解析、正常方法返回和异常派发的数据)外,虚拟机的实现者也可以将其他信息放入帧数据区,如用于调试的数据等。
评论
发表评论
-
java书籍
2011-12-15 15:31 0线程 Java Concurrency in Pra ... -
JVM学习笔记-本地方法调用(Invoking a Native Method)
2011-11-25 11:56 1157Invoking a Native Method ... -
JVM学习笔记-调用Java方法(Invoking a Java Method)
2011-11-25 11:35 1513Invoking a Java Method As m ... -
JVM学习笔记-分代收集器(Generational Collectors)
2011-11-23 14:41 1923Generational Collectors ... -
JVM学习笔记-拷贝收集器(Copying Collectors)
2011-11-22 16:34 1603Copying Collectors Copy ... -
JVM学习笔记-压缩收集器(Compacting Collectors)
2011-11-22 16:17 1324Compacting Collectors G ... -
JVM学习笔记-跟踪收集器(Tracing Collectors)
2011-11-22 16:04 1910Tracing Collectors Trac ... -
JVM学习笔记-引用计数收集器(Reference Counting Collectors)
2011-11-22 15:46 2489Reference Counting Collect ... -
applet notinited的解决方案
2011-11-13 14:45 4519最近项目当中正好使用到了applet,这个很少接触过的东东。 ... -
JVM学习笔记-动态连接和解析(Dynamic Linking and Resolution)
2011-11-08 11:09 3435When you compile a Java pro ... -
JVM学习笔记-属性格式(Attributes Types)
2011-11-07 12:15 1483Attributes The Java Vir ... -
JVM学习笔记-属性(Attributes)
2011-11-07 12:03 1514Attributes As mentioned ... -
JVM学习笔记-方法(Methods)
2011-11-07 11:25 2221Methods Each method dec ... -
JVM学习笔记-字段(Fields)
2011-11-07 11:17 1909Each field (class variable a ... -
JVM学习笔记-特殊字符串(Special Strings)
2011-11-05 14:33 1668Special Strings 特殊字符串 T ... -
JVM学习笔记-Class文件(Class File)
2011-11-05 14:39 1590What is a Java Class Fi ... -
JVM学习笔记-本地方法栈(Native Method Stacks)
2011-11-02 10:16 19182本地方法栈(Native Me ... -
JVM学习笔记-操作数栈(Operand Stack)
2011-10-27 11:12 14084Like the local variables, th ... -
JVM学习笔记-局部变量区(Local Variables)
2011-10-27 10:42 2992The local variables secti ... -
JVM学习笔记-栈帧(The Stack Frame)
2011-10-27 10:35 2518The stack frame has three pa ...
相关推荐
jvm 调优笔记-jvm
Moonbox(月光宝盒)是一个无侵入的线上流量录制 和流量回放平台,沿用了jvm-sandbox-repeater的SPI设计,并提供了大量的常用插件,同时也提供数据统计和存储能力。通过Moonbox可以实现自动化测试、线上问题追踪、和...
nginx-upstream-jvm-route 支持nginx版本1.15 解决nginx: [emerg] invalid parameter "srun_id=tomcat1" 问题
JVM调优总结 -Xms -Xmx -Xmn -Xss
赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...
JVM性学习笔记-基本原理,内存模型,JVM参数设置,类加载器原理,JDK自带工具
赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...
jvm-full-gc调优-jvm-full-gc
nginx-upstream-jvm-route-0.1.tar.gz 用来实现Nginx Tomcat 集群session复制的问题!
mini-jvm in rust实现jvm,jvm-rs-main.zip
代码如下:failed to create jvm error code -4 这一般应是内存不够用所致,解决方法参考如下。 打开 Android Studio 安装目录下的bin目录,查找并打开文件 studio.exe.vmoptions,修改代码: 代码如下:-Xmx512m 为...
JVM调优总结 -Xms -Xmx -Xmn -Xss JVM调优总结 -Xms -Xmx -Xmn -Xss
一份JVM学习的笔记,含查看JVM运行时信息\JVM垃圾收集信息\JVM锁信息等
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 < /path/to/this/directory/jvm_route.patch # ./configure -...
JVM,MIB,可通过SNMP协议监控JVM运行情况
Java分布式应用学习笔记-谈JVM
JVM规范--高手总结 Java相关 1 1.1Java定义 1 1.2Java的开发流程 1 1.3Java运行的原理 2 1.4半编译半解释 3 1.5平台无关性 4 JVM内存模型 4 2.1 JVM规范 5 2.2 Sun JVM 8 2.3 SUN JVM内存管理(优化) 10 2.4 SUN JVM...
jvm性能调优-jvm内存模型和优化-performance-jvm-memorymodel-optimize
java之jvm学习笔记十一(访问控制器)-源码
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装