27
32000D–04/2011
AVR32
3.
Java Extension Module
The AVR32 architecture can optionally support execution of Java bytecodes by including a Java
Extension Module (JEM). This support is included with minimal hardware overhead.
Comparing Java bytecode instructions with native AVR32 instructions, we see that a large part
hardware resources by adding a separate Java instruction decoder and control module that exe-
cutes in Java state. The processor keeps track of its execution state through the status register
and changes execution mode seamlessly.
In a larger runtime system, an operating system keeps track of and dispatches different pro-
cesses. A Java program will typically be one, or several, of these processes.
The Java state is not to be confused with the security modes “system” and “application”, as the
JEM can execute in both modes. When the processor switches instruction decoder and enters
Java state, it does not affect the security level set by the system. A Java program could also be
executed from the different interrupt levels without interfering with the mode settings of the pro-
cessor, although it is not recommended that interrupt routines are written in Java due to latency.
The Java binary instructions are called bytecodes. These bytecodes are one or more bytes long.
A bytecode consists of an opcode and optional arguments. The bytecodes include some instruc-
tions with a high semantic content. In order to reduce the hardware overhead, these instructions
are trapped and executed as small RISC programs. These programs are stored in the program
memory and can be changed by the programmer (part of the Java VM implementation). This
gives full flexibility with regards to future extensions of the Java instruction set. Performance is
ensured through an efficient trapping mechanism and “Java tailored” RISC instructions.
Figure 3-1.
A large part of the instruction set is shared between the AVR RISC and the Java
Virtual Machine. The Java instruction set includes instructions with high semantic
contents while the AVR RISC instruction set complements Java’s set with tradi-
tional hardware near RISC instructions
3.1
The AVR32 Java Virtual Machine
The AVR32 Java Virtual machine consists of two parts, the Java Extension Module in hardware
the two modules comply with the Java Virtual Machine specification.
High level instructions
Low level instructions
Java
additions
AVR RISC
additions
Java
AVR
Common