gnu.expr
Class ModuleExp

java.lang.Object
  extended by gnu.mapping.Procedure
      extended by gnu.mapping.Procedure0
          extended by gnu.expr.Expression
              extended by gnu.expr.ScopeExp
                  extended by gnu.expr.LambdaExp
                      extended by gnu.expr.ModuleExp
All Implemented Interfaces:
Named, Printable, java.io.Externalizable, java.io.Serializable

public class ModuleExp
extends LambdaExp
implements java.io.Externalizable

Class used to implement Scheme top-level environments.

See Also:
Serialized Form

Field Summary
static boolean alwaysCompile
          Flag to force compilation, even when not required.
static boolean debugPrintExpr
           
static java.lang.String dumpZipPrefix
          Used to control which .zip file dumps are generated.
static int EXPORT_SPECIFIED
           
static int interactiveCounter
          Numeric identifier for this interactive "command".
static int LAZY_DECLARATIONS
           
static int NONSTATIC_SPECIFIED
           
static int STATIC_RUN_SPECIFIED
           
static int STATIC_SPECIFIED
           
static int SUPERTYPE_SPECIFIED
           
 
Fields inherited from class gnu.expr.LambdaExp
body, closureEnvField, defaultArgs, fileFunctionName, firstChild, keywords, max_args, min_args, nameDecl, NEXT_AVAIL_FLAG, nextSibling, NO_FIELD, returnContinuation, returnType, SEQUENCE_RESULT, staticLinkField
 
Fields inherited from class gnu.expr.ScopeExp
id, outer
 
Fields inherited from class gnu.expr.Expression
flags, noExpressions
 
Constructor Summary
ModuleExp()
           
 
Method Summary
static void evalModule(Environment env, CallContext ctx, Compilation comp)
           
static java.lang.Class evalToClass(Compilation comp)
           
 Declaration firstDecl()
           
 ClassType[] getInterfaces()
           
 java.lang.String getJavaName()
           
 ClassType getSuperType()
           
 boolean isStatic()
           
 void print(OutPort out)
           
 void readExternal(java.io.ObjectInput in)
           
 void setInterfaces(ClassType[] s)
           
 void setSuperType(ClassType s)
           
static void setupLiterals()
          Call-back from compiled code to initialize literals in immediate mode.
 boolean staticInitRun()
          True if module body (i.e.
protected  Expression walk(ExpWalker walker)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.expr.LambdaExp
allocChildClasses, allocFrame, capture, compile, compileBody, compileEnd, compileSetField, declareClosureEnv, declareThis, getCallConvention, getCaller, getCanCall, getCanRead, getCompiledClassType, getExpClassName, getHeapFrameType, getImportsLexVars, getInlineOnly, getMainMethod, getMethod, getNeedsClosureEnv, getNeedsStaticLink, getOwningLambda, getProperty, getReturnType, getType, incomingArgs, isClassGenerated, isClassMethod, isHandlingTailCalls, isModuleBody, loadHeapFrame, outerLambda, outerLambdaNotInline, restArgType, setCanCall, setCanRead, setClassMethod, setExceptions, setImportsLexVars, setImportsLexVars, setInlineOnly, setNeedsStaticLink, setNeedsStaticLink, setProperty, setReturnType, setType, toString, variable_args, walkChildren, walkChildrenOnly, walkProperties
 
Methods inherited from class gnu.expr.ScopeExp
add, add, addDeclaration, addDeclaration, addDeclaration, countDecls, currentLambda, currentModule, getDefine, getNoDefine, getVarScope, lookup, lookup, nesting, popScope, remove, remove, replaceFollowing
 
Methods inherited from class gnu.expr.Expression
apply, apply0, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, eval, eval, getColumn, getFile, getFlag, getFlags, getLine, makeWhile, match0, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine
 
Methods inherited from class gnu.mapping.Procedure0
apply1, apply2, apply3, apply4, applyN, numArgs
 
Methods inherited from class gnu.mapping.Procedure
apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getName, getSetter, getSymbol, match1, match2, match3, match4, matchN, maxArgs, minArgs, name, removeProperty, set0, set1, setN, setName, setProperty, setSetter, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debugPrintExpr

public static boolean debugPrintExpr

EXPORT_SPECIFIED

public static final int EXPORT_SPECIFIED
See Also:
Constant Field Values

STATIC_SPECIFIED

public static final int STATIC_SPECIFIED
See Also:
Constant Field Values

NONSTATIC_SPECIFIED

public static final int NONSTATIC_SPECIFIED
See Also:
Constant Field Values

SUPERTYPE_SPECIFIED

public static final int SUPERTYPE_SPECIFIED
See Also:
Constant Field Values

STATIC_RUN_SPECIFIED

public static final int STATIC_RUN_SPECIFIED
See Also:
Constant Field Values

LAZY_DECLARATIONS

public static final int LAZY_DECLARATIONS
See Also:
Constant Field Values

dumpZipPrefix

public static java.lang.String dumpZipPrefix
Used to control which .zip file dumps are generated.


interactiveCounter

public static int interactiveCounter
Numeric identifier for this interactive "command". Incremented by Shell.run, and used to set the module name, and maybe the name of the --debug-dump-zip output file. We increment and use this counter purely to ease debugging. (Since each module gets its own ClassLoader, they don't need to be named differently, and it doesn't matter if there is a race condition on the counter.)


alwaysCompile

public static boolean alwaysCompile
Flag to force compilation, even when not required.

Constructor Detail

ModuleExp

public ModuleExp()
Method Detail

getJavaName

public java.lang.String getJavaName()

evalToClass

public static java.lang.Class evalToClass(Compilation comp)

evalModule

public static final void evalModule(Environment env,
                                    CallContext ctx,
                                    Compilation comp)
                             throws java.lang.Throwable
Throws:
java.lang.Throwable

setupLiterals

public static void setupLiterals()
Call-back from compiled code to initialize literals in immediate mode. In non-immediate mode (i.e. generating class files) the compiler emits code to "re-construct" literal values. However, in immediate mode that would be wasteful, plus we would get values that are similar (equals) to but not necessarily identical (eq) to the compile-time literal. So we need to pass the literal values to the compiled code, by using reflectiion to initialize various static fields. This method does that. It is called from start of the the generated static initializer, which helps makes things more consistent between immediate and non-immediate mode.


getSuperType

public final ClassType getSuperType()

setSuperType

public final void setSuperType(ClassType s)

getInterfaces

public final ClassType[] getInterfaces()

setInterfaces

public final void setInterfaces(ClassType[] s)

isStatic

public final boolean isStatic()

staticInitRun

public boolean staticInitRun()
True if module body (i.e. run) is called by class initializer.


walk

protected Expression walk(ExpWalker walker)
Overrides:
walk in class LambdaExp

print

public void print(OutPort out)
Overrides:
print in class LambdaExp

firstDecl

public Declaration firstDecl()
Overrides:
firstDecl in class ScopeExp

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException