这是用户在 2025-7-27 21:00 为 https://app.immersivetranslate.com/pdf-pro/0b060e8e-12f5-490e-a939-286702ede7f0/ 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Chapter 2. The Structure of the Java Virtual Machine
第二章。Java 虚拟机的结构

Prev  上一页

Table of Contents  目录

2.1. The class File Format
2.1. 类文件格式

2.2. Data Types   2.2. 数据类型
2.3. Primitive Types and Values
2.3. 基本类型和值

2.3.1. Integral Types and Values
2.3.1. 整数类型和值

2.3.2. Floating-Point Types, Value Sets, and Values
2.3.2. 浮点类型、值集和值

2.3.3. The returnAddress Type and Values 2.3.4. The boolean Type
2.3.3. returnAddress 类型和值 2.3.4. boolean 类型

2.4. Reference Types and Values
2.4. 引用类型和值

2.5. Run-Time Data Areas
2.5. 运行时数据区

2.5.1. The pc Register
2.5.1. pc 寄存器

2.5.2. Java Virtual Machine Stacks
2.5.2. Java 虚拟机栈

2.5.3. Heap  2.5.3. 堆
2.5.4. Method Area  2.5.4. 方法区
2.5.5. Run-Time Constant Pool
2.5.5. 运行时常量池

2.5.6. Native Method Stacks
2.5.6. 本地方法栈

2.6. Frames  2.6. 栈帧
2.6.1. Local Variables   2.6.1. 局部变量
2.6.2. Operand Stacks  2.6.2. 操作数栈
2.6.3. Dynamic Linking  2.6.3. 动态链接
2.6.4. Normal Method Invocation Completion
2.6.4. 正常方法调用完成

2.6.5. Abrupt Method Invocation Completion
2.6.5. 异常方法调用完成

2.7. Representation of Objects
2.7. 对象的表示

2.8. Floating-Point Arithmetic
2.8. 浮点运算

2.8.1. Java Virtual Machine Floating-Point
2.8.1. Java 虚拟机浮点运算
Arithmetic and IEEE 754  和 IEEE 754
2.8.2. Floating-Point Modes
2.8.2. 浮点模式

2.8.3. Value Set Conversion
2.8.3. 值集转换

2.9. Special Methods  2.9. 特殊方法
2.10. Exceptions   2.10. 异常
2.11. Instruction Set Summary
2.11. 指令集概览

2.11.1. Types and the Java Virtual Machine
2.11.1. 类型与 Java 虚拟机

2.11.2. Load and Store Instructions
2.11.2. 装载和存储指令

2.11.3. Arithmetic Instructions
2.11.3. 算术指令

2.11.4. Type Conversion Instructions
2.11.4. 类型转换指令

2.11.5. Object Creation and Manipulation
2.11.5. 对象创建和操作

2.11.6. Operand Stack Management Instructions
2.11.6. 操作数栈管理指令

2.11.7. Control Transfer Instructions
2.11.7. 控制转移指令

2.11.8. Method Invocation and Return Instructions
2.11.8. 方法调用和返回指令

2.11.9. Throwing Exceptions
2.11.9. 抛出异常

2.11.10. Synchronization
2.11.10. 同步

2.12. Class Libraries   2.12. 类库
2.13. Public Design, Private Implementation
2.13. 公共设计,私有实现

Chapter 2. The Structure of the Java Virtual Machine
第二章 Java 虚拟机结构

This document specifies an abstract machine. It does not describe any particular implementation of the Java Virtual Machine.
本文件指定了一台抽象机。它不描述 Java 虚拟机的任何特定实现。
To implement the Java Virtual Machine correctly, you need only be able to read the class file format and correctly perform the operations specified therein. Implementation details that are not part of the Java Virtual Machine’s specification would unnecessarily constrain the creativity of implementors. For example, the memory layout of run-time data areas, the garbage-collection algorithm used, and any internal optimization of the Java Virtual Machine instructions (for example, translating them into machine code) are left to the discretion of the implementor.
要正确实现 Java 虚拟机,您只需要能够读取类文件格式并正确执行其中指定的操作。Java 虚拟机规范之外的实施细节将不必要地限制实现者的创造力。例如,运行时数据区的内存布局、使用的垃圾收集算法以及 Java 虚拟机指令的任何内部优化(例如,将其转换为机器代码)都由实现者自行决定。
All references to Unicode in this specification are given with respect to The Unicode Standard, Version 6.0.0, available at http://www. unicode. org/.
本规范中所有对 Unicode 的引用都是相对于《Unicode 标准》,版本 6.0.0,可在 http://www.unicode.org/获取。

2.1. The class File Format
2.1. 类文件格式

Compiled code to be executed by the Java Virtual Machine is represented using a hardware- and operating systemindependent binary format, typically (but not necessarily) stored in a file, known as the class file format. The class file format precisely defines the representation of a class or interface, including details such as byte ordering that might be taken for granted in a platform-specific object file format.
Java 虚拟机执行的编译代码使用一种与硬件和操作系统无关的二进制格式表示,通常(但不一定)存储在称为类文件格式的文件中。类文件格式精确地定义了类或接口的表示,包括在特定平台的对象文件格式中可能被视为理所当然的细节,例如字节顺序。
Chapter 4, “The class File Format”, covers the class file format in detail.
第 4 章,“类文件格式”,详细介绍了类文件格式。

2.2. Data Types  2.2. 数据类型

Like the Java programming language, the Java Virtual Machine operates on two kinds of types: primitive types and reference types. There are, correspondingly, two kinds of values that can be stored in variables, passed as arguments, returned by methods, and operated upon: primitive values and reference values.
和 Java 编程语言一样,Java 虚拟机操作两种类型的类型:基本类型和引用类型。相应地,变量中可以存储两种类型的值,可以作为参数传递,由方法返回,并进行操作:基本值和引用值。
The Java Virtual Machine expects that nearly all type checking is done prior to run time, typically by a compiler, and does not have to be done by the Java Virtual Machine itself. Values of primitive types need not be tagged or otherwise be inspectable to determine their types at run time, or to be distinguished from values of reference types. Instead, the instruction set of the Java Virtual Machine distinguishes its operand types using instructions intended to operate on values of specific types. For instance, iadd, ladd, fadd, and dadd are all Java Virtual Machine instructions that add two numeric values and produce numeric results, but each is specialized for its operand type: int, long, float, and double, respectively. For a summary of type support in the Java Virtual Machine instruction set, see §2.11.1.
Java 虚拟机期望几乎所有类型检查都在运行时之前完成,通常由编译器完成,而不必由 Java 虚拟机本身完成。基本类型的值无需标记或以其他方式检查以确定其运行时类型,或与其引用类型的值区分开来。相反,Java 虚拟机的指令集使用旨在操作特定类型值的指令来区分其操作数类型。例如,iadd、ladd、fadd 和 dadd 都是 Java 虚拟机指令,它们将两个数值相加并产生数值结果,但每个指令都针对其操作数类型进行了专门化:int、long、float 和 double。有关 Java 虚拟机指令集中类型支持的总结,请参阅§2.11.1。
The Java Virtual Machine contains explicit support for objects. An object is either a dynamically allocated class instance or an array. A reference to an object is considered to have Java Virtual Machine type reference. Values of type reference can be thought of as pointers to objects. More than one reference to an object may exist. Objects are always operated on, passed, and tested via values of type reference.
Java 虚拟机包含对对象的明确支持。对象要么是动态分配的类实例,要么是数组。对象引用被认为是具有 Java 虚拟机类型引用。类型为引用的值可以被视为指向对象的指针。一个对象可以存在多个引用。对象总是通过类型为引用的值进行操作、传递和测试。

