Package com.strobel.expressions
Class StackSpiller
- java.lang.Object
-
- com.strobel.expressions.StackSpiller
-
final class StackSpiller extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
StackSpiller.ChildRewriter
Rewrites child expressions, spilling them into temps if needed.private static class
StackSpiller.Result
private static class
StackSpiller.RewriteAction
(package private) static class
StackSpiller.SpilledExpressionBlock
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 class
StackSpiller.Stack
private static class
StackSpiller.TempMaker
-
Field Summary
Fields Modifier and Type Field Description private StackSpiller.RewriteAction
_lambdaRewrite
Lambda rewrite result.private StackSpiller.Stack
_startingStack
Initial stack state.private StackSpiller.TempMaker
_tm
-
Constructor Summary
Constructors Modifier Constructor Description private
StackSpiller(StackSpiller.Stack stack)
-
Method Summary
-
-
-
Field Detail
-
_tm
private final StackSpiller.TempMaker _tm
-
_startingStack
private final StackSpiller.Stack _startingStack
Initial stack state. Normally empty, but when inlining the lambda we might have a non-empty starting stack state.
-
_lambdaRewrite
private StackSpiller.RewriteAction _lambdaRewrite
Lambda rewrite result. We need this for inlined lambdas to figure out whether we need to guarantee it an empty stack.
-
-
Constructor Detail
-
StackSpiller
private StackSpiller(StackSpiller.Stack stack)
-
-
Method Detail
-
verifyTemps
private void verifyTemps()
-
makeTemp
private ParameterExpression makeTemp(Type type)
-
mark
private int mark()
-
free
private void free(int mark)
-
toTemp
private ParameterExpression toTemp(Expression expression, StrongBox<Expression> save)
-
makeBlock
private static Expression makeBlock(ExpressionList<? extends Expression> expressions)
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
private static void verifyRewrite(StackSpiller.Result result, Expression node)
-
clone
private static <T extends Expression> T[] clone(ExpressionList<T> original, int max)
-
clone
private static <T> T[] clone(ReadOnlyList<T> original, int max)
-
analyzeLambda
static <T> LambdaExpression<T> analyzeLambda(LambdaExpression<T> lambda)
-
rewrite
<T> LambdaExpression<T> rewrite(LambdaExpression<T> lambda)
-
rewriteExpressionFreeTemps
private StackSpiller.Result rewriteExpressionFreeTemps(Expression expression, StackSpiller.Stack stack)
-
rewriteExpression
private StackSpiller.Result rewriteExpression(Expression node, StackSpiller.Stack stack)
-
rewriteReducibleExpression
private StackSpiller.Result rewriteReducibleExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteTryExpression
private StackSpiller.Result rewriteTryExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteThrowUnaryExpression
private StackSpiller.Result rewriteThrowUnaryExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteSwitchExpression
private StackSpiller.Result rewriteSwitchExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteLoopExpression
private StackSpiller.Result rewriteLoopExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteLabelExpression
private StackSpiller.Result rewriteLabelExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteGotoExpression
private StackSpiller.Result rewriteGotoExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteExtensionExpression
private StackSpiller.Result rewriteExtensionExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteBlockExpression
private StackSpiller.Result rewriteBlockExpression(Expression expr, StackSpiller.Stack stack)
-
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
private StackSpiller.Result rewriteNewArrayExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteNewExpression
private StackSpiller.Result rewriteNewExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteMemberExpression
private StackSpiller.Result rewriteMemberExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteLambdaExpression
private StackSpiller.Result rewriteLambdaExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteInvocationExpression
private StackSpiller.Result rewriteInvocationExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteTypeBinaryExpression
private StackSpiller.Result rewriteTypeBinaryExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteConditionalExpression
private StackSpiller.Result rewriteConditionalExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteMethodCallExpression
private StackSpiller.Result rewriteMethodCallExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteUnaryExpression
private StackSpiller.Result rewriteUnaryExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteLogicalBinaryExpression
private StackSpiller.Result rewriteLogicalBinaryExpression(Expression expr, StackSpiller.Stack stack)
-
rewriteBinaryExpression
private StackSpiller.Result rewriteBinaryExpression(Expression expr, StackSpiller.Stack stack)
-
-