Modifier and Type | Class and Description |
---|---|
static class |
LambdaExp.Closure |
SourceLocator.Simple
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_OTHER_KEYWORDS |
static java.lang.invoke.MethodHandle |
applyToConsumer |
static int |
ATTEMPT_INLINE |
Expression |
body |
static java.lang.String |
CLOSURE_ENV_NAME |
Field |
closureEnvField
If non-null, this is a Field that is used for implementing lexical closures.
|
LambdaExp |
firstChild |
protected static int |
HAS_NONTRIVIAL_DEFAULT
True if IS_SUPPLIED_PARAMETER is set on a parameter.
|
protected static int |
HAS_NONTRIVIAL_PATTERN |
static int |
IN_EXPWALKER |
LambdaExp |
inlineHome
If this lambda gets inlined this is the containing lambda.
|
Keyword[] |
keywords |
int |
max_args
Maximum number of actual arguments; -1 if variable.
|
int |
min_args
Minimum number of actual arguments.
|
Declaration |
nameDecl
If non-null, a Declaration whose value is (only) this LambdaExp.
|
protected static int |
NEXT_AVAIL_FLAG |
LambdaExp |
nextSibling |
static int |
NO_FIELD |
int |
opt_args
Number of optional arguments, not counting keyword arguments.
|
static int |
OVERLOADABLE_FIELD |
static int |
PASSES_TAILCALLS
Treat as inlined in outer lambda when determining tailcalls.
|
static int |
PUBLIC_METHOD
True of emitted method should be public.
|
Expression |
returnContinuation
The unique call site that calls this lambda.
|
Type |
returnType
If non-null, the type of values returned by this function.
|
static int |
SEQUENCE_RESULT |
Field |
staticLinkField
Field in heapFrame.getType() that contains the static link.
|
applyMethodExpression, flags, noExpressions, type, VALIDATED
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
nameKey
Constructor and Description |
---|
LambdaExp() |
LambdaExp(Expression body) |
LambdaExp(int args) |
Modifier and Type | Method and Description |
---|---|
Declaration |
addParameter(java.lang.Object name) |
void |
allocChildClasses(Compilation comp) |
void |
allocFrame(Compilation comp) |
void |
apply(CallContext ctx)
Evaluate the expression.
|
protected Type |
calculateType() |
void |
capture(Declaration decl) |
ClassType |
checkForInitCall(Expression bodyFirst)
Check if argument is a this(...) or super(...) initializtion.
|
void |
compile(Compilation comp,
Target target) |
void |
compileBody(Compilation comp) |
void |
compileEnd(Compilation comp) |
Field |
compileSetField(Compilation comp) |
Variable |
declareClosureEnv() |
Variable |
declareThis(ClassType clas) |
void |
generateApplyMethods(Compilation comp) |
Expression |
getBodyFirstExpression()
Get the first expression/statement in the body.
|
int |
getCallConvention()
The calling convention used for this function.
|
LambdaExp |
getCaller()
For an INLINE_ONLY function, return the function it gets inlined in.
|
boolean |
getCanRead() |
ClassType |
getClassType()
The ClassType generated for this class.
|
protected ClassType |
getCompiledClassType(Compilation comp)
Return the ClassType of the Procedure this is being compiled into.
|
protected java.lang.String |
getExpClassName() |
ClassType |
getHeapFrameType() |
boolean |
getImportsLexVars()
True iff this lambda "captures" (uses) lexical variables from outside.
|
boolean |
getInlineOnly()
True iff this lambda is only "called" inline.
|
Method |
getMainMethod()
Get the method that contains the actual body of the procedure.
|
Method |
getMethod(int nonSpliceCount,
int spliceCount)
Select the method used given an argument count.
|
boolean |
getNeedsClosureEnv() |
boolean |
getNeedsStaticLink()
True if a child lambda uses lexical variables from outside.
|
LambdaExp |
getOwningLambda() |
java.lang.Object |
getProperty(java.lang.Object key,
java.lang.Object defaultValue) |
Type |
getReturnType()
The return type of this function, i.e the type of its returned values.
|
int |
incomingArgs()
Number of argument variable actually passed by the caller.
|
boolean |
inlinedInCallerOrCheckMethodOnly()
True if no primitive method is created for this procedure.
|
boolean |
inlinedInCheckMethod() |
boolean |
isAbstract() |
boolean |
isClassMethod()
True if this is a method in an ClassExp.
|
boolean |
isHandlingTailCalls() |
boolean |
isModuleBody()
True iff this is the dummy top-level function of a module body.
|
boolean |
isNative() |
void |
loadHeapFrame(Compilation comp)
Generate code to load heapFrame on the JVM stack.
|
static void |
maybeSetReturnType(LambdaExp lexp,
Type type) |
protected boolean |
mustCompile() |
LambdaExp |
outerLambda() |
LambdaExp |
outerLambdaNotInline()
Return the closest outer non-inlined LambdaExp.
|
LambdaExp |
outerLambdaOrCaller() |
void |
print(gnu.kawa.io.OutPort out) |
void |
pushChild(LambdaExp child) |
Type |
restArgType()
Return the parameter type of the "keyword/rest" parameters.
|
void |
reverseChildList() |
void |
setCallConvention(Compilation comp) |
void |
setCanRead(boolean read) |
void |
setClassMethod(boolean isMethod) |
void |
setCoercedReturnType(Type returnType) |
void |
setCoercedReturnValue(Expression type,
Language language)
Modify LambdaExp so result is coerced to given type.
|
void |
setExceptions(Expression[] exceptions) |
void |
setImportsLexVars() |
void |
setImportsLexVars(boolean importsLexVars) |
void |
setInlineOnly(boolean inlineOnly) |
void |
setInlineOnly(Expression returnContinuation,
LambdaExp caller)
Note this function is inlined in a give context.
|
void |
setNeedsStaticLink() |
void |
setNeedsStaticLink(boolean needsStaticLink) |
void |
setProperty(java.lang.Object key,
java.lang.Object value) |
void |
setReturnType(Type returnType) |
void |
setType(ClassType type) |
boolean |
side_effects()
True if evaluating may have side-effects.
|
java.lang.String |
toString() |
boolean |
usingCallContext() |
Expression |
validateApply(ApplyExp exp,
InlineCalls visitor,
Type required,
Declaration decl)
Apply inlining transformations on a given ApplyExp.
|
boolean |
variable_args() |
protected <R,D> R |
visit(ExpVisitor<R,D> visitor,
D d) |
protected <R,D> void |
visitChildren(ExpVisitor<R,D> visitor,
D d) |
protected <R,D> void |
visitChildrenOnly(ExpVisitor<R,D> visitor,
D d) |
protected <R,D> void |
visitProperties(ExpVisitor<R,D> visitor,
D d) |
add, add, addDeclaration, addDeclaration, addDeclaration, clearCallList, countDecls, currentLambda, currentModule, duplicateDeclarationError, firstDecl, getDefine, getNoDefine, getOuter, getVarScope, isClassGenerated, lastDecl, lookup, lookup, nestedIn, nesting, popScope, remove, remove, replaceFollowing, setIndexes, setOuter, topLevel
applyMethodExpression, checkLiteralKeyword, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, neverReturns, numArgs, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, valueIfConstant
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
getName, getSymbol, removeProperty, setName, setProperty, setSymbol
public Expression body
public int min_args
public int max_args
public int opt_args
public Keyword[] keywords
public LambdaExp firstChild
public LambdaExp nextSibling
public Expression returnContinuation
public LambdaExp inlineHome
public Declaration nameDecl
public static final java.lang.String CLOSURE_ENV_NAME
public Field closureEnvField
public Field staticLinkField
public static final int NO_FIELD
public static final int SEQUENCE_RESULT
public static final int OVERLOADABLE_FIELD
public static final int ATTEMPT_INLINE
public static final int IN_EXPWALKER
public static final int PASSES_TAILCALLS
public static final int PUBLIC_METHOD
public static final int ALLOW_OTHER_KEYWORDS
protected static final int HAS_NONTRIVIAL_PATTERN
protected static final int HAS_NONTRIVIAL_DEFAULT
protected static final int NEXT_AVAIL_FLAG
public Type returnType
public static final java.lang.invoke.MethodHandle applyToConsumer
public LambdaExp()
public LambdaExp(int args)
public LambdaExp(Expression body)
public void capture(Declaration decl)
public Declaration addParameter(java.lang.Object name)
public void setExceptions(Expression[] exceptions)
public final boolean getInlineOnly()
public final void setInlineOnly(boolean inlineOnly)
public final boolean inlinedInCheckMethod()
public boolean inlinedInCallerOrCheckMethodOnly()
getInlineOnly() || inlinedInCheckMethod()
.public final void setInlineOnly(Expression returnContinuation, LambdaExp caller)
public final boolean getNeedsClosureEnv()
public final boolean getNeedsStaticLink()
public final void setNeedsStaticLink(boolean needsStaticLink)
public final boolean getImportsLexVars()
public final void setImportsLexVars(boolean importsLexVars)
public final void setImportsLexVars()
public final void setNeedsStaticLink()
public final boolean getCanRead()
public final void setCanRead(boolean read)
public final boolean isClassMethod()
public final void setClassMethod(boolean isMethod)
public final boolean isModuleBody()
public boolean isAbstract()
public boolean isNative()
public int getCallConvention()
public void setCallConvention(Compilation comp)
public boolean usingCallContext()
public final boolean isHandlingTailCalls()
public final boolean variable_args()
protected ClassType getCompiledClassType(Compilation comp)
protected Type calculateType()
calculateType
in class Expression
public ClassType getClassType()
public void setType(ClassType type)
public int incomingArgs()
public final Method getMethod(int nonSpliceCount, int spliceCount)
public final Method getMainMethod()
public final Type restArgType()
public LambdaExp outerLambda()
public LambdaExp outerLambdaOrCaller()
public LambdaExp outerLambdaNotInline()
public LambdaExp getCaller()
public Variable declareClosureEnv()
public void loadHeapFrame(Compilation comp)
public void compileEnd(Compilation comp)
public void generateApplyMethods(Compilation comp)
public Field compileSetField(Compilation comp)
public void compile(Compilation comp, Target target)
compile
in class Expression
public ClassType getHeapFrameType()
public LambdaExp getOwningLambda()
public void allocChildClasses(Compilation comp)
public void pushChild(LambdaExp child)
public void reverseChildList()
public void allocFrame(Compilation comp)
public void compileBody(Compilation comp)
protected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
protected <R,D> void visitChildren(ExpVisitor<R,D> visitor, D d)
visitChildren
in class Expression
protected final <R,D> void visitChildrenOnly(ExpVisitor<R,D> visitor, D d)
protected final <R,D> void visitProperties(ExpVisitor<R,D> visitor, D d)
protected boolean mustCompile()
mustCompile
in class Expression
public void apply(CallContext ctx) throws java.lang.Throwable
Expression
apply
in class Expression
java.lang.Throwable
public Expression validateApply(ApplyExp exp, InlineCalls visitor, Type required, Declaration decl)
Expression
validateApply
in class Expression
exp
- an application whose function expression can be simplified
to this expression.visitor
- the context for the current inlining passdecl
- if non-null, a Declaration bound to this expression.public void print(gnu.kawa.io.OutPort out)
print
in class Expression
protected final java.lang.String getExpClassName()
public boolean side_effects()
Expression
side_effects
in class Expression
public java.lang.Object getProperty(java.lang.Object key, java.lang.Object defaultValue)
getProperty
in class PropertySet
public void setProperty(java.lang.Object key, java.lang.Object value)
setProperty
in class PropertySet
public final Type getReturnType()
public final void setReturnType(Type returnType)
public final void setCoercedReturnType(Type returnType)
public final void setCoercedReturnValue(Expression type, Language language)
public Expression getBodyFirstExpression()
BeginExp
s.
Used to check for invoke-special
calls in @init
methods.public ClassType checkForInitCall(Expression bodyFirst)