本篇为JVM虚拟机规范1.7中的运行时常量池部分系列的第二篇。

4.4.4. The CONSTANT_Integer_info and CONSTANT_Float_info Structures

The CONSTANT_Integer_info and CONSTANT_Float_info structures represent 4-byte numeric (int and float) constants:

代表4字节的数字常量,如int和float:

The items of these structures are as follows:

tag

The tag item of the CONSTANT_Integer_info structure has the value CONSTANT_Integer (3).

The tag item of the CONSTANT_Float_info structure has the value CONSTANT_Float (4).

类型分别必须为CONSTANT_Integer和CONSTANT_Float

bytes

The bytes item of the CONSTANT_Integer_info structure represents the value of the int constant. The bytes of the value are stored in big-endian (high byte first) order.

The bytes item of the CONSTANT_Float_info structure represents the value of the float constant in IEEE 754 floating-point single format (§2.3.2). The bytes of the single format representation are stored in big-endian (high byte first) order.

The value represented by the CONSTANT_Float_info structure is determined as follows. The bytes of the value are first converted into an int constant bits. Then:

  • If bits is 0x7f800000, the float value will be positive infinity.

  • If bits is 0xff800000, the float value will be negative infinity.

  • If bits is in the range 0x7f800001 through 0x7fffffff or in the range 0xff800001 through 0xffffffff, the float value will be NaN.

       In all other cases, let se, and m be three values that might be computed from bits:

      

    bytes在CONSTANT_Integer_info 中代表int常量的值。大端序(高字节在前)存储

    bytes在CONSTANT_Float_info 中代表以IEEE 754 浮点数格式存储的float常量。大端序存储。

CONSTANT_Float_info结构体的内容按照如下规则。bytes的值首先被转换为int常量比特,然后:

    如果bits是0x7f800000,那么浮点值为正无穷。

    如果bits是0xff800000,那么浮点值为负无穷。

     如果bits是在0x7f800001 到0x7fffffff或者0xff800001到0xffffffff,值为NaN。

    其他情况,参考上图算出s,e,m,则值为 s · m · 2e-150.

4.4.5. The CONSTANT_Long_info and CONSTANT_Double_info Structures

看看它的存储结构体:

其余和int和float差不多,只是变成了两个4字节来存储。

4.4.6. The CONSTANT_NameAndType_info Structure

The CONSTANT_NameAndType_info structure is used to represent a field or method, without indicating which class or interface type it belongs to:

  代表一个字段或者方法,没标识属于哪个类或者接口:

The items of the CONSTANT_NameAndType_info structure are as follows:

条目如下:

tag

The tag item of the CONSTANT_NameAndType_info structure has the value CONSTANT_NameAndType (12).

tag值为CONSTANT_NameAndType

name_index

The value of the name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure (§4.4.7) representing either the special method name <init> (§2.9) or a valid unqualified name denoting a field or method (§4.2.2).

name_index项必须为有效索引项。必须指向CONSTANT_Utf8_info 结构体,代表特殊方法名,如<init>或者一个有效的相对名标识字段或方法。

descriptor_index

The value of the descriptor_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure (§4.4.7) representing a valid field descriptor or method descriptor (§4.3.2§4.3.3).

   值必须为有效索引。必须指向CONSTANT_Utf8_info ,代表有效的字段描述符或者方法描述符。(应该是一个域前面的那些:private,static,final之类的修饰符吧)

