Class used to implement Scheme lambda expressions.
NEXT_AVAIL_FLAG
protected static final int NEXT_AVAIL_FLAG
NO_FIELD
public static final int NO_FIELD
SEQUENCE_RESULT
public static final int SEQUENCE_RESULT
closureEnvField
public Field closureEnvField
If non-null, this is a Field that is used for implementing lexical closures.
If getName() is "closureEnv", it is our parent's heapFrame,
which is an instance of one of our siblings.
(Otherwise, we use "this" as the implicit "closureEnv" field.)
fileFunctionName
public static String fileFunctionName
The name to give to a dummy implicit function that surrounds a file.
max_args
public int max_args
Maximum number of actual arguments; -1 if variable.
min_args
public int min_args
Minumnum number of parameters.
Does not count implicit isThisParameter().
nameDecl
public Declaration nameDecl
If non-null, a Declaration whose value is (only) this LambdaExp.
returnContinuation
public ApplyExp returnContinuation
The unique caller that calls this lambda.
The value is null, if no callers have been seen.
A value of unknownContinuation means there are multiple call sites.
Tail-recursive calls do not count as multiple call sites. (With a
little more analysis, we could also allow multiple non-self tail-calls
as long as they all are ultimately called from the same place.)
This is used to see if we can inline the function at its unique
call site.
returnType
public Type returnType
If non-null, the type of values returned by this function.
If null, the return type has not been set or calculated yet.
staticLinkField
public Field staticLinkField
Field in heapFrame.getType() that contains the static link.
It is used by child functions to get to outer environments.
Its value is this function's closureEnv value.
allocChildClasses
public void allocChildClasses(Compilation comp)
declareClosureEnv
public Variable declareClosureEnv()
getCallConvention
public int getCallConvention()
Specify the calling convention used for this function.
- One of the CALL_WITH_xxx values in Compilation.
getCaller
public LambdaExp getCaller()
For an INLINE_ONLY function, return the function it gets inlined in.
getCanCall
public final boolean getCanCall()
getCanRead
public final boolean getCanRead()
getCompiledClassType
protected ClassType getCompiledClassType(Compilation comp)
Return the ClassType of the Procedure this is being compiled into.
getExpClassName
protected final String getExpClassName()
getHeapFrameType
public ClassType getHeapFrameType()
getImportsLexVars
public final boolean getImportsLexVars()
True iff this lambda "captures" (uses) lexical variables from outside.
getInlineOnly
public final boolean getInlineOnly()
True iff this lambda is only "called" inline.
getMainMethod
public final Method getMainMethod()
Get the method that contains the actual body of the procedure.
(The other methods are just stubs that call that method.)
getMethod
public final Method getMethod(int argCount)
Select the method used given an argument count.
getNeedsClosureEnv
public final boolean getNeedsClosureEnv()
getNeedsStaticLink
public final boolean getNeedsStaticLink()
True if a child lambda uses lexical variables from outside.
Hence, a child heapFrame needs a staticLink to outer frames.
getOwningLambda
public LambdaExp getOwningLambda()
getProperty
public Object getProperty(Object key,
Object defaultValue)
- getProperty in interface Procedure
getReturnType
public final Type getReturnType()
The return type of this function, i.e the type of its returned values.
getType
public Type getType()
Return the Type used to represent the values of this Expression.
- getType in interface Expression
incomingArgs
public int incomingArgs()
Number of argument variable actually passed by the caller.
For functions that accept more than 4 argument, or take a variable number,
this is 1, since in that all arguments are passed in a single array.
isClassGenerated
public final boolean isClassGenerated()
True if a class is generated for this procedure.
isClassMethod
public final boolean isClassMethod()
True if this is a method in an ClassExp.
isHandlingTailCalls
public final boolean isHandlingTailCalls()
isModuleBody
public final boolean isModuleBody()
True iff this is the dummy top-level function of a module body.
loadHeapFrame
public void loadHeapFrame(Compilation comp)
Generate code to load heapFrame on the JVM stack.
outerLambdaNotInline
public LambdaExp outerLambdaNotInline()
Return the closest outer non-inlined LambdaExp.
restArgType
public final Type restArgType()
Return the parameter type of the "keyword/rest" parameters.
setCanCall
public final void setCanCall(boolean called)
setCanRead
public final void setCanRead(boolean read)
setClassMethod
public final void setClassMethod(boolean isMethod)
setExceptions
public void setExceptions(ReferenceExp[] exceptions)
setImportsLexVars
public final void setImportsLexVars()
setImportsLexVars
public final void setImportsLexVars(boolean importsLexVars)
setInlineOnly
public final void setInlineOnly(boolean inlineOnly)
setNeedsStaticLink
public final void setNeedsStaticLink()
setNeedsStaticLink
public final void setNeedsStaticLink(boolean needsStaticLink)
setReturnType
public final void setReturnType(Type returnType)
variable_args
public final boolean variable_args()
walkChildrenOnly
protected final void walkChildrenOnly(ExpWalker walker)
walkProperties
protected final void walkProperties(ExpWalker walker)