CN1596398A - Software support for virtual machine interpreter (VMI) acceleration hardware - Google Patents

Software support for virtual machine interpreter (VMI) acceleration hardware Download PDF

Info

Publication number
CN1596398A
CN1596398A CNA028187008A CN02818700A CN1596398A CN 1596398 A CN1596398 A CN 1596398A CN A028187008 A CNA028187008 A CN A028187008A CN 02818700 A CN02818700 A CN 02818700A CN 1596398 A CN1596398 A CN 1596398A
Authority
CN
China
Prior art keywords
virtual machine
instructions
processor
native
machine instructions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA028187008A
Other languages
Chinese (zh)
Other versions
CN1295605C (en
Inventor
M·M·林德维
S·本-耶德
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Koninklijke Philips NV
Original Assignee
Koninklijke Philips Electronics NV
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Koninklijke Philips Electronics NV filed Critical Koninklijke Philips Electronics NV
Publication of CN1596398A publication Critical patent/CN1596398A/en
Application granted granted Critical
Publication of CN1295605C publication Critical patent/CN1295605C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

A system and method for processing virtual machine instructions which supports the software trap methodology. An application programming interface (API) prescribes additional functionality for software traps that remove the processing of recursive virtual machine instructions from virtual machine hardware and instead process recursive virtual machine instructions using software. The additional functionality includes the configuration of a context for processing recursive virtual machine instructions, which enables the virtual machine instructions to access CPU registers to retrieve and modify the values of variables as required, the release of the configured context when processing of recursive virtual machine instructions is completed, and the return of control to a virtual machine for processing non-recursive virtual machine instructions.

Description

对虚拟机解释器(VMI)加速硬件的软件支持Software support for virtual machine interpreter (VMI) accelerated hardware

发明领域field of invention

本发明一般来讲涉及计算机程序设计语言,更具体来讲,涉及虚拟机语言的翻译和执行。The present invention relates generally to computer programming languages, and more specifically to the translation and execution of virtual machine languages.

发明背景Background of the invention

计算机程序设计语言用于创建由表示供计算机执行的指令的人类可读源代码所组成的应用程序。然而,在计算机能够遵循这些指令以前,所述源代码必须被翻译成计算机可读的二进制机器代码。Computer programming languages are used to create applications consisting of human-readable source code representing instructions for computer execution. However, before a computer can follow these instructions, the source code must be translated into computer readable binary machine code.

诸如C、C++或者COBOL之类的程序设计语言通常使用编译器,以便从源代码产生汇编语言,然后将所述汇编语言翻译为被转换为机器代码的机器语言。因此,在运行时以前发生源代码的最终翻译。不同的计算机要求不同的机器语言,因此,以例如C++编写成的程序只能在该程序为之所写的专用硬件平台上运行。Programming languages such as C, C++ or COBOL typically use a compiler to generate assembly language from source code, which is then translated into machine language which is converted into machine code. Thus, the final translation of the source code occurs before runtime. Different computers require different machine languages, so a program written in, for example, C++ will only run on the specific hardware platform for which the program was written.

解释性程序设计语言被设计成创建具有将在多个硬件平台上运行的源代码的应用程序。JavaTM是一种解释性程序设计语言,其通过产生在运行时以前被转换为公知为“字节码”或者“虚拟机语言”的中间语言的源代码,来实现平台无关性。在运行时,所述字节码被解释器软件译成平台适用机器代码,如美国专利第4443865号中所公开的那样。为了解释每一字节码,解释器软件执行“取出、译码、调度”(FDD)操作系列。对于每一字节码指令,解释器软件均包含一个用本机中央处理单元(CPU)指令表示的对应执行程序。所述解释器软件令CPU从存储器中取出或者读取一条虚拟机指令、对用于这条字节码指令的执行程序的CPU地址进行译码、并且通过将CPU的控制权转移给那个执行程序来进行调度。该解释过程可能是耗时间的。Interpreted programming languages are designed to create application programs with source code that will run on multiple hardware platforms. Java (TM) is an interpreted programming language that achieves platform independence by generating source code that is converted before runtime into an intermediate language known as "bytecode" or "virtual machine language". At runtime, the bytecode is translated into platform-appropriate machine code by interpreter software, as disclosed in US Patent No. 4,443,865. To interpret each bytecode, the interpreter software performs a "fetch, decode, dispatch" (FDD) series of operations. For each bytecode instruction, the interpreter software includes a corresponding executive program represented by a native central processing unit (CPU) instruction. The interpreter software causes the CPU to fetch or read a virtual machine instruction from memory, decode the CPU address of the executive program for this bytecode instruction, and transfer control of the CPU to that executive program to schedule. This interpretation process can be time consuming.

正如在PCT专利申请第WO9918484号中所公开的那样,在存储器和CPU之间添加预处理器(虚拟机解释器(VMI))能改善虚拟机指令的处理。实际上,虚拟机并不是一种物理结构,而是一种自含式操作环境,其通过选择存储在VM内的或者CPU中的相应本机机器语言指令,来为硬件平台解释字节码。然后将本机指令提供给硬件平台的CPU,并在硬件平台的CPU中连续地执行这些指令。典型的虚拟机对于每一字节码都需要20-60周期的处理时间(取决于字节码的质量和复杂性)来执行FDD操作系列。Adding a preprocessor (Virtual Machine Interpreter (VMI)) between the memory and the CPU improves the processing of virtual machine instructions, as disclosed in PCT Patent Application No. WO9918484. In fact, a virtual machine is not a physical structure, but a self-contained operating environment that interprets bytecodes for the hardware platform by selecting the corresponding native machine language instructions stored in the VM or in the CPU. The native instructions are then provided to the CPU of the hardware platform, and these instructions are continuously executed in the CPU of the hardware platform. A typical virtual machine requires 20-60 cycles of processing time per bytecode (depending on the quality and complexity of the bytecode) to execute the FDD sequence of operations.

如PCT专利申请第WO9918484号和第WO9918486号中所公开的那样,能够通过实施硬件加速器来实现处理时间的进一步减少。首先,VMI从存储器中读取(取出)一个字节码。然后,VMI查看所取出的字节码的多个属性(译码)。由VMI访问的属性之一指示该字节码是简单的还是复杂的,这决定了VMI是否能够以硬件来翻译该字节码。VMI将简单的JavaTM字节码翻译为专门的并且优化的本机CPU指令序列,然后由CPU将其取出并执行。在CPU执行一条指令的同时,VMI取出下一条字节码,并将其翻译为CPU指令。VMI能够在1-4周期内处理简单的字节码。如果其属性指示字节码是复杂的,VMI产生一个本机CPU指令的类属序列,从而实现一个“软件陷阱”,其将该复杂的字节码指引给软件来翻译和执行。一旦遇到复杂的字节码,VMI就向CPU发出机器代码指令,从而执行对应的本机函数、即执行驻留在CPU中的机器代码子程序。作为响应,CPU中断执行作为先前字节码翻译的结果的、由VMI产生的本机指令,并执行由该复杂的字节码调用的本机函数。VMI等待来检测从其输出缓冲器中的新的取出操作,然后恢复对所述字节码序列的翻译。尽管VMI访问现有的本机函数,而不是逐指令地翻译复杂的字节码,但是它将FDD的操作时间的影响减少到几乎0周期,因为,每一软件陷阱的VMI处理(5-20周期)与另一字节码的CPU执行是同时发生的。Further reductions in processing time can be achieved by implementing hardware accelerators, as disclosed in PCT Patent Applications Nos. WO9918484 and WO9918486. First, the VMI reads (fetches) a bytecode from memory. The VMI then looks at various attributes of the fetched bytecode (decoding). One of the attributes accessed by the VMI indicates whether the bytecode is simple or complex, which determines whether the VMI can translate the bytecode in hardware. The VMI translates simple Java TM bytecode into specialized and optimized sequences of native CPU instructions, which are then fetched and executed by the CPU. While the CPU is executing an instruction, the VMI fetches the next bytecode and translates it into a CPU instruction. VMI is able to process simple bytecodes in 1-4 cycles. If its properties indicate that the bytecode is complex, the VMI generates a generic sequence of native CPU instructions, implementing a "software trap" that directs the complex bytecode to software for translation and execution. Once a complex bytecode is encountered, the VMI issues machine code instructions to the CPU, thereby executing the corresponding native function, ie, executing a machine code subroutine residing in the CPU. In response, the CPU interrupts execution of native instructions generated by the VMI as a result of previous bytecode translations, and executes native functions called by the complex bytecode. The VMI waits to detect a new fetch operation from its output buffer, and then resumes translation of the bytecode sequence. Although VMI accesses existing native functions instead of translating complex bytecode instruction-by-instruction, it reduces the operational time impact of FDD to almost 0 cycles because, VMI processing of each software trap (5-20 cycle) is concurrent with the CPU execution of another bytecode.

在解释一个字节码序列的同时,虚拟机可能遇到一个“递归”的复杂字节码。执行递归字节码(RBC)时出现了难题,这是因为,每一RBC均调用一个本机函数,所述本机函数最终产生一个方法调用(即,为另一Java字节码序列重新启动VMI)。因此,为了对来自另一个序列的字节码进行译码,由RBC调用的本机函数必须访问CPU寄存器中存储的变量值。本机函数通常(但不总是)包括标准指令集,在下文中称作“前同步码”和“后同步码”。标准前同步码被设计成在执行子程序以前,保存一些或者全部CPU寄存器的内容。被保存的一些内容关注在执行本机函数期间可能需要被修改的变量值(例如用于重新启动虚拟机的堆栈指针和返回地址)。然而,通常无法在由RBC指定的本机函数内访问这些变量,因为RBC方法调用是在程序设计语言的源代码中定义的,而不是在被要求访问CPU寄存器的机器代码中定义的。此外,因为RBC方法调用无法访问CPU寄存器,所以标准子程序后同步码无法将已经由RBC方法调用所修改的变量值写回CPU寄存器中。换言之,因为RBC子程序或者由于缺乏环境设置(没有前同步码或者后同步码),或者由于不兼容的环境设置与本机函数调用相关联,而无法访问存储在CPU寄存器中的变量,所以可能无法正确地执行由递归字节码调用的子程序。可以通过实现手工编码的软件来解决这一难题,所述手工编码的软件产生汇编语言,以便为RBC子程序写入或者修改变量值,然而这一方法需要复杂的开发工作量。While interpreting a bytecode sequence, the virtual machine may encounter a "recursive" complex bytecode. Difficulty arises when executing recursive bytecodes (RBCs), because each RBC calls a native function that ultimately results in a method call (i.e., restarts for another sequence of Java bytecodes). VMI). Therefore, in order to decode bytecode from another sequence, native functions called by RBC must access variable values stored in CPU registers. Native functions usually (but not always) include a standard instruction set, hereinafter referred to as "preamble" and "postamble". The standard preamble is designed to save the contents of some or all of the CPU registers before executing the subroutine. Some of what is saved concerns variable values that may need to be modified during execution of the native function (such as the stack pointer and return address for restarting the virtual machine). However, it is generally not possible to access these variables within native functions specified by RBC, because RBC method calls are defined in the source code of the programming language, not in the machine code that is required to access CPU registers. Furthermore, because RBC method calls cannot access CPU registers, standard subroutine postambles cannot write variable values that have been modified by RBC method calls back into CPU registers. In other words, because RBC subroutines cannot access variables stored in CPU registers either due to lack of environment settings (no preamble or postamble), or due to incompatible environment settings associated with native function calls, it is possible Subroutines called from recursive bytecode cannot be executed correctly. This difficulty can be solved by implementing hand-coded software that generates assembly language to write or modify variable values for RBC subroutines, however this approach requires a complex development effort.

