哪个文件包含OpenJDK 8的字节码指令集

时间:2021-12-01 07:01:49

i am new to openJDK8, i want to locate the file(s) where the bytecode instruction set is present which is used to generate the bytecode of a source .java file.
Secondly i need basic knowledge of the bytecode generation and execution process.

我是openJDK8的新手,我想找到存在字节码指令集的文件,用于生成源.java文件的字节码。其次,我需要基本的字节码生成和执行过程知识。

i am a research student and working on openJDK bytecode. Can you please guide?

我是一名研究生,正在研究openJDK字节码。你能指导一下吗?

1 个解决方案

#1


1  

The question seems to be conflating/mixing a number of different things. If you are creating a new bytecode there's several things you need to do.

问题似乎是混淆/混合了许多不同的东西。如果要创建新的字节码,则需要执行几项操作。

  • Specify/define the bytecode
  • 指定/定义字节码

  • Modify the compiler to generate that bytecode
  • 修改编译器以生成该字节码

  • Modify the runtime to understand that bytecode
  • 修改运行时以了解该字节码

The Java bytecodes are specified in the Java Virtual Machine Specification. If you need to define a new one, you need to specify it to a similar degree, though you don't have to publish it there.

Java字节码在Java虚拟机规范中指定。如果您需要定义一个新的,您需要将其指定为相似的程度,但您不必在那里发布它。

The part of Java SDK that is responsible from taking Java source code and producing Java bytecode is the Java compiler (javac). The source code for OpenJDK's javac is available here. The source code for Eclipse's Java Compiler is also available, but I don't know where.

Java SDK中负责获取Java源代码并生成Java字节码的部分是Java编译器(javac)。 OpenJDK的javac源代码可在此处获得。 Eclipse的Java编译器的源代码也可用,但我不知道在哪里。

Once you have the java compiler generating your custom bytecode, you have to teach the JVM how to interpret it.

一旦你有java编译器生成自定义字节码,你必须教JVM如何解释它。

The OpenJDK VM (hotspot) has several components that handle executing the bytecode. There's more than one interpreter (that reads and executes bytecode) and multiple Just-In-Time optimizing compilers that read the bytecode and (possibly) compile it into machine code before executing it. The source code for all of them is part of the hotspot. You probably just want to limit yourself to the interpreter and disable the compilers for initial work. If so, this set of notes explain how the hotspot interpreter works.

OpenJDK VM(热点)有几个处理字节码执行的组件。有多个解释器(读取和执行字节码)和多个即时优化编译器,它们读取字节码并在执行之前(可能)将其编译为机器码。所有这些的源代码都是热点的一部分。您可能只想将自己限制在解释器中并禁用编译器以进行初始工作。如果是这样,这组注释解释了热点解释器的工作原理。

#1


1  

The question seems to be conflating/mixing a number of different things. If you are creating a new bytecode there's several things you need to do.

问题似乎是混淆/混合了许多不同的东西。如果要创建新的字节码,则需要执行几项操作。

  • Specify/define the bytecode
  • 指定/定义字节码

  • Modify the compiler to generate that bytecode
  • 修改编译器以生成该字节码

  • Modify the runtime to understand that bytecode
  • 修改运行时以了解该字节码

The Java bytecodes are specified in the Java Virtual Machine Specification. If you need to define a new one, you need to specify it to a similar degree, though you don't have to publish it there.

Java字节码在Java虚拟机规范中指定。如果您需要定义一个新的,您需要将其指定为相似的程度,但您不必在那里发布它。

The part of Java SDK that is responsible from taking Java source code and producing Java bytecode is the Java compiler (javac). The source code for OpenJDK's javac is available here. The source code for Eclipse's Java Compiler is also available, but I don't know where.

Java SDK中负责获取Java源代码并生成Java字节码的部分是Java编译器(javac)。 OpenJDK的javac源代码可在此处获得。 Eclipse的Java编译器的源代码也可用,但我不知道在哪里。

Once you have the java compiler generating your custom bytecode, you have to teach the JVM how to interpret it.

一旦你有java编译器生成自定义字节码,你必须教JVM如何解释它。

The OpenJDK VM (hotspot) has several components that handle executing the bytecode. There's more than one interpreter (that reads and executes bytecode) and multiple Just-In-Time optimizing compilers that read the bytecode and (possibly) compile it into machine code before executing it. The source code for all of them is part of the hotspot. You probably just want to limit yourself to the interpreter and disable the compilers for initial work. If so, this set of notes explain how the hotspot interpreter works.

OpenJDK VM(热点)有几个处理字节码执行的组件。有多个解释器(读取和执行字节码)和多个即时优化编译器,它们读取字节码并在执行之前(可能)将其编译为机器码。所有这些的源代码都是热点的一部分。您可能只想将自己限制在解释器中并禁用编译器以进行初始工作。如果是这样,这组注释解释了热点解释器的工作原理。