Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Bytecode Interpretation Java bytecode is the form of instructions that the Java Virtual Machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use. To understand the details of the bytecode. As each byte has 256 potential values, there are 256 possible opcodes. Of these, 0x00 through 0xca, 0xfe, and 0xff are assigned values. 0xca is reserved as a breakpoint instruction for debuggers and is not used by the language. Similarly, 0xfe and 0xff are not used by the language, and are reserved for internal use by the virtual machine. Instructions fall into a number of broad groups: Load and store (e.g. aload_0,istore) Arithmetic and logic (e.g. ladd,fcmpl) Type conversion (e.g. i2b,d2i) Object creation and manipulation (new,putfield) Operand stack management (e.g. swap,dup2) Control transfer (e.g. ifeq,goto) Method invocation and return (e.g. invokespecial,areturn) Computational Model The model of computation of Java bytecode is that of a stack-oriented programming language. For example, assembly code for an x86 processor might look like this: add eax, edx mov ecx, eax This code would add two values and move the result to a different location 0 iload_1 1 iload_2 2 iadd 3 istore_3 The Execution Engine decodes the bytecode and performs the actions necessary to implement each instruction. Its interface is quite simple, consisting of a single function that takes a Context as an argument, and executes the method whose frame is on top of the Context's call stack. Since Jupiter's design delegates much of the execution responsibility to other parts of the system, not much remains to be done by the Execution Engine itself. The current interpreter Page 16 CS316– AJP UNIT-1 implementation divides the functionality into three modules, which are shown along with the ExecutionEngine interface in Figure . These modules are each responsible for implementing a portion of the Execution Engine functionality: The opcode Spec module defines each of the Java opcodes in terms of Jupiter's base interfaces. It takes the form of a header file that is included (with #include) into the interpreter module. It is designed to beused by any Execution The Interpreter Support module provides functionality that is independent of the particular interpreter implementation, such as the stack-unwinding algorithm for The Interpreter module implements the Execution Engine interface, making use of the opcode Spec and Interpreter Support modules as necessary. The current Execution Engine implementation is a threaded interpreter, meaning that, after executing one opcode, it branches directly to the code for executing the next opcode