点点历史就是介绍,java是什么纯面向对象 ,类似C和C++ ,等等此处省略一千字留给读者自行百度…
Jvm 并不知道java编程语言 ,仅知道一种特定二进制格式,class文件格式 , 一个class文件包含JVM指令(或字节码)和符号表以及其他辅助信息
For the sake of security, the Java Virtual Machine imposes strong syntactic and
structural constraints on the code in a class file.
为安全起见 ,jvm 使用严格的语法以及在一个类文件上使用结构化的约束
正确的实现一个java虚拟机 ,你只需要能解析class文件格式,正确的执行JVM规范中的操作 ,Java Virtual Machine’s specification没有规定具体的实现细节,也不需要约束实现着的创作性 ,例如 , 内存布局,垃圾回收算法 ,指令优化(例如把指令转换为机器码)被留给了实现着来考虑
Unicode 规范请参考 http://www.unicode.org/
Compiled code to be executed by the Java Virtual Machine is represented using
a hardware- and operating system-independent binary format,typically (but not
necessarily) stored in a file, known as the class file format.
被虚拟机执行编译后的代码是使用一种硬件以及操作系统平台无关的二进制格式,典型地,被存贮在一个文件中,但是不是一定在文件中 , 这就是众所周知的class文件格式
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.
这个class文件格式惊喜的定义了一个类或者接口的表现形式 ,具体包裹字节码顺序,
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.
不同的是, jvm指令区分它的操作数类型是体现在指令上
例如 ,iadd, ladd, fadd, and dadd都是对两个数字求和得到一个数字结果
但是每一个指令针对不同的操作数类型:int , long ,float ,and double
The integral types are:
• byte, whose values are 8-bit signed two’s-complement integers, and whose
default value is zero
short, whose values are 16-bit signed two’s-complement integers, and whose
default value is zero
int, whose values are 32-bit signed two’s-complement integers, and whose
default value is zero
long, whose values are 64-bit signed two’s-complement integers, and whose
default value is zero
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 (‘\u0000’)
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
• 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
The values of the boolean type encode the truth values true and false, and the
default value is false.
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
有三种引用类型 : 类类型,数组类型 ,接口类型 。 他们的值分别引用到动态创建的类的实例 , 数组或者实现了接口的类实例或数组 。
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虚拟机定义了不同的运行时数据区域供一个程序执行使用 ,这些区域在JVM启动是创建JVM退出时销毁 . 其他的数据区域是针对每个线程的,线程数据区域在随线程启动时创建线程退出时销毁
Page12 页