Skip to content

Commit

Permalink
#140 #157 fixing bugs introduced with new code
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaneg committed Jan 12, 2022
1 parent b7ced68 commit b0dc3f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ V extends ValueDomain<V>> AnalysisState<A, H, V> expressionSemantics(
HeapAllocation created = new HeapAllocation(getRuntimeTypes(), getLocation());

// we need to add the receiver to the parameters
VariableRef paramThis = new VariableRef(getCFG(), getLocation(), "this",
getStaticType());
VariableRef paramThis = new VariableRef(getCFG(), getLocation(), "this", getStaticType());
Expression[] fullExpressions = ArrayUtils.insert(0, getSubExpressions(), paramThis);
ExpressionSet<SymbolicExpression>[] fullParams = ArrayUtils.insert(0, params, new ExpressionSet<>(created));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected NaryExpression(CFG cfg, CodeLocation location, String constructName, E
*/
protected NaryExpression(CFG cfg, CodeLocation location, String constructName, Type staticType,
Expression... subExpressions) {
this(cfg, location, constructName, LeftToRightEvaluation.INSTANCE, Untyped.INSTANCE, subExpressions);
this(cfg, location, constructName, LeftToRightEvaluation.INSTANCE, staticType, subExpressions);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ V extends ValueDomain<V>> AnalysisState<A, H, V> evaluate(
StatementStore<A, H, V> expressions,
ExpressionSet<SymbolicExpression>[] computed)
throws SemanticException {
@SuppressWarnings("unchecked")
AnalysisState<A, H, V>[] subStates = new AnalysisState[subExpressions.length];
if (subExpressions.length == 0)
return entryState;

AnalysisState<A, H, V> preState = entryState;
for (int i = 0; i < computed.length; i++) {
preState = subStates[i] = subExpressions[i].semantics(preState, interprocedural, expressions);
expressions.put(subExpressions[i], subStates[i]);
computed[i] = subStates[i].getComputedExpressions();
preState = subExpressions[i].semantics(preState, interprocedural, expressions);
expressions.put(subExpressions[i], preState);
computed[i] = preState.getComputedExpressions();
}

return subStates[subStates.length - 1];
return preState;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ V extends ValueDomain<V>> AnalysisState<A, H, V> evaluate(
StatementStore<A, H, V> expressions,
ExpressionSet<SymbolicExpression>[] computed)
throws SemanticException {
@SuppressWarnings("unchecked")
AnalysisState<A, H, V>[] subStates = new AnalysisState[subExpressions.length];
if (subExpressions.length == 0)
return entryState;

AnalysisState<A, H, V> preState = entryState;
for (int i = computed.length - 1; i >= 0; i--) {
preState = subStates[i] = subExpressions[i].semantics(preState, interprocedural, expressions);
expressions.put(subExpressions[i], subStates[i]);
computed[i] = subStates[i].getComputedExpressions();
preState = subExpressions[i].semantics(preState, interprocedural, expressions);
expressions.put(subExpressions[i], preState);
computed[i] = preState.getComputedExpressions();
}

return subStates[0];
return preState;
}
}

0 comments on commit b0dc3f1

Please sign in to comment.