2.3. Primitive Types and Values
2.3. 基本类型和值

The primitive data types supported by the Java Virtual Machine are the numeric types, the boolean type (§ 2.3 .4 2.3 .4 _ 2.3.4_\underline{2.3 .4} ), and the returnAddress type (§2.3.3).
Java 虚拟机支持的基本数据类型包括数值类型、布尔类型(§ 2.3 .4 2.3 .4 _ 2.3.4_\underline{2.3 .4} )和返回地址类型(§2.3.3)。
The numeric types consist of the integral types (§2.3.1) and the floating-point types (§2.3.2).
数值类型包括整型(§2.3.1)和浮点类型(§2.3.2)。

The integral types are:
整型包括:
  • byte, whose values are 8 -bit signed two’s-complement integers, and whose default value is zero
    byte,其值为 8 位有符号二进制补码整数,默认值为零
  • short, whose values are 16-bit signed two’s-complement integers, and whose default value is zero
    short,其值为 16 位有符号二进制补码整数,默认值为零
  • int, whose values are 32-bit signed two’s-complement integers, and whose default value is zero
    int,其值为 32 位有符号二进制补码整数,默认值为零
  • long, whose values are 64-bit signed two’s-complement integers, and whose default value is zero
    long,其值为 64 位有符号二进制补码整数,默认值为零
  • char, whose values are 16 -bit unsigned integers representing Unicode code points in the Basic Multilingual Plane, encoded with UTF-16, and whose default value is the null code point (’ u 0000 u 0000 \\u 0000\backslash u 0000 ')
    char,其值为 16 位无符号整数,表示基本多语言平面的 Unicode 码点,使用 UTF-16 编码,默认值为空码点(' u 0000 u 0000 \\u 0000\backslash u 0000 ')
The floating-point types are:
浮点类型有:
  • float, whose values are elements of the float value set or, where supported, the float-extended-exponent value set, and whose default value is positive zero
    float,其值为 float 值集的元素,或在支持的情况下为 float-extended-exponent 值集的元素,默认值为正零
  • double, whose values are elements of the double value set or, where supported, the double-extended-exponent value set, and whose default value is positive zero
    double,其值是 double 值集的元素,或者在支持的情况下是 double-扩展指数值集的元素,其默认值为正零
The values of the boolean type encode the truth values true and false, and the default value is false.
boolean 类型的值编码了 true 和 false 这两个真值,其默认值为 false。
The First Edition of The Java® Virtual Machine Specification did not consider boolean to be a Java Virtual Machine type. However, boolean values do have limited support in the Java Virtual Machine. The Second Edition of The Java® Virtual Machine Specification clarified the issue by treating boolean as a type.
《Java® 虚拟机规范》第一版并未将 boolean 视为 Java 虚拟机类型。然而,boolean 值在 Java 虚拟机中确实有有限的支持。《Java® 虚拟机规范》第二版通过将 boolean 视为类型,澄清了这一问题。
The values of the returnAddress type are pointers to the opcodes of Java Virtual Machine instructions. Of the primitive types, only the returnAddress type is not directly associated with a Java programming language type.
returnAddress 类型的值是指向 Java 虚拟机指令操作码的指针。在原始类型中,只有 returnAddress 类型不直接与 Java 编程语言类型相关联。

2.3.1. Integral Types and Values
2.3.1. 整型类型和值

The values of the integral types of the Java Virtual Machine are:
Java 虚拟机的整型类型的值如下:
  • For byte, from -128 to 127 ( 2 7 127 2 7 127(-2^(7):}127\left(-2^{7}\right. to 2 7 1 ) 2 7 1 {:2^(7)-1)\left.2^{7}-1\right), inclusive
    对于 byte 类型,范围从 -128 到 127,包含 -128 和 127
  • For short, from -32768 to 32767 ( 2 15 32767 2 15 32767(-2^(15):}32767\left(-2^{15}\right. to 2 15 1 ) 2 15 1 {:2^(15)-1)\left.2^{15}-1\right), inclusive
    对于 short 类型,范围从 -32768 到 32767,包含 -32768 和 32767
  • For int, from -2147483648 to 2147483647 ( 2 31 2147483647 2 31 2147483647(-2^(31):}2147483647\left(-2^{31}\right. to 2 31 1 ) 2 31 1 {:2^(31)-1)\left.2^{31}-1\right), inclusive
    对于 int,范围从-2147483648 到 2147483647 ( 2 31 2147483647 2 31 2147483647(-2^(31):}2147483647\left(-2^{31}\right. 2 31 1 ) 2 31 1 {:2^(31)-1)\left.2^{31}-1\right) ,包含两端
  • For long, from -9223372036854775808 to 9223372036854775807 ( 2 63 9223372036854775807 2 63 9223372036854775807(-2^(63):}9223372036854775807\left(-2^{63}\right. to 2 63 1 ) 2 63 1 {:2^(63)-1)\left.2^{63}-1\right), inclusive
    对于 long,范围从-9223372036854775808 到 9223372036854775807 ( 2 63 9223372036854775807 2 63 9223372036854775807(-2^(63):}9223372036854775807\left(-2^{63}\right. 2 63 1 ) 2 63 1 {:2^(63)-1)\left.2^{63}-1\right) ,包含两端
  • For char, from 0 to 65535 inclusive
    对于 char,范围从 0 到 65535,包含两端

2.3.2. Floating-Point Types, Value Sets, and Values
2.3.2. 浮点类型、值集和值

The floating-point types are float and double, which are conceptually associated with the 32-bit single-precision and 64bit double-precision format IEEE 754 values and operations as specified in IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std. 754-1985, New York).
浮点类型包括 float 和 double,它们在概念上与 IEEE 754 标准中规定的 32 位单精度和 64 位双精度格式值和操作相关联,该标准由 IEEE 二进制浮点运算标准(ANSI/IEEE Std. 754-1985,纽约)指定。
The IEEE 754 standard includes not only positive and negative sign-magnitude numbers, but also positive and negative zeros, positive and negative infinities, and a special Not-a-Number value (hereafter abbreviated as “NaN”). The NaN value is used to represent the result of certain invalid operations such as dividing zero by zero.
IEEE 754 标准不仅包括正负符号幅度数,还包括正负零、正负无穷大以及一个特殊的非数字值(以下简称“NaN”)。NaN 值用于表示某些无效操作的结果,例如除以零的零。
Every implementation of the Java Virtual Machine is required to support two standard sets of floating-point values, called the float value set and the double value set. In addition, an implementation of the Java Virtual Machine may, at its option, support either or both of two extended-exponent floating-point value sets, called the float-extended-exponent value set and the double-extended-exponent value set. These extended-exponent value sets may, under certain circumstances, be used instead of the standard value sets to represent the values of type float or double.
Java 虚拟机的每个实现都必须支持两组标准的浮点值,称为 float 值集和 double 值集。此外,Java 虚拟机的实现可以选择支持其中之一或两者,称为 float 扩展指数值集和 double 扩展指数值集。在这些扩展指数值集在某些情况下可以代替标准值集来表示类型为 float 或 double 的值。
The finite nonzero values of any floating-point value set can all be expressed in the form s m 2 ( e N + 1 ) s m 2 ( e N + 1 ) s*m*2^((e-N+1))s \cdot m \cdot 2^{(e-N+1)}, where s s ss is +1 or 1 , m 1 , m -1,m-1, m is a positive integer less than 2 N 2 N 2N2 N, and e e ee is an integer between E min = ( 2 K 1 2 ) E min = 2 K 1 2 E_(min)=-(2^(K-1)-2)E_{\min }=-\left(2^{K-1}-2\right) and E max = 2 K 1 1 E max = 2 K 1 1 E_(max)=2^(K-1)-1E_{\max }=2^{K-1}-1, inclusive, and where N N NN and K K KK are parameters that depend on the value set. Some values can be represented in this form in more than one way; for example, supposing that a value v v vv in a value set might be represented in this form using certain values for s , m s , m s,ms, m, and e e ee, then if it happened that m m mm were even and e e ee were less than 2 K 1 2 K 1 2^(K-1)2^{K-1}, one could halve m m mm and increase e e ee by 1 to produce a second representation for the same value v v vv. A representation in this form is called normalized if m 2 N 1 m 2 N 1 m >= 2^(N-1)m \geq 2^{N-1}; otherwise the representation is said to be denormalized. If a value in a value set cannot be represented in such a way that m 2 N 1 m 2 N 1 m >= 2^(N-1)m \geq 2^{N-1}, then the value is said to be a denormalized value, because it has no normalized representation.
任何浮点数值集的有限非零值都可以表示为 s m 2 ( e N + 1 ) s m 2 ( e N + 1 ) s*m*2^((e-N+1))s \cdot m \cdot 2^{(e-N+1)} 的形式,其中 s s ss 是 +1 或 1 , m 1 , m -1,m-1, m 是小于 2 N 2 N 2N2 N 的正整数,且 e e ee 是介于 E min = ( 2 K 1 2 ) E min = 2 K 1 2 E_(min)=-(2^(K-1)-2)E_{\min }=-\left(2^{K-1}-2\right) E max = 2 K 1 1 E max = 2 K 1 1 E_(max)=2^(K-1)-1E_{\max }=2^{K-1}-1 之间的整数(包括两端),并且 N N NN K K KK 是依赖于数值集的参数。某些值可以用多种方式表示为这种形式;例如,假设数值集中的某个值 v v vv 可以用特定的 s , m s , m s,ms, m e e ee 值表示为这种形式,如果 m m mm 是偶数且 e e ee 小于 2 K 1 2 K 1 2^(K-1)2^{K-1} ,那么可以减半 m m mm 并将 e e ee 加 1,从而为同一个值 v v vv 产生第二种表示形式。如果满足 m 2 N 1 m 2 N 1 m >= 2^(N-1)m \geq 2^{N-1} 的条件,这种形式的表示被称为正规化表示;否则,这种表示被称为非正规化表示。如果一个数值集中的值无法以 m 2 N 1 m 2 N 1 m >= 2^(N-1)m \geq 2^{N-1} 的方式表示,那么该值被称为非正规化值,因为它没有正规化表示。
The constraints on the parameters N N NN and K K KK (and on the derived parameters E min E min E_(min)E_{\min } and E max E max E_(max)E_{\max } ) for the two required and two optional floating-point value sets are summarized in Table 2.3.2-A.
对两个必需和两个可选浮点数值集的参数 N N NN K K KK (以及对派生参数 E min E min E_(min)E_{\min } E max E max E_(max)E_{\max } )的约束总结在表 2.3.2-A 中。
Table 2.3.2-A. Floating-point value set parameters
表 2.3.2-A. 浮点数值集参数
Parameter  参数 float  浮点数 float-extended-exponent double  双精度浮点数 double-extended-exponent
N N NN 24 24 53 53
K K KK 8 11 11 >= 11\geq 11 11 15 15 >= 15\geq 15
E max E max  E_("max ")E_{\text {max }} +127 >=\geq +1023 +1023 >=\geq +16383
E min E min  E_("min ")E_{\text {min }} -126 1022 1022 <= -1022\leq-1022 -1022 16382 16382 <= -16382\leq-16382
Parameter float float-extended-exponent double double-extended-exponent N 24 24 53 53 K 8 >= 11 11 >= 15 E_("max ") +127 >= +1023 +1023 >= +16383 E_("min ") -126 <= -1022 -1022 <= -16382| Parameter | float | float-extended-exponent | double | double-extended-exponent | | :--- | :--- | :--- | :--- | :--- | | $N$ | 24 | 24 | 53 | 53 | | $K$ | 8 | $\geq 11$ | 11 | $\geq 15$ | | $E_{\text {max }}$ | +127 | $\geq$ +1023 | +1023 | $\geq$ +16383 | | $E_{\text {min }}$ | -126 | $\leq-1022$ | -1022 | $\leq-16382$ |
Where one or both extended-exponent value sets are supported by an implementation, then for each supported extended-exponent value set there is a specific implementation-dependent constant K K KK, whose value is constrained by Table 2.3.2-A; this value K K KK in turn dictates the values for E min E min E_(min)E_{\min } and E max E max E_(max)E_{\max }.
当一个或两个 extended-exponent 值集被实现所支持时,对于每个支持的 extended-exponent 值集,存在一个特定的、实现相关的常量 K K KK ,其值受限于表 2.3.2-A;这个值 K K KK 反过来又决定了 E min E min E_(min)E_{\min } E max E max E_(max)E_{\max } 的值。
Each of the four value sets includes not only the finite nonzero values that are ascribed to it above, but also the five values positive zero, negative zero, positive infinity, negative infinity, and NaN .
这四个值集不仅包括上述所赋予的有限非零值,还包括五个值:正零、负零、正无穷大、负无穷大和 NaN。
Note that the constraints in Table 2.3.2-A are designed so that every element of the float value set is necessarily also an element of the float-extended-exponent value set, the double value set, and the double-extended-exponent value set. Likewise, each element of the double value set is necessarily also an element of the double-extended-exponent value set. Each extended-exponent value set has a larger range of exponent values than the corresponding standard value set, but does not have more precision.
请注意,表 2.3.2-A 中的约束设计得使得浮点值集中的每个元素必然也是浮点扩展指数值集、双精度值集和双精度扩展指数值集中的元素。同样,双精度值集中的每个元素必然也是双精度扩展指数值集中的元素。每个扩展指数值集的指数值范围比相应的标准值集更大,但精度并不更高。
The elements of the float value set are exactly the values that can be represented using the single floating-point format defined in the IEEE 754 standard, except that there is only one NaN value (IEEE 754 specifies 2 24 2 2 24 2 2^(24)-22^{24}-2 distinct NaN values). The elements of the double value set are exactly the values that can be represented using the double floatingpoint format defined in the IEEE 754 standard, except that there is only one NaN value (IEEE 754 specifies 2 53 2 2 53 2 2^(53)-22^{53}-2 distinct NaN values). Note, however, that the elements of the float-extended-exponent and double-extended-exponent value
浮点值集中的元素正好是使用 IEEE 754 标准中定义的单精度浮点格式可以表示的值,只是只有一个 NaN 值(IEEE 754 指定了 2 24 2 2 24 2 2^(24)-22^{24}-2 个不同的 NaN 值)。双精度值集中的元素正好是使用 IEEE 754 标准中定义的双精度浮点格式可以表示的值,只是只有一个 NaN 值(IEEE 754 指定了 2 53 2 2 53 2 2^(53)-22^{53}-2 个不同的 NaN 值)。然而,需要注意的是,浮点扩展指数值集和双精度扩展指数值集中的元素...