需要这样一种解释编程语言的系统,它能准确地和高效地执行递归字节码指定的指令,同时更容易实施。There is a need for a system that interprets a programming language that accurately and efficiently executes instructions specified by recursive bytecode while being easier to implement.

发明概要Summary of the invention

本发明通过规定为由递归字节码调用的本机函数提供前同步码和后同步码并执行该本机函数的专用函数,来满足如上所述的需要。所述前同步码和后同步码代替或者修改与本机函数相关联的任何标准前同步码和后同步码,并使得本机函数能够访问和修改必要的CPU寄存器的内容。在另一个实施例中,专用函数能够从处理器存储器取出、或者为任何复杂的字节码产生。借此,本发明维护了准确度和速度,同时简化了软件陷阱或者“VMI加速硬件”方法的实现。The present invention satisfies the needs described above by specifying a dedicated function that provides a preamble and a postamble to a native function called by recursive bytecode and executes the native function. The preamble and postamble replace or modify any standard preamble and postamble associated with the native function and enable the native function to access and modify the contents of the necessary CPU registers. In another embodiment, specific functions can be fetched from processor memory, or generated for bytecodes of any complexity. By doing so, the present invention maintains accuracy and speed while simplifying the implementation of a software trap or "VMI accelerated hardware" approach.

更具体地说,本发明以应用编程接口(API)的形式提供VMI支持。当VMI在解释和执行字节码序列的同时遇到递归的字节码的时候,本发明的VMI支持软件使用附加的前同步码和附加的后同步码将由递归的字节码调用的最高层子程序封装起来。当该子程序被调用的时候,本发明的所述附加的前同步码处理CPU寄存器中包含的变量值,从而使CPU将这些值写入可在被调用的子程序的内部来访问的变量。用这样的方式,被调用的子程序能够修改变量值。本发明的所述附加的后同步码在标准子程序后同步码之后执行,从而使CPU取出修改的变量的值并将该值写入CPU寄存器中。由此,当CPU恢复执行由随后的字节码翻译所产生的本机指令的时候,所述修改的变量将可用。More specifically, the present invention provides VMI support in the form of an application programming interface (API). When the VMI encounters recursive bytecode while interpreting and executing bytecode sequences, the VMI support software of the present invention uses an additional preamble and an additional postamble to convert the highest layer called by the recursive bytecode Subroutines are encapsulated. When the subroutine is called, the additional preamble of the present invention processes the variable values contained in the CPU registers, causing the CPU to write these values into variables accessible inside the called subroutine. In this way, the called subroutine can modify the variable value. The additional postamble of the present invention is executed after the standard subroutine postamble, causing the CPU to fetch the value of the modified variable and write the value into a CPU register. Thus, the modified variables will be available when the CPU resumes execution of the native instructions resulting from the subsequent translation of the bytecode.

