| www.delorie.com/gnu/docs/kawa/kawa-tour_15.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A Compilation object keeps track of the classes, methods, and
temporary state generated as a result of compiling a
single top-level ModuleExp.
class Compilation {
ClassType[] classes;
boolean immediate;
public ClassType addClass (LambdaExp lexp, String name)
{ ... }
public ClassType (ModuleExp exp, ...)
{ ...; addClass (exp, ...); }
...
}
|
Each Compilation may create one or more ClassType
objects, each of which generates
the bytecodes for one class. Each ClassType is generated
from a LambdaExp, including the top ModuleExp.
The boolean immediate is true if we are compiling for immediate loading,
and is false if the target is one or more .class files.
The addClass method does all the work to
compile a given LambdaExp. It creates a ClassType,
adds it to Compilation's classes array,
and generates Method objects for the constructor and the main
applyX method. Once the applyX Method
has been created, addClass emits some bytecodes to set up the
incoming parameters, and then invokes the virtual compile
method on the body of the LambdaExp, which generates
the code that does the actual work of the procedure.
The Compilation constructor gets a ModuleExp,
which it passes to addClass. The compile
method of LambdaExp (which gets called for all lambdas
except the dummy top-level) also calls addClass to generate
the class corresponding to the lambda, and then it emits
instructions to create a new instance of the generated Procedure class,
and pushes it on the Java stack.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |