next up previous contents
Next: Initial constant_pool[] Entries Up: Compiling Pascal Previous: Datastructures to Hold

The Empty Program

 

I started out by trying to compile an empty Pascal program. By this I mean a Pascal program with no statements or declarations. It looks like this:

    program empty;

    begin
    end.

Before I could do this, I had to know exactly how a class file of an empty Java program looks. This is not described in [JVM], because it only describes what kind of fields a class file contains, not what these fields should contain, this can only be found out experimentally by looking at existing class files. This means that I had to find a way to represent the binary class files in such a way that I could read them. Because I could not find a program that showed me all the fields in the file, I decided to write one myself. The program I wrote, I called it jdiscogif, parses a class file and dumps all the fields in a readable layout on the screen. It does not resolve internal references in the class file, like references to constant_pool[] entries for example, it just writes the class file the way it is.

To find out what the contents of an empty Java class file is, I wrote an empty Java program and compiled it with the Java compiler. This is what an empty Java program looks like:

    class Empty {
        public static void main(String[] args){}
    }

With the help of jdisco I found out that a class file of an empty program contains the following items:

Each of these items will be discussed in the following sections. After that I will describe what I did with this information.





mark@bottom.xs4all.nl