sets defined here do not correspond to the values that can be represented using IEEE 754 single extended and double extended formats, respectively. This specification does not mandate a specific representation for the values of the floating-point value sets except where floating-point values must be represented in the class file format (§4.4.4, §4.4.5).
在此定义的集合与使用 IEEE 754 单精度扩展和双精度扩展格式所能表示的值不对应。本规范除在类文件格式中必须表示浮点值(§4.4.4, §4.4.5)之外,不强制规定浮点值集合的值的特定表示方式。
The float, float-extended-exponent, double, and double-extended-exponent value sets are not types. It is always correct for an implementation of the Java Virtual Machine to use an element of the float value set to represent a value of type float; however, it may be permissible in certain contexts for an implementation to use an element of the float-extendedexponent value set instead. Similarly, it is always correct for an implementation to use an element of the double value set to represent a value of type double; however, it may be permissible in certain contexts for an implementation to use an element of the double-extended-exponent value set instead.
float、float-extended-exponent、double 和 double-extended-exponent 值集合不是类型。Java 虚拟机的实现始终可以使用 float 值集合的元素来表示 float 类型的值;然而,在某些上下文中,实现可能允许使用 float-extended-exponent 值集合的元素来代替。类似地,Java 虚拟机的实现始终可以使用 double 值集合的元素来表示 double 类型的值;然而,在某些上下文中,实现可能允许使用 double-extended-exponent 值集合的元素来代替。
Except for NaNs, values of the floating-point value sets are ordered. When arranged from smallest to largest, they are negative infinity, negative finite values, positive and negative zero, positive finite values, and positive infinity.
除了 NaN,浮点数值集的值是有序的。当从小到大排列时,它们是负无穷大、负有限值、正零和负零、正有限值以及正无穷大。
Floating-point positive zero and floating-point negative zero compare as equal, but there are other operations that can distinguish them; for example, dividing 1.0 by 0.0 produces positive infinity, but dividing 1.0 by -0.0 produces negative infinity.
浮点正零和浮点负零被视为相等,但其他操作可以区分它们;例如,将 1.0 除以 0.0 产生正无穷大,但将 1.0 除以-0.0 产生负无穷大。
NaNs are unordered, so numerical comparisons and tests for numerical equality have the value false if either or both of their operands are NaN. In particular, a test for numerical equality of a value against itself has the value false if and only if the value is NaN . A test for numerical inequality has the value true if either operand is NaN .
NaN 是无序的,因此数值比较和数值相等性测试,如果它们的操作数中有一个或两个是 NaN,则结果为 false。特别是,如果值与自身进行数值相等性测试,当且仅当该值是 NaN 时,结果为 false。数值不等性测试,如果操作数中有一个是 NaN,则结果为 true。