简要来讲,本发明包括用于处理虚拟机指令的方法和系统,它在本发明的示例性的实施例中是通过Java程序设计语言产生的。在编程级,Java源代码被编译为称作字节码的中间语言。字节码包括能够由虚拟机解释以便由处理器来执行的虚拟机指令。依据本发明的示例性的实施例,虚拟机(在该示例性的实施例中是VMI)在运行时被初始化。包括所有软件陷阱的入口地址的表被编译,其中,软件陷阱从VM硬件中取消对于一些复杂的字节码的处理,并且代之以使用软件来处理复杂的字节码。参数被初始化,所述参数依据用于每一字节码的特征的适当的处理方法对字节码进行分类。举例来说,字节码可以被分为简单的、复杂的、或者递归的(RBC)。递归的字节码是字节码的第一序列中的虚拟机指令,它调用能执行字节码的第二序列中的一个或多个字节码,然后返回到字节码的第一序列的子程序。递归的Java字节码的范例是INVOKESTATIC和NEW。那些被配置成用于处理RBC的软件陷阱配备有适当的前同步码和后同步码。Briefly, the present invention includes a method and system for processing virtual machine instructions, which in an exemplary embodiment of the present invention are generated by the Java programming language. At the programming level, Java source code is compiled into an intermediate language called bytecode. The bytecode includes virtual machine instructions that can be interpreted by the virtual machine for execution by the processor. According to an exemplary embodiment of the present invention, a virtual machine (VMI in this exemplary embodiment) is initialized at runtime. A table is compiled that includes the entry addresses of all software traps that remove the processing of some complex bytecode from the VM hardware and use software to process the complex bytecode instead. Parameters are initialized that classify the bytecodes according to the appropriate processing method for each bytecode's characteristics. For example, bytecode can be classified as simple, complex, or recursive (RBC). A recursive bytecode is a virtual machine instruction in the first sequence of bytecodes that invokes one or more bytecodes in the second sequence of bytecodes that execute and then returns to the first sequence of bytecodes subroutine. Examples of recursive Java bytecodes are INVOKESTATIC and NEW. Those software traps configured to handle RBCs are equipped with appropriate preambles and postambles.

VMI继续将一系列字节码中的每一个翻译为一个或多个本机指令。当遇到RBC的时候,VMI挂起对字节码序列的翻译,并且通过适当的软件陷阱处理该RBC。一般来讲,软件陷阱检索对应于所述RBC的虚拟机指令的本机函数。本发明的应用编程接口(API)规定了适当的子程序,其执行前同步码、调用对应于所述RBC的本机函数并且执行后同步码。在执行由所述RBC调用的本机函数以前执行所述前同步码。在执行由所述RBC调用的本机函数之后并且在所述RBC本机函数中的任何RETURN(返回)语句之后执行所述后同步码。如果由所述RBC调用的子程序包含标准前同步码和/或标准后同步码,则本发明的前同步码被替代并且通常在执行所述标准前同步码以前执行,而且,本发明中的后同步码被替代并且通常在执行所述标准后同步码之后执行。另外,本发明的前同步码和后同步码可以分别物理地修改或者改写标准前同步码或者标准后同步码中包含的一条或多条指令。依据本发明的示例性实施例中的一个方面,所述前同步码将值写入可被RBC所调用的子程序访问的变量。本发明的后同步码将由被调用的子程序所修改的变量值写回到包含该变量的CPU寄存器。然后,由API规定的子程序开始恢复在所述字节码序列的VMI中的翻译,这将持续直到遇到另一RBC或者翻译过程终止。再有,由API规定的子程序可以根据需要执行前同步码和后同步码,以便使本机的操作能访问VMI环境,举例来说,执行在本机的处理开始以前的第一前同步码、处理上述方法以前的第一后同步码、上述方法执行之后的另一前同步码以及在本机的处理完成之后的最终后同步码。The VMI proceeds to translate each of a series of bytecodes into one or more native machine instructions. When an RBC is encountered, the VMI suspends the translation of the bytecode sequence and handles the RBC through the appropriate software trap. In general, software traps retrieve native functions corresponding to the RBC's virtual machine instructions. The Application Programming Interface (API) of the present invention specifies appropriate subroutines that execute the preamble, call the native function corresponding to the RBC, and execute the postamble. The preamble is executed prior to execution of native functions called by the RBC. The postamble is executed after execution of the native function called by the RBC and after any RETURN (return) statements in the RBC native function. If the subroutine called by the RBC contains a standard preamble and/or a standard postamble, the preamble of the present invention is replaced and usually executed before executing the standard preamble, and the present invention The postamble is replaced and is usually executed after the standard postamble is executed. In addition, the preamble and postamble of the present invention can physically modify or rewrite one or more instructions included in the standard preamble or the standard postamble, respectively. According to an aspect of the exemplary embodiments of the present invention, the preamble writes a value to a variable accessible by a subroutine called by the RBC. The postamble of the present invention writes the variable value modified by the called subroutine back to the CPU register containing the variable. Then, the subroutine specified by the API starts to resume the translation in the VMI of the bytecode sequence, which will continue until another RBC is encountered or the translation process is terminated. Also, subroutines specified by the API may execute preambles and postambles as needed to enable native operation to access the VMI environment, for example, executing the first preamble before native processing begins , the first postamble before the above method is processed, another preamble after the above method is executed, and the final postamble after the processing of the local machine is completed.

使用诸如C RETURN语句之类的代码恢复VMI翻译。然而,在本发明的示例性实施例中,通过用于释放被配置为处理RBC的环境的CPU区域的恢复子程序添加由RBC发出的C RETURN语句,并且将VMI执行返回到字节码序列中的一个位置,例如返回到紧跟在最近被翻译的RBC后面的位置。Resume VMI translations using code such as the C RETURN statement. However, in an exemplary embodiment of the invention, the C RETURN statement issued by the RBC is added by the recovery subroutine for releasing the CPU region configured to handle the RBC's environment, and VMI execution is returned into the bytecode sequence A position of , for example, returns to the position immediately following the most recently translated RBC.

本发明的另一方面是用于执行来自诸如JavaTM之类的解释语言的虚拟机指令的系统。该系统包括处理器(CPU)和预处理器(VMI)、指令存储器、翻译器(JVM)以及应用编程接口(API)。所述处理器包含并且被配置成能执行硬件专用指令,以下简称本机指令。所述预处理器是一种虚拟机,例如是VMI,其被配置为从指令存储器中取出字节码并且将所述字节码翻译为本机的CPU指令。对于某些类型的字节码,API被配置为将值从CPU寄存器写入变量,从而该变量对上述字节码所表示的本机CPU指令来说是可访问的,并可依据该字节码所表示的本机CPU指令修改变量值。在本发明的示例性实施例中,API规定了一个子程序,该子程序在执行由该字节码调用的子程序之前实施前同步码,在该执行之后实施后同步码。前同步码将值从CPU寄存器写到可由该被调用的子程序访问的变量。在执行由该字节码表示的指令之后,API通过执行后同步码子程序而相应地修改变量值。Another aspect of the invention is a system for executing virtual machine instructions from an interpreted language such as Java (TM) . The system includes a processor (CPU) and preprocessor (VMI), an instruction memory, a translator (JVM), and an application programming interface (API). The processor includes and is configured to execute hardware-specific instructions, hereinafter referred to as native instructions. The preprocessor is a virtual machine, such as a VMI, configured to fetch bytecodes from an instruction memory and translate the bytecodes into native CPU instructions. For certain types of bytecodes, the API is configured to write values from CPU registers to variables accessible to the native CPU instruction represented by said bytecode and to The native CPU instruction represented by the code modifies the value of the variable. In an exemplary embodiment of the present invention, the API specifies a subroutine that implements a preamble prior to execution of a subroutine called by the bytecode and implements a postamble after that execution. The preamble writes a value from a CPU register to a variable accessible by the called subroutine. After executing the instructions represented by this bytecode, the API modifies the variable values accordingly by executing postamble subroutines.

