翻译:JVM虚拟机规范1.7中的运行时常量池部分(三)
4.4.7. The CONSTANT_Utf8_info
Structure
The CONSTANT_Utf8_info
structure is used to represent constant string values:
代表常量字符串。
The items of the CONSTANT_Utf8_info
structure are as follows:
条目如下:
- tag
-
The
tag
item of theCONSTANT_Utf8_info
structure has the valueCONSTANT_Utf8
(1).tag值为
CONSTANT_Utf8
- length
-
The value of the
length
item gives the number of bytes in thebytes
array (not the length of the resulting string).bytes数组的长度
- bytes[]
-
The
bytes
array contains the bytes of the string.No byte may have the value
(byte)0
.No byte may lie in the range
(byte)0xf0
to(byte)0xff
.该数组包含字符串的字节。
不能包含0.
不能在
0xf0
到(byte)0xff
.范围内
String content is encoded in modified UTF-8. Modified UTF-8 strings are encoded so that code point sequences that contain only non-null ASCII characters can be represented using only 1 byte per code point, but all code points in the Unicode codespace can be represented. Modified UTF-8 strings are not null-terminated. The encoding is as follows:
翻译:字符串内容以修改后的UTF-8编码。修改版UTF-8编码后,仅包含非空ASCII字符的码点序列能够用(每个码点一个1字节)来标识,但是所有的Unicode代码段中的码点能够被标识。
- Code points in the range '
\u0001
' to '\u007F
' are represented by a single byte:
The 7 bits of data in the byte give the value of the code point represented.
翻译:'\u0001
' to '\u007F
' 用单字节标识
- The null code point ('
\u0000
') and code points in the range '\u0080
' to '\u07FF
' are represented by a pair of bytesx
andy
:
The two bytes represent the code point with the value:
翻译:空码点('\u0000
') 和 '\u0080
' to '\u07FF
' 范围内的可以用x和y来标识,然后通过上面的公式代入x和y的值来算出码点。(类似于2字节编码的那部分UTF-8)
Code points in the range '
\u0800
' to '\uFFFF
' are represented by 3 bytesx
,y
, andz
:
翻译: '\u0800
' to '\uFFFF
' 用三字节编码,用x、y、z三字节来编码。
- Characters with code points above U+FFFF (so-called supplementary characters) are represented by separately encoding the two surrogate code units of their UTF-16 representation. Each of the surrogate code units is represented by three bytes. This means supplementary characters are represented by six bytes,
u
,v
,w
,x
,y
, andz
:
The bytes of multibyte characters are stored in the class
file in big-endian (high byte first) order.
There are two differences between this format and the "standard" UTF-8 format. First, the null character (char)0
is encoded using the 2-byte format rather than the 1-byte format, so that modified UTF-8 strings never have embedded nulls. Second, only the 1-byte, 2-byte, and 3-byte formats of standard UTF-8 are used. The Java Virtual Machine does not recognize the four-byte format of standard UTF-8; it uses its own two-times-three-byte format instead.
For more information regarding the standard UTF-8 format, see Section 3.9 Unicode Encoding Forms of The Unicode Standard, Version 6.0.0.
翻译:6字节编码?多字符的字节存储在class文件中,大端序。
该编码和标准utf-8有两个差别。第一,空字符0用了2字节编码而不是1字节,因此修改后的UTF8字符串没有null值。第二,标准utf8中1,2,3字节格式的编码被支持。java虚拟机不识别4字节的编码;因此使用了6字节格式代替。
4.4.8. The CONSTANT_MethodHandle_info
Structure
The CONSTANT_MethodHandle_info
structure is used to represent a method handle:
The items of the CONSTANT_MethodHandle_info
structure are the following:
- tag
-
The
tag
item of theCONSTANT_MethodHandle_info
structure has the valueCONSTANT_MethodHandle
(15).值为CONSTANT_MethodHandle
- reference_kind
-
The value of the
reference_kind
item must be in the range 1 to 9. The value denotes the kind of this method handle, which characterizes its bytecode behavior (§5.4.3.5).值必须为1-9.它的值标识了这个方法处理的类型?
- reference_index
-
The value of the
reference_index
item must be a valid index into theconstant_pool
table. Theconstant_pool
entry at that index must be as follows:If the value of the
reference_kind
item is 1 (REF_getField
), 2 (REF_getStatic
), 3 (REF_putField
), or 4 (REF_putStatic
), then theconstant_pool
entry at that index must be aCONSTANT_Fieldref_info
(§4.4.2) structure representing a field for which a method handle is to be created.If the value of the
reference_kind
item is 5 (REF_invokeVirtual
) or 8 (REF_newInvokeSpecial
), then theconstant_pool
entry at that index must be aCONSTANT_Methodref_info
structure (§4.4.2) representing a class's method or constructor (§2.9) for which a method handle is to be created.If the value of the
reference_kind
item is 6 (REF_invokeStatic
) or 7 (REF_invokeSpecial
), then if theclass
file version number is less than 52.0, theconstant_pool
entry at that index must be aCONSTANT_Methodref_info
structure representing a class's method for which a method handle is to be created; if theclass
file version number is 52.0 or above, theconstant_pool
entry at that index must be either aCONSTANT_Methodref_info
structure or aCONSTANT_InterfaceMethodref_info
structure (§4.4.2) representing a class's or interface's method for which a method handle is to be created.If the value of the
reference_kind
item is 9 (REF_invokeInterface
), then theconstant_pool
entry at that index must be aCONSTANT_InterfaceMethodref_info
structure representing an interface's method for which a method handle is to be created.
If the value of the
reference_kind
item is 5 (REF_invokeVirtual
), 6 (REF_invokeStatic
), 7 (REF_invokeSpecial
), or 9 (REF_invokeInterface
), the name of the method represented by aCONSTANT_Methodref_info
structure or aCONSTANT_InterfaceMethodref_info
structure must not be<init>
or<clinit>
.If the value is 8 (
REF_newInvokeSpecial
), the name of the method represented by aCONSTANT_Methodref_info
structure must be<init>
.
翻译:reference_index
值必须是有效索引。指向的值可以是如下:
如果reference_kind
是1(REF_getField), 2 (REF_getStatic
), 3 (REF_putField
), or 4 (REF_putStatic
), 那么值必须为CONSTANT_Fieldref_info,代表一个将要为方法handle创建的域
如果 reference_kind
item是 5 (REF_invokeVirtual
) 或者8 (REF_newInvokeSpecial
),那么值为CONSTANT_Methodref_info
,代表一个类的方法或者构造函数
如果 reference_kind
item 是6 (REF_invokeStatic
) 或者7 (REF_invokeSpecial
), 那么class文件的版本号小于52.0,值为CONSTANT_Methodref_info
,代表一个类的方法;如果版本号大于52,那么要么是一个CONSTANT_Methodref_info
,要么 是aCONSTANT_InterfaceMethodref_info
,代表一个类或者接口的方法。
如果 reference_kind
item 是9 (REF_invokeInterface
),那么值须为CONSTANT_InterfaceMethodref_info
,标识一个接口的方法。
4.4.9. The CONSTANT_MethodType_info
Structure
The CONSTANT_MethodType_info
structure is used to represent a method type:
代表一个方法类型
The items of the CONSTANT_MethodType_info
structure are as follows:
- tag
-
The
tag
item of theCONSTANT_MethodType_info
structure has the valueCONSTANT_MethodType
(16). - 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 method descriptor (§4.3.3).翻译:值须指向
CONSTANT_Utf8_info,标识一个方法描述符
4.4.10. The CONSTANT_InvokeDynamic_info
Structure
The CONSTANT_InvokeDynamic_info
structure is used by an invokedynamic instruction (§invokedynamic) to specify a bootstrap method, the dynamic invocation name, the argument and return types of the call, and optionally, a sequence of additional constants called static arguments to the bootstrap method.
翻译:被invokedynamic 使用,指定一个启动方法,或者动态调用名,参数和返回类型,静态参数(可选)
The items of the CONSTANT_InvokeDynamic_info
structure are as follows:
- tag
-
The
tag
item of theCONSTANT_InvokeDynamic_info
structure has the valueCONSTANT_InvokeDynamic
(18). - bootstrap_method_attr_index
-
The value of the
bootstrap_method_attr_index
item must be a valid index into thebootstrap_methods
array of the bootstrap method table (§4.7.23) of thisclass
file.须为本class文件中启动方法表的
bootstrap_methods数组
中有效索引 - name_and_type_index
-
The value of the
name_and_type_index
item must be a valid index into theconstant_pool
table. Theconstant_pool
entry at that index must be aCONSTANT_NameAndType_info
structure (§4.4.6) representing a method name and method descriptor (§4.3.3).必须为
CONSTANT_NameAndType_info
类型,代表一个方法名和方法描述符
翻译:JVM虚拟机规范1.7中的运行时常量池部分(三)的更多相关文章
- 翻译:JVM虚拟机规范1.7中的运行时常量池部分(二)
本篇为JVM虚拟机规范1.7中的运行时常量池部分系列的第二篇. 4.4.4. The CONSTANT_Integer_info and CONSTANT_Float_info Structures ...
- 翻译:JVM虚拟机规范1.7中的运行时常量池部分(一)
原文链接: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4 Java Virtual Machine i ...
- 类的加载,链接和初始化——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 ...
随机推荐
- SignalR Self Host+MVC等多端消息推送服务(1)
一.概述 由于项目需要,最近公司项目里有个模块功能,需要使用到即时获得审批通知:原本的设计方案是使用ajax对服务器进行定时轮询查询,刚刚开始数据量和使用量不大的时候还好,后来使用量的增加和系统中各种 ...
- 关于移动端的UI事件分类
1. click事件 单击事件,类似于PC端的click,但在移动端中,连续click的触发有200ms ~ 300ms的延迟 2. touch类事件 触摸事件,有touchstart touchmo ...
- ng-if ng-show ng-hide区别(面试题)
ng-if ng-show ng-hide区别 实现原理方面: ng-show/ng-hide是通过修改css样式方式控制元素显示与隐藏,对应的DOM元素会一直存在于当前页面中: 而ng-if根据表 ...
- linux截取字符串之sort、uniq、cut用法
sort命令是帮我们依据不同的数据类型进行排序 参 数: -b 忽略每行前面开始出的空格字符. -c 检查文件是否已经按照顺序排序. -f 排序时,忽略大小写字母. -M 将前 ...
- STL --> 高效使用STL
高效使用STL 仅仅是个选择的问题,都是STL,可能写出来的效率相差几倍: 熟悉以下条款,高效的使用STL: 一.当对象很大时,建立指针的容器而不是对象的容器 1)STL基于拷贝的方式的来工作,任 ...
- 简单爬虫 -- 以爬取NASA AOD数据(TIFF文件)为例
目录: 网站分析 爬取下载链接 爬取TIFF图片 1.网站分析 主页面:https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MYDAL2_M_AER_OD ...
- JS图片更换还原操作,通过图片识别标识
//图片更换还原操作,图片识别标识 如图片img.png 可换成 img2.png function img_biaoshi(caozuo,img_id, biaoshi) { var img_src ...
- [活动] 【奖品撩人】部落守卫者集结令·这一回同程SRC的安全由“我”守卫!
i春秋SRC部落联合同程SRC发布首届部落守卫者漏洞提交任务(代号G001)! 你准备好了吗! [部落守卫者集结令]拿巨额奖金?上白帽子排行榜?近距离膜拜大佬?学技术?掌握窍门?又或者你是个责任感爆棚 ...
- python全栈学习--day4
列表 说明:列表是python中的基础数据类型之一,它是以[]括起来,每个元素以逗号隔开,而且他里面可以存放各种数据类型比如: 1 li = ['alex',123,Ture,(1,2,3,'wu ...
- 《构建之法》教学笔记——Python中的效能分析与几个问题
<构建之法:现代软件工程>中第2章对效能分析进行了介绍,基于的工具是VSTS.由于我教授的学生中只有部分同学选修了C#,若采用书中例子讲解,学生可能理解起来比较困难.不过所有这些学生都学习 ...