Package com.strobel.expressions
Class StackSpiller
java.lang.Object
com.strobel.expressions.StackSpiller
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
Rewrites child expressions, spilling them into temps if needed.private static class
private static enum
(package private) static final class
A special subtype of BlockExpression that indicates to the compiler that this block is a spilled expression and should not allow jumps in.private static enum
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StackSpiller.RewriteAction
Lambda rewrite result.private final StackSpiller.Stack
Initial stack state.private final StackSpiller.TempMaker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <T> LambdaExpression
<T> analyzeLambda
(LambdaExpression<T> lambda) private static <T> T[]
clone
(ReadOnlyList<T> original, int max) private static <T extends Expression>
T[]clone
(ExpressionList<T> original, int max) private void
free
(int mark) private static Expression
makeBlock
(ExpressionList<? extends Expression> expressions) Creates a special block that is marked as not allowing jumps in.private ParameterExpression
private int
mark()
(package private) <T> LambdaExpression
<T> rewrite
(LambdaExpression<T> lambda) private StackSpiller.Result
rewriteAssignBinaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteBinaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteBlockExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteConditionalExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteExpression
(Expression node, StackSpiller.Stack stack) private StackSpiller.Result
rewriteExpressionFreeTemps
(Expression expression, StackSpiller.Stack stack) private StackSpiller.Result
rewriteExtensionAssignment
(BinaryExpression node, StackSpiller.Stack stack) private StackSpiller.Result
rewriteExtensionExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteGotoExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteInvocationExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteLabelExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteLambdaExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteLogicalBinaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteLoopExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteMemberAssignment
(BinaryExpression node, StackSpiller.Stack stack) private StackSpiller.Result
rewriteMemberExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteMethodCallExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteNewArrayExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteNewExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteReducibleExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteSwitchExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteThrowUnaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteTryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteTypeBinaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteUnaryExpression
(Expression expr, StackSpiller.Stack stack) private StackSpiller.Result
rewriteVariableAssignment
(BinaryExpression node, StackSpiller.Stack stack) private ParameterExpression
toTemp
(Expression expression, StrongBox<Expression> save) private static void
verifyRewrite
(StackSpiller.Result result, Expression node) private void
-
Field Details
-
_tm
-
_startingStack
Initial stack state. Normally empty, but when inlining the lambda we might have a non-empty starting stack state. -
_lambdaRewrite
Lambda rewrite result. We need this for inlined lambdas to figure out whether we need to guarantee it an empty stack.
-
-
Constructor Details
-
StackSpiller
-
-
Method Details
-
verifyTemps
private void verifyTemps() -
makeTemp
-
mark
private int mark() -
free
private void free(int mark) -
toTemp
-
makeBlock
Creates a special block that is marked as not allowing jumps in. This should not be used for rewriting BlockExpression itself, or anything else that supports jumping.- Parameters:
expressions
- the expressions within the block- Returns:
- the new block
-
verifyRewrite
-
clone
-
clone
-
analyzeLambda
-
rewrite
-
rewriteExpressionFreeTemps
private StackSpiller.Result rewriteExpressionFreeTemps(Expression expression, StackSpiller.Stack stack) -
rewriteExpression
-
rewriteReducibleExpression
-
rewriteTryExpression
-
rewriteThrowUnaryExpression
-
rewriteSwitchExpression
-
rewriteLoopExpression
-
rewriteLabelExpression
-
rewriteGotoExpression
-
rewriteExtensionExpression
-
rewriteBlockExpression
-
rewriteAssignBinaryExpression
private StackSpiller.Result rewriteAssignBinaryExpression(Expression expr, StackSpiller.Stack stack) -
rewriteExtensionAssignment
private StackSpiller.Result rewriteExtensionAssignment(BinaryExpression node, StackSpiller.Stack stack) -
rewriteVariableAssignment
private StackSpiller.Result rewriteVariableAssignment(BinaryExpression node, StackSpiller.Stack stack) -
rewriteMemberAssignment
private StackSpiller.Result rewriteMemberAssignment(BinaryExpression node, StackSpiller.Stack stack) -
rewriteNewArrayExpression
-
rewriteNewExpression
-
rewriteMemberExpression
-
rewriteLambdaExpression
-
rewriteInvocationExpression
-
rewriteTypeBinaryExpression
-
rewriteConditionalExpression
-
rewriteMethodCallExpression
-
rewriteUnaryExpression
-
rewriteLogicalBinaryExpression
private StackSpiller.Result rewriteLogicalBinaryExpression(Expression expr, StackSpiller.Stack stack) -
rewriteBinaryExpression
-