2.3.3. The returnAddress Type and Values
2.3.3. 返回地址类型和值

The returnAddress type is used by the Java Virtual Machine’s jsr, ret, and jsr_w instructions (§jsr, §ret, §jsr w). The values of the returnAddress type are pointers to the opcodes of Java Virtual Machine instructions. Unlike the numeric primitive types, the returnAddress type does not correspond to any Java programming language type and cannot be modified by the running program.
returnAddress 类型被 Java 虚拟机的 jsr、ret 和 jsr_w 指令(§jsr、§ret、§jsr w)使用。returnAddress 类型的值是指向 Java 虚拟机指令操作码的指针。与数值基本类型不同,returnAddress 类型不对应任何 Java 编程语言类型,且不能被运行程序修改。

2.3.4. The boolean Type
2.3.4. 布尔类型

Although the Java Virtual Machine defines a boolean type, it only provides very limited support for it. There are no Java Virtual Machine instructions solely dedicated to operations on boolean values. Instead, expressions in the Java programming language that operate on boolean values are compiled to use values of the Java Virtual Machine int data type.
尽管 Java 虚拟机定义了布尔类型,但它只提供了非常有限的支持。没有专门用于布尔值操作的 Java 虚拟机指令。相反,Java 编程语言中操作布尔值的表达式会被编译为使用 Java 虚拟机 int 数据类型的值。
The Java Virtual Machine does directly support boolean arrays. Its newarray instruction (§newarray) enables creation of boolean arrays. Arrays of type boolean are accessed and modified using the byte array instructions baload and bastore (§baload, §bastore).
Java 虚拟机直接支持布尔数组。它的 newarray 指令(§newarray)能够创建布尔数组。类型为 boolean 的数组通过 byte 数组指令 baload 和 bastore(§baload、§bastore)进行访问和修改。
In Oracle’s Java Virtual Machine implementation, boolean arrays in the Java programming language are encoded as Java Virtual Machine by te arrays, using 8 bits per boolean element.
在 Oracle 的 Java 虚拟机实现中,Java 编程语言中的布尔数组被编码为 Java 虚拟机类型 byte 数组,每个布尔元素使用 8 位。
The Java Virtual Machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java Virtual Machine type int, the compilers must use the same encoding.
Java 虚拟机使用 1 表示 true,0 表示 false 来编码布尔数组元素。当 Java 编程语言中的布尔值被编译器映射为 Java 虚拟机类型 int 的值时,编译器必须使用相同的编码。

