16 Registers Visible
These are the two only changes to the ARM architecture (see the figure). Nothing else is visible to the programmer because the machine directly executes Java byte codes and makes some special use of the existing ARM registers. The ARM has 16 registers that are visible in the user mode. Other registers are used for exception processing, but they're not visible to the user. Each exception mode, then, has its own register set.
The company profiled some Java applications and discovered that most Java methods (a method is a Java subroutine) only use three or four operands. This means only a stack depth of three or four operands is needed. These four elements can then be put in registers inside the processor. Doing so prevents a lot of the pushing and popping of items in the stack caused by memory accesses.
"Only if the method uses more than four-stack elements does the processor need to start pushing and popping from a real stack held in memory," Cormie explains. "That's why the Java extension is very efficient." Stack and even memory operations all are automatically completed by hardware. As a result, the programmer doesn't have to know about them.
For efficiency, ARM keeps one of the local variables at zero in one of the ARM registers. Java applications frequently use the local variable at zero as a pointer to data. By keeping it in a register rather than in memory, the processor can perform better.
Additionally, ARM uses other registers for other pointers. A pointer to the exception table holds the instruction sequences for the instructions that are not executed directly. Also, there is a pointer to the Java stack, a pointer to the Java variables area, and a pointer to the constant pool. Java programs access these groups of data all the time and keep them in existing ARM registers.
Programmers never have a reason to use or manipulate the registers described here, but it helps to understand how efficiently the core works. When running a Java program, programmers can't address these registers. According to Cormie, there is no Java byte code like "get the ARM register 6."
"Java registers do not manipulate ARM registers and ARM does not intend to support programming at this level because it is not useful and could lead to someone producing an application that was not portable," he says. "The important thing to remember is that Java is designed primarily for portability and to ensure portability." This is why the Java instruction set needs to be compiled.
"Programmers manipulate a stack-based machine as its own architecture, and the Java machine uses the existing ARM hardware and registers to emulate that," Cormie notes. "That way, the design is very efficient because there's no need to put a lot of extra hardware into the machine to do this and it's not necessary to build extra registers."
Consequently, calling the Java mode is exactly like calling a subroutine. The return (from subroutine) is fairly straightforward. There are a number of unused Java byte codes. All of the unused byte codes are handled as exceptions. One of the unused byte codes is used as the means to return to the calling program. Whenever this byte code is encountered, the hardware takes an exception because it's an undefined byte code. The exception handler recognizes that byte code as a "return me to the calling program" instruction, and it will do that.
A Java-enabled core will service interrupts and exceptions using the existing ARM model. All of the interpreted sequences are interruptible and re-startable, so there is no impact on interrupt latency. Java-enabled ARM cores support all of the Sun Microsystems J2ME virtual machines (JVM, KVM, CVM) and a range of third-party virtual machines. The Java extension will offer around 5.5 CaffeineMarks/MHz, yielding 1080 CaffeineMarks in a typical 200-MHz implementation. Extensions of existing ARM debugging tools will enable nonstop debugging of mixed applications running Java and C.
The first products incorporating the Java-accelerated core are expected by the end of the first quarter of 2001. For details, contact ARM Ltd. at +44 223 400 400, or go to www.arm.com.