This application is based upon and claims the benefit of priority from the prior Japanese Patent Application No. 2003-304780, filed Aug. 28, 2003, the entire contents of which are incorporated herein by reference.
1. Field of the Invention
The present invention relates generally to a computer system using a virtual machine, particularly to a technique for managing software in a virtual machine code.
2. Description of the Related Art
Computer systems for executing software (e.g., Java program, Java is a registered trademark) which does not depend on hardware of a computer or a platform of an operating system (OS) or the like have heretofore been used in various types of electronic apparatuses.
The software is a computer program operating on a plurality of different instruction set architectures, and is executed by a computer system on which software called a virtual machine (VM) is mounted.
The virtual machine executes a virtual instruction string (virtual machine code) which defines a virtual instruction set architecture and in which a program described in a high-level language (e.g., Java language) is compiled.
For example, in a system having Java virtual machine specifications, a source code described in the Java language is converted into a virtual machine code (Java byte code) which is an execution format program of the virtual machine by a compiler. The software, especially package software, is managed by the virtual machine code, and executed when the virtual machine code is interpreted by the virtual machine. There is also a system for converting the virtual machine code into a machine code which is an execution format code of a specific machine (microprocessor: CPU) to be executed by a just-in-time (JIT) compiler at the time of execution.
Many virtual machines constituted of instruction sets virtualized in this manner have a high degree of abstraction so that various types of architectures can be universally handled. Therefore, an execution efficiency of the software having the virtual machine specifications lowers as compared with software described in an assembly code specialized and developed for a specific CPU architecture especially to pursue an ultimate performance of the computer. Therefore, especially a program requiring a high performance specialized for the hardware is described in the assembly code while versatility is sacrificed in many cases.
Additionally, a system has also been developed in which the program described in the assembly code is translated into a program of another architecture and executed, or instructions are interpreted/executed one by one at the time of execution in order to obtain versatility of the virtual machine (see U.S. Pat. No. 6,021,272 or 5,307,492, for example).
However, in the method described in the prior-art document or the like, for example, even when a program specialized for a single instruction multiple data (SIMD) instruction or the architecture of a special memory hierarchy is simply converted into a program corresponding to the other architecture, advantages of specialty cannot be inherited.
On the other hand, when the architecture is version-upgraded, it is sometimes difficult to efficiently operate an old version of a program in a new version because of the specialty.
In accordance with one embodiment of the present invention, there is provided a computer system including facilities to manage package software constituted of a virtual machine code to which virtual machine description defining an architecture assumed by a virtual machine has been added.
The system comprises: first storage unit for storing virtual machine description which defines an architecture of a virtual machine; generating unit for generating a virtual machine code from a program which is an execution object; second storage unit for storing software constituted of the virtual machine code to which the virtual machine description has been added; and management unit for taking the software from the second storage unit to execute the software, when the program is executed.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention, and together with the general description given above and the detailed description of the embodiments given below, serve to explain the principles of the invention.
Embodiments of the present invention will be described hereinafter with reference to the drawings.
(Constitution of System)
As shown in
The virtual machine code (VMC) 30 corresponds to a Java byte code having, for example, Java virtual machine specifications, and is an execution format program of a virtual machine. The target machine (CPU) converts the virtual machine code (VMC) 30 into a machine code to execute the code at the time of execution.
Furthermore, the present system 1 includes a storage device 50 for managing software. The storage In the storage device 50, virtualization level information 51 necessary for reverse compilation by the reverse compiler 20, target machine description (TMD) 52, virtual machine description (VMD) 53, and package program 54 described later are stored.
Here, the present system 1 is connected to Internet 2, and also executes an operation for supplying the package program 54 being managed in accordance with a request from another computer system.
Concretely, as shown in
The reverse compiler 20 executes reverse compilation to convert the assembly code 10 into the virtual machine code 30 using the TMD 52 in accordance with a virtualization level by the virtualization level information 51. The reverse compiler 20 executes processing similar to usual reverse compilation as shown in a flowchart of
It is to be noted that a method of using the TMD 52 is similar to a method of using machine description in processing of a disassembler described, for example, in U.S. Pat. No. 6,021,272 which is a prior-art document.
That is, as shown in
Furthermore, the reverse compiler 20 may also retrace the virtualization hierarchy to repeat conversion in accordance with the virtualization level designated based on the designated virtualization level information 51. The reverse compiler 20 may also check dependence of the assembly code 10 on data between instructions, and notify pipeline hazard information or provide another hint for the optimization. When this mechanism is mounted, the assembly code developer can correct the assembly code and efficiently perform tuning in accordance with the hint.
Additionally, in the present system 1, a program 40 in which the designated virtual machine description (VMD) 53 stored in the storage device 50 has been added to the virtual machine code (VMC) 30 generated by the reverse compiler 20 is stored as the package program 54 in the storage device 50.
As described above, the computer system 1 of the present embodiment converts the assembly code 10 specialized and designed for the target machine (CPU) having the specific architecture into the virtual machine code (VMC) 30. Moreover, the present system 1 manages and operates the software by units of the program 40 in which the VMC 30 and the virtual machine description (VMD) 53 are packaged.
In the present system 1, as shown in
Therefore, the computer system 1 of the present embodiment converts the assembly code 10 specialized and designed for the specific CPU architecture at the time of development of the program into the virtual machine code 30 having a high degree of abstraction (high versatility). That is, the virtual machine code 30 assuming a virtual architecture can cope with various types of architectures.
Furthermore, the computer system 1 of the present embodiment manages the software by the units of the program 40 in which the virtual machine code 30 and the virtual machine description (VMD) 53 are packaged. That is, when the VMD 53 defining various types of virtual architectures is added, it is possible to manage and operate the software in which a special architecture (e.g., SIMD instruction, special memory hierarchy, etc.) included in the software described in the assembly code 10 is reflected.
Therefore, it is possible to improve applicability to the specific architecture together with the versatility, with these virtual machine specifications.
Concretely, when the virtual machine code 30 is converted into the machine code of the target machine having an architecture different from that at the time of the development of the program, the code can be converted into a machine code in which the special architecture at the time of the development is reflected by the VMD 53.
Moreover, even when the architecture at the time of the development of the program is version-upgraded, version-upgraded contents are included into the VMD 53, and it is accordingly possible to efficiently operate an older version of the program in a new version.
In short, according to a software management method of the present embodiment, the assembly code specialized for the specific architecture is managed and operated in a format of the virtual machine code (VMC) abstracted by the reverse compilation.
Moreover, the VMC, the virtual machine description (VMD), and the target machine description (TMD) are separately managed (stored). Therefore, it is possible to improve the applicability to another target machine or the version-upgraded architecture without impairing an execution performance of the program described in the assembly code. As a result, it is possible to reduce management and operation costs of the software.
It is to be noted that it is inefficient in the management to add copies of all information to each package with respect to the virtual machine description (VMD) 53, and therefore a method of adding ID information for identifying the VMD 53 to the VMC 30 to manage the software may also be used.
Furthermore, a program developer or user may also add information such as reservation of a resource which is an environment for operating the program, allocation, topology on network, and cooperation environment as expansion of the VMD 53 if necessary.
Additionally, the computer system 1 of the present embodiment may also include a mechanism for instructing the reverse compiler 20 to maintain a instruction order, register allocation and the like in the assembly code developed by in consideration of the performance of the CPU, so that reversible conversion is executed to return the virtual machine code to the original assembly code at the time of the execution of the program.
(Other Embodiment)
In the present embodiment, as shown in
A constitution of the present embodiment will be described hereinafter with reference to the flowchart of
The home server 500 downloads a virtual machine code (VMC having a virtualization level X) which is a desired application program from the internet 2 (step S11).
The home server 500 uses the TMD of the architecture (A), and converts the downloaded VMC having the virtualization level X into the VMC having a virtualization level A which has a relatively low degree of abstraction to store the code (step S12).
The home server 500 executes the VMC having the virtualization level A by a virtual machine (VM-A) 510 having the virtualization level A at the time of the execution of the application program. Accordingly, the CPU 520 executes the machine code converted from the VMC having the virtualization level A to execute the application program.
On the other hand, for example, when the VMC having the virtualization level A is transferred from the home server 500, the electronic apparatus 600 converts the VMC into that having a virtualization level B whose degree of abstraction is even lower to store the code (step S13). At this time, the electronic apparatus 600 converts the VMC into that having the virtualization level B using the virtual machine description (VMD) and the TMD of the architecture (A) corresponding to the virtualization level B.
Moreover, the electronic apparatus 600 executes the VMC having the virtualization level B by a virtual machine (VM-B) 610 having the virtualization level B at the time of the execution of the application program. Accordingly, the CPU 620 executes the machine code converted from the VMC having the virtualization level B to execute the application program (steps S14, S15).
It is to be noted that this also applies to the electronic apparatus 700. At the time of the execution of the application program, the apparatus executes the VMC having a virtualization level C by a virtual machine (VM-C) 710 having the virtualization level C. Accordingly, the CPU 720 executes the machine code converted from the VMC having the virtualization level C to execute the application program.
As described above, according to the present embodiment, there is provided a mechanism for converting the virtual machine code having a virtualization level which has a relatively high degree of abstraction into the virtual machine code whose degree of abstraction is relatively low, instead of immediately converting the virtual machine code into a machine code of a real machine. Accordingly, the high-rank home server 500 constituting the home network stores the virtual machine code having the virtualization level which has a relatively high degree of abstraction, and converts the code into the machine code at the time of the execution of the application program. Therefore, the code is converted into the code having a final machine level in accordance with the resource to which the application program is allocated in a stage in which the program actually operates, and accordingly relatively dense optimization can be realized.
In short, various virtualization levels can be defined as the virtualization levels, and the application program can be held at a virtualization level which is suitable for circulation or distribution of the application program through the network, loading onto a memory, execution, primary storage and the like. Accordingly, the optimization of the application program is flexibly applied, and the conversion cost of the program can be reduced.
Moreover, the home server 500 or the respective electronic apparatuses 600, 700 may also include a mechanism for rewriting the virtual machine code having an original or intermediate level based on profile information or the like at the time of the execution of the program.
Furthermore, information such as the reservation of the resource which is the environment for operating the program, allocation, topology on the network, and cooperation environment is abstracted, and packaged together with the virtual machine code. Accordingly, a program for performing real-time processing including many restrictions or distributed data processing can be circulated.
Additional advantages and modifications will readily occur to those skilled in the art. Therefore, the invention in its broader aspects is not limited to the specific details and representative embodiments the specific details and representative embodiments shown and described herein. Accordingly, various modifications may be made without departing from the spirit or scope of the general invention concept as defined by the appended claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
2003-304780 | Aug 2003 | JP | national |