尽管可以与本发明的API相结合地实施软件陷阱方法以便处理各种类型的字节码,但是本发明的该示例性的实施例旨在处理递归的字节码。Although a software trap method can be implemented in conjunction with the API of the present invention to handle various types of bytecodes, this exemplary embodiment of the present invention is intended to handle recursive bytecodes.

本发明能够在使用例如由Sun Microsystems制造的JVM之类的虚拟机来执行JavaTM字节码的系统中实施。然而,本发明还可以使用例如Microsoft虚拟机之类的其他JavaTM虚拟机来实施,并且还适用于执行诸如Visual Basic、dBASE、BASIC和MSIL(微软中间语言)之类的其他解释语言的系统。The present invention can be implemented in a system that executes Java (TM) bytecode using a virtual machine, such as the JVM manufactured by Sun Microsystems. However, the present invention can also be implemented using other Java virtual machines such as the Microsoft virtual machine, and is also applicable to systems executing other interpreted languages such as Visual Basic, dBASE, BASIC and MSIL (Microsoft Intermediate Language).

本发明的另外的目的、优点和新颖特征部分地将在随后的说明中阐述,同时部分地在研究了下文时而对于本领域中的技术人员显而易见,或者通过实现本发明而学到。Additional objects, advantages and novel features of the invention will be set forth in part in the ensuing description and in part will be apparent to those skilled in the art from a study of the following, or may be learned by practice of the invention.

附图简述Brief description of the drawings

图1是一个方框图,示出了本发明的环境中的示例性实施例的功能要素。Figure 1 is a block diagram illustrating the functional elements of an exemplary embodiment in the context of the present invention.

图2示出了一个示例性的字节码处理序列。Figure 2 shows an exemplary bytecode processing sequence.

图3是依据本发明的示例性实施例的方法的流程图。Fig. 3 is a flowchart of a method according to an exemplary embodiment of the present invention.

图4是示出本发明的示例性实施例中涉及的操作的相对时间关系的时间线。Figure 4 is a timeline illustrating the relative timing of operations involved in an exemplary embodiment of the present invention.

最佳实施例说明DESCRIPTION OF THE BEST EMBODIMENTS

现在详细参考本发明的一个示例性的实施例,它在附图中被图示出,其中类似的附图标记标明类似的部件,图1是本发明的环境中的示例性实施例的方框图。该环境的基本部件是硬件平台100,它包括处理器110、预处理器120以及指令存储器150,它们均通过系统总线160相连接。预处理器120包括至少一个表130和翻译器140。硬件平台100通常包括中央处理单元(CPU)、基本外围设备以及操作系统(OS)。本发明中的处理器110是诸如MIPS、ARM、Inte1TMx86、PowerPCTM或者SPARC型号微处理器之类的CPU,而且包含并被配置为用于执行硬件专用指令,以下简称为本机指令。在本发明的示例性实施例中,所述翻译器140是JavaTM虚拟机(JVM),例如是由Sun Microsystems制造的KVM。该示例性实施例中的预处理器120最好是在WO9918486中公开的虚拟机解释器(VMI),并且被配置为从指令存储器中取出字节码并将该字节码翻译为本机CPU指令。VMI 120是总线160上的外围设备,可以充当存储器映像的外围设备,其中,将预定范围的CPU地址分配给VMI 120。VMI 120管理用于指示指令存储器150中的当前(或者下一个)虚拟机指令的独立虚拟机指令指针。所述指令存储器150包含虚拟机指令,例如包含JavaTM字节码170。Referring now in detail to an exemplary embodiment of the present invention, which is illustrated in the drawings, wherein like reference numerals designate like parts, FIG. 1 is a block diagram of an exemplary embodiment in the context of the present invention. The basic components of this environment are hardware platform 100 , which includes processor 110 , preprocessor 120 and instruction memory 150 , which are all connected by system bus 160 . The preprocessor 120 includes at least one table 130 and a translator 140 . Hardware platform 100 typically includes a central processing unit (CPU), basic peripherals, and an operating system (OS). The processor 110 in the present invention is a CPU such as a MIPS, ARM, Intel x86, PowerPC or SPARC type microprocessor, and contains and is configured to execute hardware-specific instructions, hereinafter referred to as native instructions. In an exemplary embodiment of the invention, the translator 140 is a Java Virtual Machine (JVM), such as KVM manufactured by Sun Microsystems. Preprocessor 120 in this exemplary embodiment is preferably a virtual machine interpreter (VMI) disclosed in WO9918486 and is configured to fetch bytecode from instruction memory and translate the bytecode into native CPU instruction. The VMI 120 is a peripheral device on the bus 160 that can act as a memory-mapped peripheral device, wherein a predetermined range of CPU addresses is assigned to the VMI 120 . VMI 120 manages individual virtual machine instruction pointers for indicating current (or next) virtual machine instructions in instruction memory 150 . The instruction memory 150 contains virtual machine instructions, for example Java bytecode 170 .

所述VMI 120通过将大部分字节码170翻译为本机CPU指令的最佳序列,来加速Java字节码170的解释。然而,VMI 120通过执行软件陷阱实施用于处理复杂字节码170的软件解决方案。一般来讲,本发明涉及用于扩充软件陷阱的执行能力的系统和方法,所述软件陷阱是以特定类型的复杂字节码即公知的递归字节码(RBC)230为目标的。图2示出RBC 230的重要特征,那就是:对在字节码170的第一系列210中的RBC 230的处理会导致对字节码170的第二系列220中的字节码170的处理以及随后返回到对系列210中的字节码170的处理。因此,执行RBC 230会产生称为“方法”的字节码子程序。注意,如果系列210等于系列220,则系列210构成“递归方法”,该术语不等于“递归字节码”。通过定义一个包含软件陷阱的通用结构规范的API,本发明可支持用于处理RBC 230的软件陷阱的一般操作。The VMI 120 accelerates the interpretation of Java bytecode 170 by translating most of the bytecode 170 into an optimal sequence of native CPU instructions. However, VMI 120 implements a software solution for handling complex bytecode 170 by executing software traps. In general, the present invention relates to systems and methods for extending the execution capabilities of software traps that target a specific type of complex bytecode, known as recursive bytecode (RBC) 230 . Fig. 2 shows the important feature of RBC 230, that is: the processing to the RBC 230 in the first series 210 of bytecode 170 will cause the processing of bytecode 170 in the second series 220 of bytecode 170 and then return to processing bytecode 170 in series 210 . Thus, executing RBC 230 produces bytecode subroutines called "methods". Note that if series 210 is equal to series 220, then series 210 constitutes a "recursive method", which term is not equivalent to "recursive bytecode". The present invention can support generic operations for handling software traps of the RBC 230 by defining an API that includes a general structural specification of software traps.

根据本发明并且参考图3,在运行时初始化VMI 120,这项处理包括设置VMI 120的翻译控制寄存器。表130被编译,该表包括用于所有软件陷阱的入口地址。参数被初始化,该参数允许VMI依据字节码的属性处理每一字节码。当字节码是复杂的时候,VMI通过适当的软件陷阱处理该字节码。根据本发明,作为共同形成软件陷阱的本机指令的类属序列的一部分,被配置为处理RBC 230的那些软件陷阱涉及适当的前同步码和后同步码,所述前同步码和后同步码可以通过VMI 120产生,但是在该示例性实施例中,它们被存储在处理器存储器中、在处理器存储器中实例化并且从处理器存储器中执行。另外,所述前同步码和后同步码能够被存储在VMI内的表130中。因此在API实现方式中,一旦系统初始化,每一RBC软件陷阱进入点就会被编程为指向本机子程序(“PPA子程序”)。所述PPA子程序包括执行前同步码和后同步码,并且已经被实例化为含有到由RBC调用的本机函数(或多个本机函数)的跳转。According to the present invention and with reference to FIG. 3, the VMI 120 is initialized at runtime, a process that includes setting the translation control registers of the VMI 120. A table 130 is compiled which includes entry addresses for all software traps. Parameters are initialized that allow the VMI to process each bytecode according to the properties of the bytecode. When the bytecode is complex, the VMI handles the bytecode through appropriate software traps. According to the present invention, those software traps configured to handle the RBC 230 involve appropriate preambles and postambles, as part of the generic sequence of native instructions that together form the software traps. can be generated by VMI 120, but in the exemplary embodiment they are stored in, instantiated in, and executed from processor memory. Additionally, the preamble and postamble can be stored in a table 130 within the VMI. Thus, in an API implementation, each RBC software trap entry point is programmed to point to a native subroutine ("PPA subroutine") once the system is initialized. The PPA subroutine includes an execution preamble and postamble, and has been instantiated to contain a jump to a native function (or native functions) called by the RBC.

作为本发明的操作的一个例子,VMI 120继续将字节码170的系列210中的每一个翻译为一个或多个本机指令。参考图2,字节码B0至B2是非递归的,因此VMI 120仅从指令存储器150中取出B0至B2、选择为每一字节码170定义的本机指令或者多条指令并且将这些指令提供给处理器110来执行。Bn是RBC 230,它的执行可能引起来自第二序列220的一个或多个字节码(在这里是Bo至Bs)的执行。注意:在Java中,方法调用始终进入第一字节码处的序列,然而其他语言可能不允许在沿一个指令序列的其他位置处进入,这并没有技术上的原因。在执行第二序列220中的字节码之后,Bs是一个RETURN字节码,它使字节码执行以便在第一序列210中的某处继续。正如不是序列220的最后字节码的Bs指示的那样,Java方法能够具有几个出口点(RETURN字节码)。在Bs之后,执行通常在第一序列210中Bn+1处继续,但是并不一定非得是这样。As one example of the operation of the present invention, VMI 120 proceeds to translate each of series 210 of bytecode 170 into one or more native instructions. Referring to FIG. 2, bytecodes B0 through B2 are non-recursive, so VMI 120 simply fetches B0 through B2 from instruction memory 150, selects the native instruction or instructions defined for each bytecode 170, and provides these instructions to the processor 110 for execution. Bn is the RBC 230 whose execution may cause the execution of one or more bytecodes from the second sequence 220 (here Bo to Bs). Note: In Java, method calls always enter the sequence at the first bytecode, however other languages may not allow entry at other locations along an instruction sequence for no technical reason. After executing the bytecode in the second sequence 220 , Bs is a RETURN bytecode that causes bytecode execution to continue somewhere in the first sequence 210 . As indicated by Bs which is not the last bytecode of sequence 220, a Java method can have several exit points (RETURN bytecode). After Bs, execution typically continues at Bn +1 in the first sequence 210, but this does not have to be the case.

如图3中框310所示,VMI 120在进行到框320以取出每一字节码170之前对虚拟机计数器加1。在框330中,VMI 120通过根据字节码170确定字节码170是否为“简单的”——即是否存在由用于字节码170的至少一个本机指令构成的硬件翻译——而对字节码170译码。如果存在用于字节码170的当前硬件翻译,则该方法前进到框370并且相应地处理所述简单字节码。如果没有存在用于该字节码170的硬件翻译,则该字节码170是复杂的。在框340中,VMI对照表140中的参数检验字节码170,所述参数可识别用于复杂字节码的本机指令的适当类属序列。VMI 120挂起字节码170的序列210的翻译,并且依据组成适当软件陷阱的这一类属序列来处理复杂的字节码,其地址位于表140中。软件陷阱通常通过检索对应于字节码170的本机函数并且将该本机函数调度给CPU 110、而不是通过逐指令地解释由字节码170表示的子程序来处理复杂的字节码。本发明的应用编程接口(API)是一项技术规范,其规定了在实施处理RBC时扩充该软件陷阱方法所需的功能,并且规定了怎样访问该功能。如果如框380中假定的那样,字节码170不是递归的,则依据在框340中识别出的适当软件陷阱,在框384中进行本机操作,直到如在框368中那样将控制权返回到VMI。如果如在框350中假定的那样,字节码170是递归的,则本发明的API规定了一个适当的PPA子程序360,其配置用于RBC 230的环境,从而,由RBC 230表示的本机函数能够访问包含有执行子程序所必需的变量值的CPU 110中的寄存器。必需的变量可以包括指向常数池、堆栈、本机和程序代码的指针。在CPU在框364中开始处理对应于RBC 230的本机操作之前,在框362中,由API规定的PPA子程序360执行前同步码。本机的处理继续,直到在框364中遇到本机环境访问函数为止,这就会重启动VMI。在框365中、改变VMI的参数来处理方法220,直到RETURN字节码使任何剩余本机处理的恢复(框366)为止。在本机处理期间遇到另一RETURN字节码则把控制权移回到PPA子程序,在框367中为该PPA子程序执行后同步码,并且,在完成PPA子程序360的执行之后,在框368中、将控制权返回到VMI以便根据新参数进行处理。适当PPA子程序360的地址被存储在表140中并且对应于所述被配置为处理递归的字节码170的软件陷阱。在执行由所述RBC 230调用的本机操作(本机处理)以前执行所述前同步码。如果一个标准前同步码与由RBC 230调用的本机函数相关联,则执行本发明的前同步码,以便或者替换、或者修改与本机函数相关联的标准前同步码。在执行由所述RBC 230调用的本机函数之后执行所述后同步码。类似地,在RBC本机函数中的C RETURN语句之后执行本发明的后同步码,以便或者替换、或者修改与由所述RBC调用的本机函数相关联的标准后同步码(如果存在标准后同步码的话)。As shown at block 310 in FIG. 3 , the VMI 120 increments the virtual machine counter by one before proceeding to block 320 to fetch each bytecode 170. In block 330, VMI 120 responds to Bytecode 170 is decoded. If there is a current hardware translation for the bytecode 170, the method proceeds to block 370 and processes the simple bytecode accordingly. A bytecode 170 is complex if there is no hardware translation for the bytecode 170 . In block 340, the bytecode 170 is checked against parameters in the VMI table 140 that may identify the appropriate generic sequence of native instructions for the complex bytecode. The VMI 120 suspends the translation of the sequence 210 of bytecode 170 and processes the complex bytecode according to this generic sequence that constitutes the appropriate software trap, whose address is located in table 140. Software traps typically handle complex bytecodes by retrieving the native function corresponding to the bytecode 170 and dispatching the native function to the CPU 110, rather than by interpreting the subroutines represented by the bytecode 170 instruction by instruction. The application programming interface (API) of the present invention is a technical specification that specifies the functions required to extend the software trap method when implementing RBC processing, and specifies how to access the functions. If, as assumed in block 380, bytecode 170 is not recursive, then in accordance with the appropriate software trap identified in block 340, perform native operations in block 384 until control is returned as in block 368 to VMI. If, as assumed in block 350, the bytecode 170 is recursive, the API of the present invention specifies an appropriate PPA subroutine 360 configured for the environment of the RBC 230, whereby the present represented by the RBC 230 Machine functions can access registers in CPU 110 that contain variable values necessary to execute the subroutine. Required variables can include pointers to constant pools, stacks, native and program code. In block 362, the PPA subroutine 360 specified by the API executes the preamble before the CPU begins processing the native operations corresponding to the RBC 230 in block 364. Processing of the native machine continues until a native context access function is encountered in block 364, which restarts the VMI. In block 365, the parameters of the VMI are changed to process method 220 until the RETURN bytecode causes any remaining native processing to resume (block 366). Encountering another RETURN bytecode during native processing then shifts control back to the PPA subroutine for which the postamble is executed in block 367, and, after completion of execution of the PPA subroutine 360, In block 368, control is returned to the VMI for processing according to the new parameters. The address of the appropriate PPA subroutine 360 is stored in the table 140 and corresponds to the software trap of the bytecode 170 configured to handle recursion. The preamble is executed before the native operation invoked by the RBC 230 (native processing) is executed. If a standard preamble is associated with a native function called by the RBC 230, then the preamble of the present invention is executed to either replace or modify the standard preamble associated with the native function. The postamble is executed after executing a native function called by the RBC 230. Similarly, the postamble of the present invention is executed after a C RETURN statement in an RBC native function to either replace or modify the standard postamble associated with the native function called by the RBC (if a standard postamble exists). sync code).

