翻译:JVM虚拟机规范1.7中的运行时常量池部分(二)
本篇为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 theCONSTANT_Integer_info
structure has the valueCONSTANT_Integer
(3).The
tag
item of theCONSTANT_Float_info
structure has the valueCONSTANT_Float
(4).类型分别必须为
CONSTANT_Integer和
CONSTANT_Float
- bytes
-
The
bytes
item of theCONSTANT_Integer_info
structure represents the value of theint
constant. The bytes of the value are stored in big-endian (high byte first) order.The
bytes
item of theCONSTANT_Float_info
structure represents the value of thefloat
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 anint
constant bits. Then:If bits is
0x7f800000
, thefloat
value will be positive infinity.If bits is
0xff800000
, thefloat
value will be negative infinity.If bits is in the range
0x7f800001
through0x7fffffff
or in the range0xff800001
through0xffffffff
, thefloat
value will be NaN.
In all other cases, let s
, e
, 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 theCONSTANT_NameAndType_info
structure has the valueCONSTANT_NameAndType
(12).tag值为
CONSTANT_NameAndType
- name_index
-
The value of the
name_index
item must be a valid index into theconstant_pool
table. Theconstant_pool
entry at that index must be aCONSTANT_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 theconstant_pool
table. Theconstant_pool
entry at that index must be aCONSTANT_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中的运行时常量池部分(二)的更多相关文章
- 翻译:JVM虚拟机规范1.7中的运行时常量池部分(一)
原文链接: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4 Java Virtual Machine i ...
- 翻译:JVM虚拟机规范1.7中的运行时常量池部分(三)
4.4.7. The CONSTANT_Utf8_info Structure The CONSTANT_Utf8_info structure is used to represent consta ...
- 类的加载,链接和初始化——1运行时常量池(来自于java虚拟机规范英文版本+本人的翻译和理解)
加载(loading):通过一个特定的名字,找到类或接口的二进制表示,并通过这个二进制表示创建一个类或接口的过程. 链接:是获取类或接口并把它结合到JVM的运行时状态中,以让类或接口可以被执行 初始化 ...
- 深入理解JVM虚拟机:(一)Java运行时数据区域
概述 JVM是Java语言的精髓所在,因为它Java语言实现了跨平台运行,以及自动内存管理机制等,本文将从概念上介绍JVM内存的各个区域,说明个区域的作用. JVM运行时数据区模型 Java虚拟机在执 ...
- JVM笔记3-java内存区域之运行时常量池
1.运行时常量池属于线程共享区中的方法区. 2.运行时常量池用于编译期生成的各种自变量,符号引用,这部分内用将在类加载后接入方法区的运行时常量池中存放. 看如下代码所示,如图: public clas ...
- 对JVM运行时常量池的一些理解
1.JVM运行时常量池在内存的方法区中(在jdk8中,移除了方法区) 2.JVM运行时常量池中的内容主要是从各个类型的class文件的常量池中获取,对于字符串常量,可以调用intern方法人为添加,而 ...
- JVM详解之:运行时常量池
目录 简介 class文件中的常量池 运行时常量池 静态常量详解 String常量 数字常量 符号引用详解 String Pool字符串常量池 总结 简介 JVM在运行的时候会对class文件进行加载 ...
- 运行时常量池中的符号引用/String.intern() /ldc指令
运行时常量池,之前放在方法区(永久代)中,1.8之后被转移到元空间,放到了native memory中. 具体的数据结构是:(看对象的内存布局,句柄访问还是对象头中保存指向类的元数据的指针,这里以对象 ...
- JVM 常量池、运行时常量池、字符串常量池
常量池: 即class文件常量池,是class文件的一部分,用于保存编译时确定的数据. 保存的内容如下图: D:\java\test\out\production\test>javap -ver ...
随机推荐
- TCP 连接关闭及TIME_WAIT探究
这里主要记录一下TCP连接在关闭的时刻,有哪些细节问题.方便在以后的程序设计中能够注意这些细节, 以避免出现这些错误.首先我们来看一下TCP的状态转换图.如<unix网络编程>卷一所示如下 ...
- 关于移动端的UI事件分类
1. click事件 单击事件,类似于PC端的click,但在移动端中,连续click的触发有200ms ~ 300ms的延迟 2. touch类事件 触摸事件,有touchstart touchmo ...
- angularJS前台传list数组,后台springMVC接收数组
有时候需要在前台自定义对象,然后把对象封装在list中,在传送到后台,这样的思想也比较合理 1. 前台代码 $scope.saveScore = function () { $scope.userSc ...
- [SCOI2010] 连续攻击问题
题目 Description lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示.当他使用某种装备时,他只能使用该装备的某一 ...
- reinterpret_cast,static_cast, dynamic_cast,const_cast的运用分析
reinterpret_cast(重新解释类型转换) reinterpret_cast 最famous的特性就是什么都可以,转换任意的类型,包括C++所有通用类型,所以也最不安全 应用 整形和指针之间 ...
- 【眼见为实】自己动手实践理解REPEATABLE READ && Next-Key Lock
首先设置数据库隔离级别为可重复读(REPEATABLE READ): set global transaction isolation level REPEATABLE READ ; set sess ...
- 小白学PYTHON时最容易犯的6个错误,看看你遇到过几个
最近又在跟之前的同学一起学习python,一起进步,发现很多测试同学在初学python的时候很容易犯一些错误,特意总结了一下.其实这些错误不仅是在学python时会碰到,在学习其他语言的时候也同样会碰 ...
- Ios 若干兼容处理
最后处理兼容真是各种苦逼,还算好,最后解决了,再此总结一下 position:fixed 和 input 的问题? ios 对position:fixed 的定位处理兼容性不是很好,例如,在同时又in ...
- 微信公众平台开发,图文回复、access_token生成调用、以及微信SDK的实现(2)
上一节课,我给大家分享了微信API接入以及事件推送的回复,这是微信开发的第二节课,重点给说一说单图文回复,多图文回复,access_token,微信SDK. 公众号消息回复很多种形式,常见的形式有,文 ...
- Python 自学 之 String 常见操作
这是在Python 3.5.3版本下测试的.# Author Taylor_Manitoname ="my name is alex"#capitalized 大写的print(& ...