gnu.expr

Class ModuleExp

Implemented Interfaces:
Externalizable, Named, Printable

public class ModuleExp
extends LambdaExp
implements Externalizable

Class used to implement Scheme top-level environments.

Field Summary

static int
EXPORT_SPECIFIED
static int
LAZY_DECLARATIONS
static int
NONSTATIC_SPECIFIED
static int
STATIC_RUN_SPECIFIED
static int
STATIC_SPECIFIED
static int
SUPERTYPE_SPECIFIED
static boolean
alwaysCompile
Flag to force compilation, even when not required.
static boolean
debugPrintExpr
static String
dumpZipPrefix
Used to control which .zip file dumps are generated.
static int
interactiveCounter
Numeric identifier for this interactive "command".

Fields inherited from class gnu.expr.LambdaExp

NEXT_AVAIL_FLAG, NO_FIELD, SEQUENCE_RESULT, body, closureEnvField, defaultArgs, fileFunctionName, firstChild, keywords, max_args, min_args, nameDecl, nextSibling, returnContinuation, returnType, staticLinkField

Fields inherited from class gnu.expr.ScopeExp

id, outer

Fields inherited from class gnu.expr.Expression

NEXT_AVAIL_FLAG, flags, noExpressions

Constructor Summary

ModuleExp()

Method Summary

static void
evalModule(Environment env, CallContext ctx, Compilation comp)
static Class
evalToClass(Compilation comp)
Declaration
firstDecl()
ClassType[]
getInterfaces()
String
getJavaName()
ClassType
getSuperType()
boolean
isStatic()
void
print(OutPort out)
void
readExternal(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(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, print, restArgType, setCanCall, setCanRead, setClassMethod, setExceptions, setImportsLexVars, setImportsLexVars, setInlineOnly, setNeedsStaticLink, setNeedsStaticLink, setProperty, setReturnType, setType, toString, variable_args, walk, walkChildren, walkChildrenOnly, walkProperties

Methods inherited from class gnu.expr.ScopeExp

add, add, addDeclaration, addDeclaration, addDeclaration, countDecls, currentLambda, currentModule, firstDecl, getDefine, getNoDefine, getVarScope, lookup, lookup, nesting, popScope, remove, remove, replaceFollowing, toString, walk

Methods inherited from class gnu.expr.Expression

apply, apply0, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, eval, eval, getColumn, getFile, getFlag, getFlags, getLine, getType, makeWhile, match0, print, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, walk, walkChildren

Methods inherited from class gnu.mapping.Procedure0

apply0, apply1, apply2, apply3, apply4, applyN, numArgs

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getName, getProperty, getSetter, getSymbol, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, name, numArgs, removeProperty, set0, set1, setN, setName, setProperty, setProperty, setSetter, setSymbol, toString

Field Details

EXPORT_SPECIFIED

public static final int EXPORT_SPECIFIED
Field Value:
2048

LAZY_DECLARATIONS

public static final int LAZY_DECLARATIONS
Field Value:
65536

NONSTATIC_SPECIFIED

public static final int NONSTATIC_SPECIFIED
Field Value:
8192

STATIC_RUN_SPECIFIED

public static final int STATIC_RUN_SPECIFIED
Field Value:
32768

STATIC_SPECIFIED

public static final int STATIC_SPECIFIED
Field Value:
4096

SUPERTYPE_SPECIFIED

public static final int SUPERTYPE_SPECIFIED
Field Value:
16384

alwaysCompile

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

debugPrintExpr

public static boolean debugPrintExpr

dumpZipPrefix

public static 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.)

Constructor Details

ModuleExp

public ModuleExp()

Method Details

evalModule

public static final void evalModule(Environment env,
                                    CallContext ctx,
                                    Compilation comp)
            throws Throwable

evalToClass

public static Class evalToClass(Compilation comp)

firstDecl

public Declaration firstDecl()
Overrides:
firstDecl in interface ScopeExp

getInterfaces

public final ClassType[] getInterfaces()

getJavaName

public String getJavaName()

getSuperType

public final ClassType getSuperType()

isStatic

public final boolean isStatic()

print

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

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException

setInterfaces

public final void setInterfaces(ClassType[] s)

setSuperType

public final void setSuperType(ClassType s)

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.

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 interface LambdaExp

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException