Class LambdaCompiler
java.lang.Object
com.strobel.expressions.LambdaCompiler
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BoundConstantsprivate FieldBuilderprivate ConstructorBuilderprivate FinallyInfoprivate final KeyedQueue<Type<?>, LocalBuilder> private booleanprivate LabelScopeInfoprivate final Map<LabelTarget, LabelInfo> private CompilerScopeprivate final AnalyzedTree(package private) final CodeGenerator(package private) final LambdaExpression<?> (package private) final MethodBuilder(package private) static final AtomicInteger(package private) final TypeBuilder -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)LambdaCompiler(AnalyzedTree tree, LambdaExpression<?> lambda) (package private)LambdaCompiler(AnalyzedTree tree, LambdaExpression<?> lambda, MethodBuilder method, ConstructorBuilder constructor) privateLambdaCompiler(LambdaCompiler parent, LambdaExpression lambda) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddReturnLabel(LambdaExpression lambda) private static <T> Pair<AnalyzedTree, LambdaExpression<T>> analyzeLambda(LambdaExpression<T> lambda) (package private) booleanprivate static booleancanOptimizeSwitchType(Type<?> valueType) private voidcheckTry()(package private) static <T> Delegate<T> compile(LambdaExpression<T> lambda, DebugInfoGenerator debugInfoGenerator) (package private) static <T> voidcompile(LambdaExpression<T> lambda, MethodBuilder methodBuilder, DebugInfoGenerator debugInfoGenerator) private <T> Delegate<T> createDelegate(Class<T> generatedClass) private FieldBuildercreateStaticField(String name, Type type) private voiddefineBlockLabels(Expression node) private LabelInfodefineLabel(LabelTarget node) private voidemit(BlockExpression node, int flags) private voidemitAndAlsoBinaryExpression(Expression expr, int flags) private voidemitArguments(MethodBase method, IArgumentProvider args) private voidemitArguments(MethodBase method, IArgumentProvider args, int skipParameters) private voidemitArithmeticBinaryOp(ExpressionType op, Type<?> operandType) private voidemitAssign(BinaryExpression node, int emitAs) private voidprivate voidprivate voidemitBinaryExpression(Expression expr, int flags) private voidemitBinaryMethod(BinaryExpression b, int flags) private voidemitBinaryOperator(ExpressionType op, Type<?> leftType, Type<?> rightType, Type resultType) private voidemitBlockExpression(Expression expr, int flags) private voidemitBranchAnd(boolean branch, BinaryExpression node, Label label) private voidemitBranchBlock(boolean branch, BlockExpression node, Label label) private voidemitBranchLogical(boolean branch, BinaryExpression node, Label label) private voidemitBranchNot(boolean branch, UnaryExpression node, Label label) private voidemitBranchNullCheck(boolean branch, UnaryExpression node, Label label) private voidemitBranchOp(boolean branch, Label label) private voidemitBranchOr(boolean branch, BinaryExpression node, Label label) private voidemitBranchRelation(boolean branch, BinaryExpression node, Label label) private void(package private) voidprivate voidprivate voidprivate voidemitConditionalExpression(Expression expr, int flags) private voidemitConstant(Object value, Type<?> type) (package private) final voidemitConstantArray(Object array) private voidprivate voidemitConvert(UnaryExpression node, int flags) private voidemitConvertArithmeticResult(ExpressionType op, Type sourceType, Type resultType) private voidemitConvertUnaryExpression(Expression expr, int flags) (package private) booleanprivate voidprivate voidprivate void(package private) voidemitExpression(Expression node) private voidemitExpression(Expression node, int flags) private voidemitExpressionAndBranch(boolean branchValue, Expression node, Label label) private voidemitExpressionAsType(Expression node, Type type, int flags) private voidprivate voidemitExpressionAsVoid(Expression node, int flags) private voidemitExpressionEnd(int flags) private intprivate voidprivate voidemitGotoExpression(Expression expr, int flags) private voidemitIndexAssignment(BinaryExpression node, int flags) private voidemitInlinedInvoke(InvocationExpression invoke, int flags) private voidemitInvocationExpression(Expression expr, int flags) private voidemitLabelExpression(Expression expr, int flags) (package private) voidemitLambdaArgument(int index) private voidprivate voidemitLambdaBody(CompilerScope parent, boolean inlined, int flags) private voidprivate voidprivate voidemitLiftedBooleanAnd(Type leftType, Type rightType) private voidemitLiftedBooleanOr(Type leftType, Type rightType) private voidemitLiftedRelational(ExpressionType op, Type leftType, Type rightType, Type resultType) private voidemitLoopExpression(Expression expr) private voidemitMemberAssignment(BinaryExpression node, int flags) private voidprivate voidemitMemberGet(MemberInfo member) private voidemitMethodCall(Expression target, MethodInfo method, IArgumentProvider methodCallExpr) private voidemitMethodCall(Expression target, MethodInfo method, IArgumentProvider expr, int flags) private voidemitMethodCall(Expression target, MethodInfo method, MethodCallExpression expr, int flags) private voidemitMethodCall(MethodInfo method, IArgumentProvider args, Type<?> objectType, int flags) private voidprivate voidemitMethodCallExpression(Expression expr, int flags) private voidprivate voidemitNewExpression(Expression expr) private voidprivate voidemitOrElseBinaryExpression(Expression expr, int flags) private voidprivate voidprivate Type<?> emitPrimitiveBinaryOp(ExpressionType op, Type leftType, Type rightType) private voidprivate voidprivate voidemitRelationalBranchOp(ExpressionType op, Type<?> operandType, boolean branch, Label label) private voidprivate voidprivate voidemitSetIndexCall(BinaryExpression index) private voidemitSwitchExpression(Expression expr, int flags) private voidemitThrow(UnaryExpression expr, int flags) private voidprivate voidemitTryExpression(Expression expr) private voidprivate voidemitUnary(UnaryExpression node, int flags) private voidemitUnaryExpression(Expression expr, int flags) private voidemitUnaryMethod(UnaryExpression node, int flags) private voidemitUnaryOperator(ExpressionType op, Type operandType, Type resultType) private voidprivate voidemitUnboxingBinaryArithmetic(ExpressionType op, Type leftType, Type rightType, Type resultType) private voidemitUnboxingBinaryOp(ExpressionType op, Type leftType, Type rightType, Type resultType) private voidprivate voidprivate voidemitUnreachable(Expression node, int flags) private voidemitVariableAssignment(BinaryExpression node, int flags) private voidprivate voidprivate LabelInfoensureLabel(LabelTarget node) private voidenterScope(Object node) private voidenterTry(TryExpression tryExpression) private voidprivate voidexitTry(TryExpression tryExpression) (package private) voidfreeLocal(LocalBuilder local) private ExpressiongetEqualityOperand(Expression expression) (package private) intgetLambdaArgument(int index) (package private) LocalBuilder(package private) LocalBuildergetNamedLocal(Type type, ParameterExpression variable) (package private) ParameterExpressionListprivate TypeListgetParameterTypes(LambdaExpression<?> lambda) (package private) static StringgetUniqueLambdaName(String name, Class<?> creationContext) (package private) static Stringprivate static booleanhasVariables(Object node) (package private) voidprivate static booleannotEmpty(Expression node) private voidpopLabelBlock(LabelScopeKind kind) private voidpushLabelBlock(LabelScopeKind type) private LabelInforeferenceLabel(LabelTarget node) private static booleansignificant(Expression node) private booleantryEmitLookupSwitch(SwitchExpression node, int flags) private booleantryEmitStringSwitch(SwitchExpression node, int flags) private booleantryPushLabelBlock(Expression node) private TypeunboxLeftBinaryOperand(Type leftType, Type rightType) private TypeunboxRightBinaryOperand(Type rightType) private static intupdateEmitAsTailCallFlag(int flags, int newValue) private static intupdateEmitAsTypeFlag(int flags, int newValue) private static intupdateEmitExpressionStartFlag(int flags, int newValue)
-
Field Details
-
nextId
-
closureType
-
lambda
-
typeBuilder
-
methodBuilder
-
generator
-
_tree
-
_freeLocals
-
_boundConstants
-
_labelInfo
-
_constructorBuilder
-
_hasClosureArgument
private boolean _hasClosureArgument -
_closureField
-
_scope
-
_labelBlock
-
_finallyInfo
-
-
Constructor Details
-
LambdaCompiler
LambdaCompiler(AnalyzedTree tree, LambdaExpression<?> lambda) -
LambdaCompiler
LambdaCompiler(AnalyzedTree tree, LambdaExpression<?> lambda, MethodBuilder method, ConstructorBuilder constructor) -
LambdaCompiler
-
-
Method Details
-
getParameterTypes
-
getParameters
ParameterExpressionList getParameters() -
canEmitBoundConstants
boolean canEmitBoundConstants() -
emitDebugSymbols
boolean emitDebugSymbols() -
emitClosureArgument
void emitClosureArgument() -
emitLambdaArgument
void emitLambdaArgument(int index) -
createStaticField
-
initializeMethod
void initializeMethod() -
addReturnLabel
-
notEmpty
-
significant
-
compile
-
createDelegate
-
compile
static <T> void compile(LambdaExpression<T> lambda, MethodBuilder methodBuilder, DebugInfoGenerator debugInfoGenerator) -
analyzeLambda
private static <T> Pair<AnalyzedTree, LambdaExpression<T>> analyzeLambda(LambdaExpression<T> lambda) -
getNamedLocal
-
getLambdaArgument
int getLambdaArgument(int index) -
getLocal
-
freeLocal
-
updateEmitAsTailCallFlag
private static int updateEmitAsTailCallFlag(int flags, int newValue) -
updateEmitExpressionStartFlag
private static int updateEmitExpressionStartFlag(int flags, int newValue) -
updateEmitAsTypeFlag
private static int updateEmitAsTypeFlag(int flags, int newValue) -
emitExpression
-
emitExpressionStart
-
emitExpressionEnd
private void emitExpressionEnd(int flags) -
emitExpression
-
emitExtensionExpression
-
emitExpressionAsVoid
-
emitExpressionAsVoid
-
emitExpressionAsType
-
emitAssignBinaryExpression
-
emitAssign
-
emitMemberAssignment
-
emitVariableAssignment
-
emitIndexAssignment
-
emitSetIndexCall
-
hasVariables
-
enterTry
-
exitTry
-
enterScope
-
exitScope
-
emitBlockExpression
-
emit
-
emitAndAlsoBinaryExpression
-
emitPrimitiveAndAlso
-
emitUnboxingAndAlso
-
emitOrElseBinaryExpression
-
emitPrimitiveOrElse
-
emitUnboxingOrElse
-
emitCoalesceBinaryExpression
-
emitReferenceCoalesceWithoutConversion
-
emitLambdaReferenceCoalesce
-
emitConditionalExpression
-
emitBinaryExpression
-
emitBinaryExpression
-
getEqualityOperand
-
emitBinaryMethod
-
emitBinaryOperator
private void emitBinaryOperator(ExpressionType op, Type<?> leftType, Type<?> rightType, Type resultType) -
emitConvertArithmeticResult
-
emitPrimitiveBinaryOp
-
emitUnboxingBinaryOp
private void emitUnboxingBinaryOp(ExpressionType op, Type leftType, Type rightType, Type resultType) -
emitUnboxingBinaryArithmetic
private void emitUnboxingBinaryArithmetic(ExpressionType op, Type leftType, Type rightType, Type resultType) -
emitLiftedRelational
private void emitLiftedRelational(ExpressionType op, Type leftType, Type rightType, Type resultType) -
unboxRightBinaryOperand
-
unboxLeftBinaryOperand
-
emitLiftedBooleanAnd
-
emitLiftedBooleanOr
-
emitObjectBinaryOp
-
emitArithmeticBinaryOp
-
emitConstantExpression
-
emitConstant
-
emitDefaultValueExpression
-
emitGotoExpression
-
emitUnreachable
-
emitExpressionAndBranch
-
emitBranchNot
-
emitBranchNullCheck
-
emitBranchRelation
-
emitRelationalBranchOp
private void emitRelationalBranchOp(ExpressionType op, Type<?> operandType, boolean branch, Label label) -
emitBranchOp
-
emitBranchLogical
-
emitBranchAnd
-
emitBranchOr
-
emitBranchBlock
-
emitInvocationExpression
-
emitInlinedInvoke
-
emitLabelExpression
-
pushLabelBlock
-
tryPushLabelBlock
-
popLabelBlock
-
defineBlockLabels
-
ensureLabel
-
referenceLabel
-
defineLabel
-
emitLambdaExpression
-
emitDelegateConstruction
-
getUniqueMethodName
-
getUniqueLambdaName
-
emitLambdaBody
private void emitLambdaBody() -
emitLambdaBody
-
emitDelegateConstruction
-
emitClosureCreation
-
ensureConstructor
private void ensureConstructor() -
ensureClosure
private void ensureClosure() -
emitConstantArray
-
emitLoopExpression
-
emitMemberExpression
-
emitMemberGet
-
emitMethodCallExpression
-
emitMethodCallExpression
-
emitMethodCall
-
emitMethodCall
private void emitMethodCall(Expression target, MethodInfo method, IArgumentProvider expr, int flags) -
emitMethodCall
private void emitMethodCall(Expression target, MethodInfo method, MethodCallExpression expr, int flags) -
emitMethodCall
private void emitMethodCall(MethodInfo method, IArgumentProvider args, Type<?> objectType, int flags) -
emitArguments
-
emitArguments
-
emitNewExpression
-
emitNewArrayExpression
-
emitParameterExpression
-
emitRuntimeVariablesExpression
-
emitTypeBinaryExpression
-
emitUnaryExpression
-
emitUnary
-
emitUnaryOperator
-
emitUnaryMethod
-
emitConvertUnaryExpression
-
emitConvert
-
emitUnboxUnaryExpression
-
emitThrowUnaryExpression
-
emitThrow
-
emitTryExpression
-
emitCatchStart
-
checkTry
private void checkTry() -
emitSaveExceptionOrPop
-
emitSwitchExpression
-
tryEmitStringSwitch
-
tryEmitLookupSwitch
-
canOptimizeSwitchType
-