The Java™ Virtual Machine Specification (2nd Edition)
If you're writing a Java bytecode interpreter--or a compiler that generates binary files for such an interpreter--The Java Virtual Machine Specificationhas the information you need. It's the definitive document on Java compilers and runtime environments.The first part ofThe Java Virtual Machine Specificationdiscusses the relationships among Java program elements like objects, variables, data types, arrays, exceptions and threads, and compile and run time. Implementers of Java compilers and interpreters need to understand this stuff, but it also makes fascinating reading for Java programmers--it'll help with writing more efficient applications.From there, the authors dig into the binary .class file format. They provide information on creating such a file as output from a Java compiler, and also give lots of data on how a Java interpreter should examine a .class file to verify its validity and trustworthiness. The authors explain how to carry out loading and linking operations on the objects a .class file defines.The latter half ofThe Java Virtual Machine Specificationis pure reference--it's a list of all Java opcodes, their purposes, formats, and accepted operands. There's also information about the exceptions each opcode can throw during compilation and execution.Helpfully, the authors provide a peek at how Sun's Java compiler (javac) and Java interpreter (java) work, complete with source code. These examples promise to provide developers with hints as they implement their own compilers and runtime environments.--David Wall