依据本发明的示例性实施例的一个方面,所述前同步码将值写入表示诸如堆栈指针之类的某些重要指针的变量,借此使得由RBC 230调用的本机函数能够访问该指针。例如,为了提供对由RBC 230调用的本机函数的环境的访问,定义了几个函数:In accordance with an aspect of an exemplary embodiment of the present invention, the preamble writes a value to a variable representing some important pointer, such as a stack pointer, thereby enabling native functions called by the RBC 230 to access the pointer . For example, to provide access to the environment of native functions called by RBC 230, several functions are defined:

void*vmi_bcc(void*jfp);void*vmi_bcc(void*jfp);

void*vmi_object(void*jfp);void*vmi_object(void*jfp);

void*vmi_jsp(void*jfp);void*vmi_jsp(void*jfp);

void*vmi_cpd(void*jfp);void*vmi_cpd(void*jfp);

void*vmi_cpt(void*jfp);void*vmi_cpt(void*jfp);

void*vmi_bcc(void*jfp);void*vmi_bcc(void*jfp);

类似地,以下函数给出对常数池的访问:Similarly, the following function gives access to a constant pool:

<t>vmi_cpdEntry(void*jfp,unsigned n,<t>)<t>vmi_cpdEntry(void *jfp, unsigned n, <t>)

unsigned char vmi_cptEntry(void*jfp,unsigned n)unsigned char vmi_cptEntry(void*jfp, unsigned n)

以下函数给出对当前和下一字节码170的访问:The following functions give access to the current and next bytecode 170:

unsigned char vmi_bc(void*jfp,n)unsigned char vmi_bc(void*jfp, n)

unsigned char vmi_s hortPar(void* jfp,n)unsigned char vmi_s hortPar(void* jfp, n)

unsigned char vmi_3bytePar(void* jfp,n)unsigned char vmi_3bytePar(void* jfp, n)

unsigned char vmi_wordPar(void*jfp,n)unsigned char vmi_wordPar(void*jfp, n)

以下函数用于访问JavaTM堆栈:The following functions are used to access the Java TM stack:

<t>vmi_stkEntry(void*jfp,n,<t>)<t>vmi_stkEntry(void *jfp, n, <t>)

现在参考图4,VMI的主动翻译(Java字节码处理)功能是由Java虚拟机(JVM)标准规定的。图4表示假定的字节码处理时间线,其中间隔T0-T12表示不一定相等的任意时间的时间段。在间隔T0期间,VMI使用本发明的API作为接口来翻译字节码,直到遇到递归的字节码(RBC)230为止。交叉参照图2中的假定图表,VMI处理字节码B0至B2,然后遇到Bn。当识别出适当的RBC软件陷阱(由API指示出)并且执行对应的PPA子程序的时候,RBC 230(Bn)使得控制权被传递到间隔T1中的本机处理。在间隔T2至T10中,软件陷阱执行由RBC 230调用的本机函数,从而访问(在间隔T4中)由前同步码初始化的环境。例如,根据需要,在间隔T5和T6中重复间隔T3和T4的处理周期(专用于RBC 230的本机操作和对环境访问函数的调用)。本机函数最后(可能在数以千计的本机执行循环之后)产生本机环境访问函数,它在间隔T7重新启动VMI。VMI主动地为新调用的方法处理字节码(假定的字节码Bo至Br),直到在间隔T7遇到一个RETURN字节码(Bs)为止,这就会将控制权返回给本机函数处理。在间隔T8中,或者通过VMI 120硬件、或者通过软件(经由API并且经由诸如C程序设计语言RETURN语句之类的代码实现的),将控制权完全从VMI 120返回到本机处理。本机处理在间隔T10继续,这时另一C RETURN语句将控制转移给PPA子程序,以致在间隔T11中执行后同步码。在控制权在时间间隔T12中重新返回到VMI 120(在假定的字节码Bn+1处)之后,本发明的后同步码将由RBC子程序修改的变量值写回到包含这些变量的CPU寄存器中。根据图5中所示的另一个的实施例,可以执行前同步码和后同步码,以便实现处理新调用的方法(示例性的字节码Bo至Bs)所需的环境改变,例如,改变本机处理在间隔T1开始之前的第一前同步码、所述方法在T9至T11中被处理之前的第一后同步码、在执行该方法之后的间隔T12中的另一前同步码、以及在本机处理完成之后的间隔T16中的最后的后同步码。Referring now to FIG. 4, the active translation (Java bytecode processing) function of the VMI is specified by the Java Virtual Machine (JVM) standard. Figure 4 shows a hypothetical bytecode processing timeline, where the intervals T0-T12 represent periods of arbitrary time that are not necessarily equal. During interval T0, the VMI translates bytecodes using the API of the present invention as an interface until a recursive bytecode (RBC) 230 is encountered. Cross-referencing the hypothetical diagram in Figure 2, the VMI processes bytecodes B0 through B2 before encountering Bn. When the appropriate RBC software trap (indicated by the API) is identified and the corresponding PPA subroutine is executed, the RBC 230(Bn) causes control to be passed to the native process in interval T1. In interval T2 to T10, the software trap executes a native function called by RBC 230, thereby accessing (in interval T4) the environment initialized by the preamble. For example, the processing cycles of intervals T3 and T4 (dedicated to native operations of the RBC 230 and calls to environment access functions) are repeated in intervals T5 and T6 as needed. The native function finally (possibly after thousands of native execution cycles) yields the native environment access function, which restarts the VMI at interval T7. VMI actively processes the bytecodes (presumably bytecodes Bo to Br) for the newly invoked method until it encounters a RETURN bytecode (Bs) at interval T7, which returns control to the native function deal with. In interval T8, control is returned entirely from VMI 120 to native processing, either by VMI 120 hardware, or by software (implemented via API and via code such as the C programming language RETURN statement). Native processing continues in interval T10 when another C RETURN statement transfers control to the PPA subroutine so that the postamble is executed in interval T11. After control is returned to the VMI 120 (at assumed bytecode Bn +1 ) in time interval T12, the postamble of the present invention writes the variable values modified by the RBC subroutine back to the CPU containing these variables register. According to another embodiment shown in FIG. 5, the preamble and postamble may be executed to implement the environment changes required to process the newly invoked method (exemplary bytecodes Bo to Bs), e.g., change native processing of the first preamble before the start of interval T1, the first postamble before the method is processed in T9 to T11, another preamble in interval T12 after execution of the method, and The last postamble in interval T16 after local processing is complete.

