Next: Failure of this Method Up: First Approach Direct Compilation Previous: Putting It Together with   Contents

The ``Defined'' Example with B::JVM::Jasmin

This section shows how B::JVM::Jasmin compiles the ``defined'' example from Figure 3.1. The Jasmin code emitted by B::JVM::Jasmin for the simple program from Figure 3.1 is as follows:


.class         public main 
.super         java/lang/Object 
.method        static public main([Ljava/lang/String;)V 
.var 0         is foo LSvBase 
new            SvBase 
dup 
astore_0
dup
invokespecial  SvBase/<init>()V 
invokevirtual  SvBase/defined()Z 
      
or, as its (easier to read) Java equivalent4.3:

class main {
static public void main(String argv[]) {
SvBase foo = new SvBase();
bar.defined();
}
}

Figure: B::JVM::Jasmin Evaluation of ``Defined'' Example
*** Example available as graphic image only ***
(Xfig Source and PDF version of diagram available.)

Figure 4.4 is a graphical representation of how B::JVM::Jasmin emits the Jasmin code for the ``defined'' example. Figure 4.4 is similar to Figure 3.2, but, in addition to the OP-tree, the new figure shows when code is emitted. The down arrows denote that code is emitted as the node is entered, and the up arrows denote code is emitted when the node is exited.


Next: Failure of this Method Up: First Approach Direct Compilation Previous: Putting It Together with   Contents

Copyright © 2000, 2001 Bradley M. Kuhn.

Verbatim copying and distribution of this entire thesis is permitted in any medium, provided this notice is preserved.