December 2009
Intermediate to advanced
380 pages
9h 2m
English
| Pattern 28 | Register-Based Bytecode Interpreter |
This pattern executes bytecode instructions that store function parameters, local variables, and temporary values in simulated registers.
A register-based bytecode interpreter is identical to a stack-based interpreter except for the instruction set and where it keeps local variables, parameters, return values, and any temporary values. The instructions use registers instead of an operand stack. Our simulated machine gives each stack frame an “infinite” set of registers.
Instruction | Description |
|---|---|
iadd ri, rj, rk isub ri, rj, rk imul ri, rj, rk | Arithmetic operators for integers. rk=ri op rj |
fadd ri, rj, rk fsub ri, rj, rk fmul ri, ... |