Class RightToLeftEvaluation
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.evaluation.RightToLeftEvaluation
-
- All Implemented Interfaces:
EvaluationOrder
public class RightToLeftEvaluation extends java.lang.Object implements EvaluationOrder
A right-to-leftEvaluationOrder
, evaluating expressions in reversed order.
-
-
Field Summary
Fields Modifier and Type Field Description static RightToLeftEvaluation
INSTANCE
The singleton instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends AbstractState<A>>
AnalysisState<A>bwdEvaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed)
Evaluates the given sub-expressions according to this order, but in reverse order and using the backward semantics.<A extends AbstractState<A>>
AnalysisState<A>evaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed)
Evaluates the given sub-expressions according to this order.int
first(int len)
Yields the index of the first sub-expression that has to be evaluated.int
last(int len)
Yields the index of the last sub-expression that has to be evaluated.int
next(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated after the given one.int
previous(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated before the given one.
-
-
-
Field Detail
-
INSTANCE
public static final RightToLeftEvaluation INSTANCE
The singleton instance of this class.
-
-
Method Detail
-
evaluate
public <A extends AbstractState<A>> AnalysisState<A> evaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed) throws SemanticException
Description copied from interface:EvaluationOrder
Evaluates the given sub-expressions according to this order. This method will fillcomputed
andsubStates
such thatsubStates[i] = subExpressions[i].semantics(); computed[i] = subStates[i].computedExpressions
, while also setting the runtime types for the expressions left on the stack.- Specified by:
evaluate
in interfaceEvaluationOrder
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
subExpressions
- the sub-expressions to evaluateentryState
- the state to use as starting point for the evaluationinterprocedural
- the interprocedural analysis of the program to analyzeexpressions
- the cache where analysis states of intermediate expressions must be stored (this method is responsible for storing the results of the sub-expressions)computed
- an array containing, for each sub-expression, the symbolic expressions produced by its evaluation- Returns:
- the last computed state, where the source expression can be evaluated
- Throws:
SemanticException
- if something goes wrong during the evaluation
-
bwdEvaluate
public <A extends AbstractState<A>> AnalysisState<A> bwdEvaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed) throws SemanticException
Description copied from interface:EvaluationOrder
Evaluates the given sub-expressions according to this order, but in reverse order and using the backward semantics.- Specified by:
bwdEvaluate
in interfaceEvaluationOrder
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
subExpressions
- the sub-expressions to evaluateentryState
- the state to use as starting point for the evaluationinterprocedural
- the interprocedural analysis of the program to analyzeexpressions
- the cache where analysis states of intermediate expressions must be stored (this method is responsible for storing the results of the sub-expressions)computed
- an array containing, for each sub-expression, the symbolic expressions produced by its evaluation- Returns:
- the last computed state, where the source expression can be evaluated
- Throws:
SemanticException
- if something goes wrong during the evaluation
-
previous
public int previous(int pos, int len)
Description copied from interface:EvaluationOrder
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated before the given one.- Specified by:
previous
in interfaceEvaluationOrder
- Parameters:
pos
- the index of a sub-expressionlen
- the total number of sub-expressions- Returns:
- the previous index (a negative value means that there is no
previous sub-expression, that is,
pos
is the first that needs to be evaluated)
-
next
public int next(int pos, int len)
Description copied from interface:EvaluationOrder
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated after the given one.- Specified by:
next
in interfaceEvaluationOrder
- Parameters:
pos
- the index of a sub-expressionlen
- the total number of sub-expressions- Returns:
- the next index (a negative value means that there is no next
sub-expression, that is,
pos
is the last that needs to be evaluated)
-
first
public int first(int len)
Description copied from interface:EvaluationOrder
Yields the index of the first sub-expression that has to be evaluated.- Specified by:
first
in interfaceEvaluationOrder
- Parameters:
len
- the total number of sub-expressions- Returns:
- the index of the first expression to evaluate
-
last
public int last(int len)
Description copied from interface:EvaluationOrder
Yields the index of the last sub-expression that has to be evaluated.- Specified by:
last
in interfaceEvaluationOrder
- Parameters:
len
- the total number of sub-expressions- Returns:
- the index of the last expression to evaluate
-
-