![]() |
|||
![]() ![]() |
![]() |
![]()
|
![]() |
JVM Instruction Set The last piece of the JVM is not a region, or a device, or even a physical element of the JVM. Rather, the JVM Instruction Set is the driving entity that gives the JVM life. The Instruction Set tells the processor to perform an action. In the case of the JVM Instruction Set, those actions equate into 160 instructions, partitioned in 17 different categories. In native-compiled programs, the executable contains that programs associated set of operations, which perform the desired functionality. The difference with Java-executable program files is that the operations contained with the file are JVM instructions and not native instructions. In this manner, Java executables are identical to normal executables, except Java executables are compiled to run on the JVM.
Anatomy of a Class FileThe structure of a class encapsulates an entire object. For this reason, class file structure is required knowledge for the Certified Programmer Examination. You know that Java executables run on a JVM and are directly interpreted into native instructions, so now its time to discuss the concept of a Java executable file, or class file. In the PC world, an executable directly equates to an .exe file, and, on most platforms, executable files contain an entire program sequence. Java does things a little differently. Each executable file holds a single compiled object. One object acts as the entry point and calls supporting class files for needed functionality. For example, upon execution of an Applet, the Java runtime environment loads the main executable class and java.applet.Applet class into the JVM for execution. Unlike native file executables, which contain a grouping of functionality in a single file, Java executables are constructed in such a way as to contain only a single object per file. In this way, each executable file is a reusable, self-contained application component. To facilitate this, the file is broken into fifteen separate Java class file regions, which are as follow:
Each region contains a different piece of the developed object. Figure 1.5 illustrates the regions of a class file. The following sections analyze each of the regions in turn. The Magic RegionThe Magic Region must contain a magic value of 0xCAFEBABE. This value simply has to be there. There is not much more to say about this region except to ask, Why is it called magic? It just is!
|
![]() |
|