Java™ is an object orientated programming language developed by Sun Microsystems. The Java language is small, simple and portable across platforms and operating systems, both at the source and at the binary level. This makes the Java programming language very popular on the Internet.
Java's platform independence and code compaction are the most significant advantages of Java over conventional programming languages. In conventional programming languages, the source code of a program is sent to a compiler which translates the program into machine code or processor instructions. The processor instructions are native to the system's processor. If the code is compiled on an Intel-based system, the resulting program will only run on other Intel-based systems. If it is desired to run the program on another system, the user must go back to the original source code, obtain a compiler for the new processor, and recompile the program into the machine code specific to that other processor.
Java operates differently. The Java compiler takes a Java program and, instead of generating machine code for a particular processor, generates bytecodes. Bytecodes are instructions that look like machine code, but aren't specific to any processor. To execute a Java program, a bytecode interpreter takes the Java bytecode converts them to equivalent native processor instructions and executes the Java program. The Java byte code interpreter is one component of the Java Virtual Machine.
Having the Java programs in bytecode form means that instead of being specific to any one system, the programs can run on any platform and any operating system as long a Java Virtual Machine is available. This allows a binary bytecode file to be executable across platforms.
The disadvantage of using bytecodes is execution speed. System specific programs that run directly on the hardware from which they are compiled, run significantly faster that Java bytecodes, which must be processed by the Java Virtual Machine. The processor must both convert the Java bytecodes into native instructions in the Java Virtual Machine and execute the native instructions.
One way to speed up the Java Virtual Machine is by techniques such as the “Just in Time” (JIT) interpreter, and even faster interpreters known as “Hot Spot JITs” interpreters. The JIT versions all result in a JIT compile overhead to generate native processor instructions. These JIT interpreters also result in additional memory overhead.
The slow execution speed of Java and overhead of JIT interpreters have made it difficult for consumer appliances requiring local-cost solutions with minimal memory usage and low energy consumption to run Java programs. The performance requirements for existing processors using the fastest JITs more than double to support running the Java Virtual Machine in software. The processor performance requirements could be met by employing superscalar processor architectures or by increasing the processor clock frequency. In both cases, the power requirements are dramatically increased. The memory bloat that results from JIT techniques, also goes against the consumer application requirements of low cost and low power.
It is desired to have an improved system for implementing Java programs that provides a low-cost solution for running Java programs for consumer appliances.
The present invention generally relates to a Java hardware accelerator which can be used to quickly translate Java bytecodes into native instructions for a central processing unit (CPU). The hardware accelerator speeds up the processing of the Java bytecodes significantly because it removes the bottleneck which previously occurred when the Java Virtual Machine is run in software on the CPU to translate Java bytecodes into native instructions.
In the present invention, at least part of the Java Virtual Machine is implemented in hardware as the Java hardware accelerator. The Java hardware accelerator and the CPU can be put together on a single semiconductor chip to provide an embedded system appropriate for use with commercial appliances. Such an embedded system solution is less expensive than a powerful superscalar CPU and has a relatively low power consumption.
The hardware Java accelerator can convert the stack-based Java bytecodes into a register-based native instructions on a CPU. The hardware accelerators of the present invention are not limited for use with Java language and can be used with any stack-based language that is to be converted to register-based native instructions. Also, the present invention can be used with any language that uses instructions, such as bytecodes, which run on a virtual machine.
The present invention may be further understood from the following description in conjunction with the drawings.
The Java hardware accelerator can do, some or all of the following tasks:
1. Java bytecode decode;
2. identifying and encoding instruction level parallelism (ILP), wherever possible;
3. translating bytecodes to native instructions;
4. managing the Java stack on a register file associated with the CPU or as a separate stack;
5. generating exceptions on instructions on predetermined Java byte codes;
6. switching to native CPU operation when native CPU code is provided;
7. performing bounds checking on array instructions; and
8. managing the variables on the register file associated with the CPU.
In a preferred embodiment, the Java Virtual Machine functions of bytecode interpreter, Java register, and Java stack are implemented in the hardware Java accelerator. The garbage collection heap and constant pool area can be maintained in normal memory and accessed through normal memory referencing.
The major advantages of the Java hardware accelerator is to increase the speed in which the Java Virtual Machine operates, and allow existing native language legacy applications, software base, and development tools to be used. A dedicated microprocessor in which the Java bytecodes were the native instructions would not have access to those legacy applications.
Although the Java hardware accelerator is shown in
In block 38, the system switches to the Java hardware accelerator mode. In the Java hardware accelerator mode, Java bytecode is transferred to the Java hardware accelerator 22, converted into native instructions then sent to the CPU for operation.
The Java accelerator mode can produce exceptions at certain Java bytecodes. These bytecodes are not processed by the hardware accelerator 22 but are processed in the CPU 26. As shown in block 40, the system operates in the native mode but the Java Virtual Machine is implemented in the CPU which does the bytecode translation and handles the exception created in the Java accelerator mode.
The longer and more complicated bytecodes that are difficult to handle in hardware can be selected to produce the exceptions.
In a preferred embodiment, the hardware Java registers 44 can include additional registers for the use of the instruction translation hardware 42. These registers can include a register indicating a switch to native instructions and a register indicating the version number of the system.
The Java PC can be used to obtain bytecode instructions from the instruction cache 24. In one embodiment the Java PC is multiplexed with the normal program counter 54 of the central processing unit 26 in multiplexer 52. The normal PC 54 is not used during the operation of the Java hardware bytecode translation. In another embodiment, the normal program counter 54 is used as the Java program counter.
The Java registers are a part of the Java Virtual Machine and should not be confused with the general registers 46 or 48 which are operated upon by the central processing unit 26. In one embodiment, the system uses the traditional CPU register file 46 as well as a Java CPU register file 48. When native code is being operated upon the multiplexer 56 connects the conventional register file 46 to the execution logic 26c of the CPU 26. When the Java hardware accelerator is active, the Java CPU register file 48 substitutes for the conventional CPU register file 46. In another embodiment, the conventional CPU register file 46 is used.
As described below with respect to
The register files for the CPU could alternately be implemented as a single register file with native instructions used to manipulate the loading of operand stack and variable values to and from memory. Alternately, multiple Java CPU register files could be used: one register file for variable values, another register file for the operand stack values, and another register file for the Java frame stack holding the method environment information.
The Java accelerator controller (co-processing unit) 64 can be used to control the hardware Java accelerator, read in and out from the hardware Java registers 44 and Java stack 50, and flush the Java accelerator instruction translation pipeline upon a “branch taken” signal from the CPU execute logic 26c.
The CPU 26 is divided into pipeline stages including the instruction fetch 26a, instruction decode 26b, execute logic 26c, memory access logic 26d, and writeback logic 26e. The execute logic 26c executes the native instructions and thus can determine whether a branch instruction is taken and issue the “branch taken” signal.
The decoded bytecodes are sent to a state machine unit 74 and Arithmetic Logic Unit (ALU) 76. The ALU 76 is provided to rearrange the bytecode instructions to make them easier to be operated on by the state machine 74. The state machine 74 converts the bytecodes into native instructions using the look-up table 78. Thus, the state machine 74 provides an address which indicates the location of the desired native instruction in the look-up table 78. Counters are maintained to keep a count of how many entries have been placed on the operand stack, as well as to keep track of the top of the operand stack. In a preferred embodiment, the output of the look-up table 78 is augmented with indications of the registers to be operated on at line 80. The register indications are from the counters and interpreted from bytecodes. Alternately, these register indications can be sent directly to the Java CPU register file 48 shown in
The state machine 74 has access to the Java registers in 44 as well as an indication of the arrangement of the stack and variables in the Java CPU register file 48 or in the conventional CPU register file 46. The buffer 82 supplies the translated native instructions to the CPU.
The operation of the Java hardware accelerator of one embodiment of the present invention is illustrated in
As shown in
Consistency must be maintained between the Hardware Java Registers 44, the Java CPU register file 48 and the data memory. The CPU 26 and Java Accelerator Instruction Translation Unit 42 are pipelined and any changes to the hardware java registers 44 and changes to the control information for the Java CPU register file 48 must be able to be undone upon a “branch taken” signal. The system preferably uses buffers (not shown) to ensure this consistency. Additionally, the Java instruction translation must be done so as to avoid pipeline hazards in the instruction translation unit and CPU.
In the present invention the Java hardware translator can combine the iload_n and iadd bytecode into a single native instruction. As shown in
As shown in
The Java hardware accelerator of the present invention is particularly well suited to a embedded solution in which the hardware accelerator is positioned on the same chip as the existing CPU design. This allows the prior existing software base and development tools for legacy applications to be used. In addition, the architecture of the present embodiment is scalable to fit a variety of applications ranging from smart cards to desktop solutions. This scalability is implemented in the Java accelerator instruction translation unit of
While the present invention has been described with reference to the above embodiments, this description of the preferred embodiments and methods is not meant to be construed in a limiting sense. For example, the term Java in the specification or claims should be construed to cover successor programming languages or other programming languages using basic Java concepts (the use of generic instructions, such as bytecodes, to indicate the operation of a virtual machine). It should also be understood that all aspects of the present invention are not to be limited to the specific descriptions, or to configurations set forth herein. Some modifications in form and detail the various embodiments of the disclosed invention, as well as other variations in the present invention, will be apparent to a person skilled in the art upon reference to the present disclosure. It is therefore contemplated that the following claims will cover any such modifications or variations of the described embodiment as falling within the true spirit and scope of the present invention.
The present application is a continuation of the application entitled “Java™ Hardware Accelerator Using Microcode Engine,” filed “on Aug. 24, 2001, inventor Mukesh K. Patel, et al., U.S. application Ser. No. 09/938,886 now U.S. Pat. No. 7,080,362”, which is in turn a continuation-in-part of the application entitled “Java™ Virtual Machine Hardware for RISC and CISC Processors,” filed Dec. 8, 1998, inventor Mukesh K. Patel, et al., U.S. application Ser. No. 09/208,741 now U.S. Pat. No. 6,332,215.
Number | Name | Date | Kind |
---|---|---|---|
3889243 | Drimak | Jun 1975 | A |
4236204 | Groves | Nov 1980 | A |
4334269 | Shibasaki et al. | Jun 1982 | A |
4524416 | Stanley et al. | Jun 1985 | A |
4587612 | Fisk et al. | May 1986 | A |
4587632 | Ditzel | May 1986 | A |
4631663 | Chilinski et al. | Dec 1986 | A |
4763255 | Hopkins et al. | Aug 1988 | A |
4783738 | Li et al. | Nov 1988 | A |
4860191 | Nomura et al. | Aug 1989 | A |
4922414 | Holloway et al. | May 1990 | A |
4961141 | Hopkins et al. | Oct 1990 | A |
4969091 | Muller | Nov 1990 | A |
5077657 | Cooper et al. | Dec 1991 | A |
5113522 | Dinwiddie, Jr. et al. | May 1992 | A |
5136696 | Beckwith et al. | Aug 1992 | A |
5142681 | Driscoll et al. | Aug 1992 | A |
5163139 | Haigh et al. | Nov 1992 | A |
5193180 | Hastings | Mar 1993 | A |
5201056 | Daniel et al. | Apr 1993 | A |
5218711 | Yoshida | Jun 1993 | A |
5241636 | Kohn | Aug 1993 | A |
5265206 | Shackelford et al. | Nov 1993 | A |
5307492 | Benson | Apr 1994 | A |
5313614 | Goettelmann et al. | May 1994 | A |
5333296 | Bouchard et al. | Jul 1994 | A |
5335344 | Hastings | Aug 1994 | A |
5355460 | Eickemeyer et al. | Oct 1994 | A |
5361334 | Cawley | Nov 1994 | A |
5430862 | Smith et al. | Jul 1995 | A |
5481684 | Richter et al. | Jan 1996 | A |
5490256 | Mooney et al. | Feb 1996 | A |
5535329 | Hastings | Jul 1996 | A |
5542059 | Blomgren | Jul 1996 | A |
5574927 | Scantlin | Nov 1996 | A |
5577233 | Goettelmann et al. | Nov 1996 | A |
5584026 | Knudsen et al. | Dec 1996 | A |
5619665 | Phillip | Apr 1997 | A |
5619666 | Coon et al. | Apr 1997 | A |
5634118 | Blomgren | May 1997 | A |
5638525 | Hammond et al. | Jun 1997 | A |
5650948 | Gafter | Jul 1997 | A |
5659703 | Moore et al. | Aug 1997 | A |
5668999 | Gosling | Sep 1997 | A |
5692170 | Isaman et al. | Nov 1997 | A |
5740441 | Yellin et al. | Apr 1998 | A |
5740461 | Jaggar | Apr 1998 | A |
5748964 | Gosling | May 1998 | A |
5752035 | Trimberger | May 1998 | A |
5761477 | Wahbe et al. | Jun 1998 | A |
5764908 | Shoji et al. | Jun 1998 | A |
5768593 | Walters et al. | Jun 1998 | A |
5774868 | Cragun et al. | Jun 1998 | A |
5778178 | Arunachalam | Jul 1998 | A |
5781750 | Blomgren et al. | Jul 1998 | A |
5784584 | Moore et al. | Jul 1998 | A |
5794068 | Asghar et al. | Aug 1998 | A |
5805895 | Breternitz, Jr. et al. | Sep 1998 | A |
5809336 | Moore et al. | Sep 1998 | A |
5838165 | Chatter | Nov 1998 | A |
5838948 | Bunza | Nov 1998 | A |
5875336 | Dickol et al. | Feb 1999 | A |
5889996 | Adams | Mar 1999 | A |
5898850 | Dickol et al. | Apr 1999 | A |
5898885 | Dickol et al. | Apr 1999 | A |
5903761 | Tyma | May 1999 | A |
5905895 | Halter | May 1999 | A |
5920720 | Toutonghi et al. | Jul 1999 | A |
5923892 | Levy | Jul 1999 | A |
5925123 | Tremblay et al. | Jul 1999 | A |
5926832 | Wing et al. | Jul 1999 | A |
5937193 | Evoy | Aug 1999 | A |
5953736 | O'Connor et al. | Sep 1999 | A |
5953741 | Evoy | Sep 1999 | A |
5970249 | Holzle et al. | Oct 1999 | A |
5983334 | Coon et al. | Nov 1999 | A |
5999731 | Yellin et al. | Dec 1999 | A |
6003038 | Chen et al. | Dec 1999 | A |
6009499 | Koppala | Dec 1999 | A |
6014723 | Tremblay et al. | Jan 2000 | A |
6021469 | Tremblay et al. | Feb 2000 | A |
6026485 | O'Connor et al. | Feb 2000 | A |
6031992 | Cmelik et al. | Feb 2000 | A |
6038643 | Tremblay et al. | Mar 2000 | A |
6052526 | Chatt | Apr 2000 | A |
6065108 | Tremblay et al. | May 2000 | A |
6067577 | Beard | May 2000 | A |
6071317 | Nagel | Jun 2000 | A |
6075940 | Gosling | Jun 2000 | A |
6075942 | Cartwright, Jr. | Jun 2000 | A |
6076141 | Tremblay et al. | Jun 2000 | A |
6081665 | Nilsen et al. | Jun 2000 | A |
6085198 | Skinner et al. | Jul 2000 | A |
6085307 | Evoy et al. | Jul 2000 | A |
6108768 | Koppala et al. | Aug 2000 | A |
6110226 | Bothner | Aug 2000 | A |
6118940 | Alexander, III et al. | Sep 2000 | A |
6122638 | Huber et al. | Sep 2000 | A |
6125439 | Tremblay et al. | Sep 2000 | A |
6131144 | Koppala | Oct 2000 | A |
6131191 | Cierniak et al. | Oct 2000 | A |
6139199 | Rodriguez | Oct 2000 | A |
6141794 | Dice et al. | Oct 2000 | A |
6148391 | Petrick | Nov 2000 | A |
6151702 | Overturf et al. | Nov 2000 | A |
6158048 | Lueh et al. | Dec 2000 | A |
6167488 | Koppala | Dec 2000 | A |
6170083 | Adl-Tabatabai | Jan 2001 | B1 |
6209077 | Robertson et al. | Mar 2001 | B1 |
6212604 | Tremblay | Apr 2001 | B1 |
6233678 | Bala | May 2001 | B1 |
6249861 | Tremblay et al. | Jun 2001 | B1 |
6275903 | Koppala et al. | Aug 2001 | B1 |
6275984 | Morita | Aug 2001 | B1 |
6292883 | Augusteijn et al. | Sep 2001 | B1 |
6292935 | Lueh et al. | Sep 2001 | B1 |
6298434 | Lindwer | Oct 2001 | B1 |
6317872 | Gee et al. | Nov 2001 | B1 |
6321323 | Nugroho et al. | Nov 2001 | B1 |
6324686 | Komatsu et al. | Nov 2001 | B1 |
6330659 | Poff et al. | Dec 2001 | B1 |
6349377 | Lindwer | Feb 2002 | B1 |
6374286 | Gee et al. | Apr 2002 | B1 |
6532531 | O'Connor et al. | Mar 2003 | B1 |
6606743 | Raz et al. | Aug 2003 | B1 |
6901591 | Sokolov | May 2005 | B1 |
7080362 | Patel et al. | Jul 2006 | B2 |
7478224 | Strom et al. | Jan 2009 | B2 |
20020078115 | Poff et al. | Jun 2002 | A1 |
20030115238 | O'Connor et al. | Jun 2003 | A1 |
Number | Date | Country | |
---|---|---|---|
20060200801 A1 | Sep 2006 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 09938886 | Aug 2001 | US |
Child | 11353432 | US | |
Parent | 09208741 | Dec 1998 | US |
Child | 09938886 | US |