To be a Java programmer in quite a long time, But for the most important component of java - JVM, I still know very little about, To understant what does java do beyond the source code is quite necessary, It will help me to understand java well, also It is a good attitude to learn the things- always try to investigate the core. What is JVM? It is the abstract machine which runs on the top the real hardware, and It is the core reason that Java is the portable language. Since it resides on the middleware rather works on the specific CPU , registers and so forth. 
What is the content in *.class files? The JVM will compile the source code into the .class file which is the form of bytecodes. It can also be considered as the machine language of the JVM. To the JVM, a stream of bytecodes is a sequence of instructions. Each instruction consists of a one-byte opcode and zero or more operands. The opcode tells the JVM what action to take. If the JVM requires more information to perform the action than just the opcode, the required information immediately follows the opcode as operands. Like any kind of language, Java has its owns mnemonic, it can be found from JVM Specification Mnemonic Unfortunately, Sun did not offer us any explanation on this horrable simple words. What is the key component of JVM? JVM can be divided in to 4 parts which are: register stack heap method area The exact location is decided by the specific JVM, but in any forms of the JVM, they must include those four parts. JVM is 32 bits which means it can address up to 2 to the power of 32(4G),
JVM contains several kinds of primitive types like : byte, short, int, long and so forth and all this primitive types are mapped to the java language itself. That is the reason we do not need to consider about how long is such primitive type in specific machine when we programming in Java. That is conveniet for programmer. About the registers. Since JVM is the stack-oriented design, more of the action operates in the stack rather than the register it keeps the JVM's instrcution set to be quite small. JVM only maintains 3 register: optop register frame register var register They work together with the program counter to manage the stack. The program counter(pc) register: The Java virtual machine can support many threads of execution at once. Each Java thread has its own pc (program counter) register. At any point, each Java virtual machine thread is executing the code of a single method, the current method (§3.6) for that thread. If that method is not native, the pc register contains the address of the Java virtual machine instruction currently being executed. If the method currently being executed by the thread is native, the value of the Java virtual machine's pc register is undefined. The Java virtual machine's pc register is wide enough to hold a returnAddress or a native pointer on the specific platform. 
|