2.4. Reference Types and Values
2.4. 引用类型和值

There are three kinds of reference types: class types, array types, and interface types. Their values are references to dynamically created class instances, arrays, or class instances or arrays that implement interfaces, respectively.
有三种引用类型:类类型、数组类型和接口类型。它们的值分别是动态创建的类实例的引用、数组的引用,或实现接口的类实例或数组的引用。
An array type consists of a component type with a single dimension (whose length is not given by the type). The component type of an array type may itself be an array type. If, starting from any array type, one considers its component type, and then (if that is also an array type) the component type of that type, and so on, eventually one must reach a component type that is not an array type; this is called the element type of the array type. The element type of an array type is necessarily either a primitive type, or a class type, or an interface type.
数组类型由一个单一维度的组件类型组成(其长度不由类型指定)。数组类型的组件类型本身也可以是数组类型。如果从任何数组类型开始,考虑其组件类型,然后(如果这也是一个数组类型)考虑该类型的组件类型,如此等等,最终必须达到一个不是数组类型的组件类型;这称为数组类型的元素类型。数组类型的元素类型必然是基本类型、类类型或接口类型。
A reference value may also be the special null reference, a reference to no object, which will be denoted here by null. The null reference initially has no run-time type, but may be cast to any type. The default value of a reference type is null.
一个引用值也可能是特殊的空引用,即不指向任何对象的引用,这里用 null 表示。空引用最初没有运行时类型,但可以转换为任何类型。引用类型的默认值是 null。
This specification does not mandate a concrete value encoding null.
本规范不强制规定空值的具体编码方式。