再次参看图3,在框368中,由API规定的PPA子程序还被配置成开始恢复在字节码170的序列210的VMI120中的翻译。或者通过VMI120或者通过API实现方式、并且以硬件或者以软件形式的实现方式,将控制权完全地从VMI120返回到本机处理。这一恢复例程的软件实现方式是通过诸如C程序设计语言RETURN语句之类的代码实现的,它通常包括在本机函数中。在从本机处理返回之后,环境被例如vmi_freeFrame破坏,从而,控制权能够被传递回到VMI 120。环境的破坏释放了CPU 110中的被配置为用于处理RBC 230的环境的区域,并且将VMI 120翻译返回到字节码170的序列210中的位置,例如(但不一定)返回到紧跟在最近翻译的RBC 230之后的位置。Referring again to FIG. 3 , in block 368 , the PPA subroutine specified by the API is also configured to begin resuming translation in VMI 120 of sequence 210 of bytecode 170 . Either through the VMI 120 or through an API implementation, and either in hardware or in software, control is returned entirely from the VMI 120 to native processing. The software implementation of this recovery routine is through code such as the C programming language RETURN statement, which is usually included in native functions. After returning from native processing, the context is destroyed by, for example, vmi_freeFrame so that control can be passed back to the VMI 120. The destruction of the context frees an area of the CPU 110 configured to handle the context of the RBC 230, and translates the VMI 120 back to a position in the sequence 210 of the bytecode 170, for example (but not necessarily) to the position immediately following Position after the most recently translated RBC 230.

当在框310中将控制权返回到VMI 120的时候,虚拟机计数器加1,并且,VMI 120取出下一字节码170。因此,由VMI 120进行的翻译将继续,直到遇到另一RBC 230或者翻译处理终止(例如,VMI遇到另一复杂的字节码,或者在字节码之中运行以便处理)为止。When control is returned to the VMI 120 in block 310, the virtual machine counter is incremented and the VMI 120 fetches the next bytecode 170. Thus, translation by the VMI 120 will continue until another RBC 230 is encountered or the translation process terminates (e.g., the VMI encounters another complex bytecode, or runs within the bytecode for processing).

鉴于上述内容,将被理解的是:本发明提供了一种系统和方法,用于支持处理虚拟机指令的软件陷阱方法,以便方便地实现用于准确和有效地处理递归虚拟机指令的方法。此外,仍应理解的是:上文仅仅涉及了本发明的示例性实施例,而在不背离如下列权利要求书中定义的本发明的精神和范围的情况下,可以对其作出很多改变。In view of the foregoing, it will be appreciated that the present invention provides a system and method for supporting a software trap method of processing virtual machine instructions to facilitate the implementation of a method for accurately and efficiently processing recursive virtual machine instructions. Furthermore, it should still be understood that the foregoing relates only to exemplary embodiments of the invention and that many changes may be made therein without departing from the spirit and scope of the invention as defined in the following claims.

Claims (12)

