首页 技术 正文
技术 2022年11月16日
0 收藏 345 点赞 4,667 浏览 2806 个字

本篇为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:

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

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:

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

    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

看看它的存储结构体:

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

其余和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:

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

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

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之类的修饰符吧)

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,023
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,360
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,143
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,774
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,852