2.5. Run-Time Data Areas
2.5. 运行时数据区

The Java Virtual Machine defines various run-time data areas that are used during execution of a program. Some of these data areas are created on Java Virtual Machine start-up and are destroyed only when the Java Virtual Machine exits. Other data areas are per thread. Per-thread data areas are created when a thread is created and destroyed when the thread exits.
Java 虚拟机定义了多种运行时数据区域,这些区域在程序执行期间使用。其中一些数据区域在 Java 虚拟机启动时创建,并且仅在 Java 虚拟机退出时销毁。其他数据区域是线程专属的。线程专属数据区域在创建线程时创建,在线程退出时销毁。

2.5.1. The pc Register
2.5.1. pc 寄存器

The Java Virtual Machine can support many threads of execution at once (JLS §17). Each Java Virtual Machine thread has its own pc (program counter) register. At any point, each Java Virtual Machine thread is executing the code of a single method, namely the current method (§2.6) for that thread. If that method is not nat ive, the pc register contains the address of the Java Virtual Machine instruction currently being executed. If the method currently being executed by the
Java 虚拟机可以同时支持多个执行线程(JLS §17)。每个 Java 虚拟机线程都有自己的 pc(程序计数器)寄存器。在任何时刻,每个 Java 虚拟机线程都在执行单个方法的代码,即该线程的当前方法(§2.6)。如果该方法不是原生的,pc 寄存器包含当前正在执行的 Java 虚拟机指令的地址。如果当前正在执行的方法