1. method of handling virtual machine instructions comprises:
Initiation parameter is so that identification has the subclass of the virtual machine instructions of special characteristic set;
A collection of described virtual machine instructions is translated as can be by the native instructions of processor execution, till the member in running into the described virtual machine instructions subclass that identifies;
In case run into a member in the described virtual machine instructions subclass that identifies, just hang up translation to described batch of virtual machine instructions;
Realize interface, wherein said interface has been stipulated the set of this machine processor instruction, this instruction set can:
Before this machine processor instruction that the described member who carries out by the described virtual machine instructions subclass that identifies represents, carry out preamble;
This machine of retrieval function from the corresponding processor of representing with described member of instruction by the described virtual machine instructions subclass that identifies;
The native instructions that execution retrieves;
After the native instructions that the described member who carries out by the described virtual machine instructions subclass that identifies represents, carry out postamble; And
The translation of recovery in the virtual machine of described batch of virtual machine instructions wherein, carried out and continued till another member who runs into the described virtual machine instructions subclass that identifies; And
Carry out described machine processor instruction set.
2. the method for claim 1 further comprises:
Before the native instructions of the method for formation that execution retrieves, carry out postamble, wherein, described postamble comprises native instructions, and described native instructions is used to revise the interior variate-value of register of processor, so that realize carrying out the needed environment change of this method; And
Carry out preamble after the native instructions of the method for formation that execution retrieves, wherein, described preamble comprises the register of value from processor is write in the variable that can be visited by the native instructions of carrying out after carrying out this method.
3. the method for claim 1, wherein described preamble and described postamble are produced by virtual machine.
4. the method for claim 1, wherein described preamble and described postamble retrieve from processor storage.
5. the method for claim 1, wherein described preamble comprises the native instructions that the register of value from processor is write variable, and wherein, described variable can be by the instruction access of being represented by the described virtual machine instructions subclass that identifies.
6. the method for claim 1, wherein, described postamble comprises native instructions, and described native instructions is modified to the variate-value in the register of processor in the register of processor according to the instruction of being represented by the described virtual machine instructions subclass that identifies.
7. the method for claim 1, wherein described preamble and described postamble are replaced the conflict instruction that is associated with the described member of the described virtual machine instructions subclass that identifies.
8. the method for claim 1, wherein described preamble and described postamble are revised the conflict instruction that is associated with the described member of the described virtual machine instructions subclass that identifies.
9. the method for claim 1 further comprises beginning to recover subroutine, and wherein, described recovery subroutine comprises:
Register in the processor that release was visited by preamble and postamble; And
Guide the place location restore translation of virtual machine in described batch of virtual machine instructions.
10. method of handling virtual machine instructions comprises:
Environment in the configuration CPU (central processing unit);
Realization is used for the interface of this machine of regulation processor instruction set, and described machine processor instruction set comprises:
Before carrying out this machine processor instruction of representing by described virtual machine instructions, carry out preamble;
From with the corresponding processor of the instruction of representing by described virtual machine instructions retrieval this machine function;
The native instructions that execution retrieves;
After carrying out the native instructions of representing by described virtual machine instructions, carry out postamble; And
Discharge the environment that is disposed; And
Carry out described machine processor instruction set.
11. an equipment that is used to handle virtual machine instructions comprises:
Processor (110), it has the native instructions collection, and is configured to carry out native instructions;
Command memory (150), it is configured to the storage virtual machine instruction;
Pretreater (120), wherein, described pretreater (120) is a virtual machine, it is configured to from command memory (150) to take out virtual machine instructions, and the virtual machine instructions that is configured to take out is translated as the native instructions that can be carried out by processor; And
Interface between described command memory (150) and the described processor (110), it is configured to start a subroutine, this subroutine writes register with the value of the variable that the instruction that can be represented by virtual machine instructions in the described processor unit (100) is visited, send this loom routine call, revise the value of described variable and control is returned to described pretreater according to described virtual machine instructions corresponding to the instruction of representing by virtual machine instructions.
12. the method for this machine processor subroutine that is used to carry out called by virtual machine instructions comprises:
Carried out the preamble set of native instructions before carrying out the subroutine of being called, wherein, described preamble is configured to value is write from the register of processor can be by the variable of the subroutine visit of being called; And
Carry out the postamble set of native instructions after carrying out the subroutine of being called, wherein, described postamble is configured to according to the variate-value in the register of the subroutine modification processor that is called.
CNB028187008A 2001-09-25 2002-09-06 Method for processing virtual machine instructions and executing native processor subroutines Expired - Fee Related CN1295605C (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
EP01402455.8 2001-09-25
EP01402455 2001-09-25

Publications (2)

Publication Number Publication Date
CN1596398A true CN1596398A (en) 2005-03-16
CN1295605C CN1295605C (en) 2007-01-17

Family

ID=8182889

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB028187008A Expired - Fee Related CN1295605C (en) 2001-09-25 2002-09-06 Method for processing virtual machine instructions and executing native processor subroutines

Country Status (7)

Country Link
US (1) US7210140B2 (en)
EP (1) EP1446718A2 (en)
JP (1) JP2005504376A (en)
KR (1) KR20040039412A (en)
CN (1) CN1295605C (en)
AU (1) AU2002329560A1 (en)
WO (1) WO2003027842A2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100456229C (en) * 2006-09-30 2009-01-28 北京深思洛克软件技术股份有限公司 Virtual hardware system and instruction executing method based on virtual hardware system
CN101375266A (en) * 2006-01-25 2009-02-25 Lg电子株式会社 Device Management Scheduling Based on Trap Mechanism
CN100464302C (en) * 2006-04-20 2009-02-25 联想(北京)有限公司 Virtual machine system and its graphics card access method
CN101470635B (en) * 2007-12-24 2012-01-25 联想(北京)有限公司 Method for multi-virtual processor synchronous scheduling and computer thereof

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1313012A1 (en) * 2001-11-15 2003-05-21 Texas Instruments France Java DSP acceleration by byte-code optimization
US9207958B1 (en) 2002-08-12 2015-12-08 Arm Finance Overseas Limited Virtual machine coprocessor for accelerating software execution
US9020801B2 (en) 2003-08-11 2015-04-28 Scalemp Inc. Cluster-based operating system-agnostic virtual computing system
EP1622009A1 (en) * 2004-07-27 2006-02-01 Texas Instruments Incorporated JSM architecture and systems
US7685635B2 (en) * 2005-03-11 2010-03-23 Microsoft Corporation Systems and methods for multi-level intercept processing in a virtual machine environment
JP2006344017A (en) * 2005-06-09 2006-12-21 Hitachi Ltd Sensor network system and sensor network data processing method
US8327353B2 (en) * 2005-08-30 2012-12-04 Microsoft Corporation Hierarchical virtualization with a multi-level virtualization mechanism
US8683453B2 (en) * 2006-11-30 2014-03-25 Motorola Mobility Llc System for overriding interpreted byte-code with native code
KR101407629B1 (en) * 2007-06-04 2014-06-13 더 보드 오브 리젠츠 오브 더 유니버시티 오브 텍사스 시스템 Apparatus and method for accelerating java translation
US9389839B2 (en) 2008-06-26 2016-07-12 Microsoft Technology Licensing, Llc Safe code for signature updates in an intrusion prevention system
US8286164B2 (en) * 2009-08-07 2012-10-09 International Business Machines Corporation Secure recursive virtualization
US20110153909A1 (en) * 2009-12-22 2011-06-23 Yao Zu Dong Efficient Nested Virtualization
US9594578B2 (en) * 2012-02-28 2017-03-14 Red Hat, Inc. Hardware implementation of a virtual machine interpreter
US9836316B2 (en) * 2012-09-28 2017-12-05 Intel Corporation Flexible acceleration of code execution
US10498763B2 (en) * 2017-08-31 2019-12-03 International Business Machines Corporation On-demand injection of software booby traps in live processes

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4253145A (en) * 1978-12-26 1981-02-24 Honeywell Information Systems Inc. Hardware virtualizer for supporting recursive virtual computer systems on a host computer system
US6199095B1 (en) * 1996-01-29 2001-03-06 Compaq Computer Corporation System and method for achieving object method transparency in a multi-code execution environment
US5875336A (en) * 1997-03-31 1999-02-23 International Business Machines Corporation Method and system for translating a non-native bytecode to a set of codes native to a processor within a computer system
WO1999018486A2 (en) * 1997-10-02 1999-04-15 Koninklijke Philips Electronics N.V. Data processing device for processing virtual machine instructions
EP0941508B1 (en) * 1997-10-02 2007-01-17 Koninklijke Philips Electronics N.V. Variable instruction set computer
US6314445B1 (en) * 1998-08-03 2001-11-06 International Business Machines Coproration Native function calling
US6385764B1 (en) * 1999-01-29 2002-05-07 International Business Machines Corporation Method and apparatus for improving invocation speed of Java methods

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101375266A (en) * 2006-01-25 2009-02-25 Lg电子株式会社 Device Management Scheduling Based on Trap Mechanism
CN101375266B (en) * 2006-01-25 2015-08-12 Lg电子株式会社 Device Management Scheduling Based on Trap Mechanism
US9385916B2 (en) 2006-01-25 2016-07-05 Lg Electronics Inc. Device management scheduling based on trap mechanism
CN100464302C (en) * 2006-04-20 2009-02-25 联想(北京)有限公司 Virtual machine system and its graphics card access method
CN100456229C (en) * 2006-09-30 2009-01-28 北京深思洛克软件技术股份有限公司 Virtual hardware system and instruction executing method based on virtual hardware system
CN101470635B (en) * 2007-12-24 2012-01-25 联想(北京)有限公司 Method for multi-virtual processor synchronous scheduling and computer thereof

Also Published As

Publication number Publication date
WO2003027842A3 (en) 2004-06-17
AU2002329560A1 (en) 2003-04-07
KR20040039412A (en) 2004-05-10
US20030061254A1 (en) 2003-03-27
CN1295605C (en) 2007-01-17
JP2005504376A (en) 2005-02-10
WO2003027842A2 (en) 2003-04-03
EP1446718A2 (en) 2004-08-18
US7210140B2 (en) 2007-04-24

Similar Documents

Publication Publication Date Title
US11385872B2 (en) Extending a virtual machine instruction set architecture
CN1596398A (en) Software support for virtual machine interpreter (VMI) acceleration hardware
CN1161691C (en) Memory controller for detecting prediction failure of addressed unit
US6381737B1 (en) Automatic adapter/stub generator
US7913240B2 (en) Method and apparatus for transforming java native interface function calls into simpler operations during just-in-time compilation
CN1141647C (en) Method and apparatus for aliasing memory data in an advanced microprocessor
EP1300758B1 (en) Dynamically switching statically bound function calls to dynamically bound function calls without recomplication
WO2006131710A1 (en) Method and apparatus for converting program code with access coordination for a shared resource
US7065755B2 (en) Method and apparatus for removing class initialization barriers from shared compiled methods
US6931638B2 (en) Method and apparatus to facilitate sharing optimized instruction code in a multitasking virtual machine
JP3621116B2 (en) Conversion memory protector for advanced processors
US20030093456A1 (en) Low overhead exception checking
CN1107909C (en) Host microprocessor with apparatus for temporarily holding target processor state
CN1262753A (en) Improved microprocessor

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C19 Lapse of patent right due to non-payment of the annual fee
CF01 Termination of patent right due to non-payment of annual fee