Building a bytecode instruction set for Jzero
This section describes a simple file format and instruction set for Jzero code, generated from three-address intermediate code. This is very much a toy instruction set. For the language that you create, you instead might decide to use (possibly a subset of) a real instruction set such as the Java bytecode instruction set. Java bytecode is a complicated format; if it wasn’t, we wouldn’t be going to the trouble of presenting something simpler. The instruction set presented here is slightly more capable than Jzero uses, to allow for common extensions.
Defining the Jzero bytecode file format
The Jzero bytecode format consists of a header, followed by a data section, followed by a sequence of instructions. Jzero bytecode files are interpreted as a sequence of 8-byte words in little-endian format. The header consists of an optional self-execution script, a magic word, a version number, and the word offset of the first instruction...