Running a Jzero program
At this point, we need to be able to test our bytecode interpreter, but we haven't presented the code generator that generates this bytecode yet! For this reason, most of the testing for this chapter's bytecode interpreter will have to wait until the next chapter, where we will present the code generator. For now, here is a hello world program. The source code is as follows:
public class hello { public static main(String argv[]) { System.out.println("hello"); } }
The corresponding Jzero bytecode might look something like this. One word is shown per line; the lines in hexadecimal show each byte as two hex digits. The opcode is in the leftmost byte, then the operand region byte, and then the operand in the remaining 6 bytes:
"Jzero!!\0" "1.0\0\0\0\0\0" 0x0000040000000000 "hello\0\0\0" 0x0902380000000000 ...