翻译:JVM虚拟机规范1.7中的运行时常量池部分(二)的更多相关文章

  1. 翻译:JVM虚拟机规范1.7中的运行时常量池部分(一)

    原文链接: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4 Java Virtual Machine i ...

  2. 翻译:JVM虚拟机规范1.7中的运行时常量池部分(三)

    4.4.7. The CONSTANT_Utf8_info Structure The CONSTANT_Utf8_info structure is used to represent consta ...

  3. 类的加载,链接和初始化——1运行时常量池(来自于java虚拟机规范英文版本+本人的翻译和理解)

    加载(loading):通过一个特定的名字,找到类或接口的二进制表示,并通过这个二进制表示创建一个类或接口的过程. 链接:是获取类或接口并把它结合到JVM的运行时状态中,以让类或接口可以被执行 初始化 ...

  4. 深入理解JVM虚拟机:(一)Java运行时数据区域

    概述 JVM是Java语言的精髓所在,因为它Java语言实现了跨平台运行,以及自动内存管理机制等,本文将从概念上介绍JVM内存的各个区域,说明个区域的作用. JVM运行时数据区模型 Java虚拟机在执 ...

  5. JVM笔记3-java内存区域之运行时常量池

    1.运行时常量池属于线程共享区中的方法区. 2.运行时常量池用于编译期生成的各种自变量,符号引用,这部分内用将在类加载后接入方法区的运行时常量池中存放. 看如下代码所示,如图: public clas ...

  6. 对JVM运行时常量池的一些理解

    1.JVM运行时常量池在内存的方法区中(在jdk8中,移除了方法区) 2.JVM运行时常量池中的内容主要是从各个类型的class文件的常量池中获取,对于字符串常量,可以调用intern方法人为添加,而 ...

  7. JVM详解之:运行时常量池

    目录 简介 class文件中的常量池 运行时常量池 静态常量详解 String常量 数字常量 符号引用详解 String Pool字符串常量池 总结 简介 JVM在运行的时候会对class文件进行加载 ...

  8. 运行时常量池中的符号引用/String.intern() /ldc指令

    运行时常量池,之前放在方法区(永久代)中,1.8之后被转移到元空间,放到了native memory中. 具体的数据结构是:(看对象的内存布局,句柄访问还是对象头中保存指向类的元数据的指针,这里以对象 ...

  9. JVM 常量池、运行时常量池、字符串常量池

    常量池: 即class文件常量池,是class文件的一部分,用于保存编译时确定的数据. 保存的内容如下图: D:\java\test\out\production\test>javap -ver ...

随机推荐

  1. Numpy库的下载及安装(吐血总结)

    Python很火,我也下了个来耍耍一阵子.可是渐渐地,我已经不满足于它的基本库了,我把目光转到了Numpy~~~~~ 然而想法总是比现实容易,因为我之前下的是Python3.3.x,所有没有自带pip ...

  2. python web开发-flask中response,cookies,session对象使用详解

    Response响应对象: 当一个web请求被服务器处理完后,会返回用户请求的响应,这时候就要用到响应对象,根据响应给用户的形式不同,响应对象有以下几种处理方式 如果返回的是一个合法的响应对象,它会从 ...

  3. SpringBoot快速开发REST服务最佳实践

    一.为什么选择SpringBoot Spring Boot是由Pivotal团队提供的全新框架,被很多业内资深人士认为是可能改变游戏规则的新项目.早期我们搭建一个SSH或者Spring Web应用,需 ...

  4. 单元测试er——为什么真的真的要写单元测试

    优点 为什么很多技术或者知识要说优点?因为有些道理看着很简单,大家表面上都觉得对,但是做的时候又不去做或者做不到.其中有一个很重要原因是骨子里或者潜意识并没有真实觉得这是对的,一旦想去做的时候同时会冒 ...

  5. linux系统磁盘空间满了怎么办看完这篇文章之后就知道怎么解决了

    废话不多说直接上图 可以看得到 / 下面已使用100%,已经没有剩余空间可以使用了,上面跑的服务已经访问不了了. 接下来我就看看有没有垃圾文件可以清理的 du -sh * 由于这个机器比较特殊,上面有 ...

  6. JQuery操作option的添加、删除、取值

    1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkTex ...

  7. DEVC使用问题集锦

    一.DEVC++编译出现"Id return 1 exit status" 这是初学者刚用DEVC经常碰到问题,一般有如下解决方法: 1.首先检查下是否有c的exe程序开着,若开着 ...

  8. 从Firefox升级说学习方法

    今天早上,打开PortableAPPs时,它提示我升级FireFox,跟往常一样我没考虑就升级了. 打开Firefox 57神速,很是惊喜,打开后发现悲剧了,自己(通过下载插件)定制的功能都不能使用了 ...

  9. Alpha第七天

    Alpha第七天 听说 031502543 周龙荣(队长) 031502615 李家鹏 031502632 伍晨薇 031502637 张柽 031502639 郑秦 1.前言 任务分配是VV.ZQ. ...

  10. 【Alpha版本】冲刺阶段 - Day7 - 靠泊

    Alpha:指集成了主要功能的第一个试用版本.在这个版本中有些小功能并未实现.事实上很多软件的 Alpha 版本只是在内部使用.给外部用户使用的 Alpha 版本会起一个比较美妙的名字,例如,技术预览 ...