Skip to content

Commit 1c338c3

Browse files
committed
[GR-54841] Allow StrengthenGraphs to query FieldTypeFlow state for context sensitive analysis.
PullRequest: graal/18294
2 parents 0b8875e + 4060407 commit 1c338c3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/CallSiteSensitiveMethodTypeFlow.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import java.util.concurrent.ConcurrentHashMap;
3030
import java.util.concurrent.ConcurrentMap;
3131

32-
import jdk.graal.compiler.options.OptionValues;
33-
3432
import com.oracle.graal.pointsto.PointsToAnalysis;
3533
import com.oracle.graal.pointsto.api.PointstoOptions;
3634
import com.oracle.graal.pointsto.flow.context.AnalysisContext;
@@ -41,6 +39,8 @@
4139
import com.oracle.graal.pointsto.typestate.TypeState;
4240
import com.oracle.graal.pointsto.util.AnalysisError;
4341

42+
import jdk.graal.compiler.options.OptionValues;
43+
4444
public class CallSiteSensitiveMethodTypeFlow extends MethodTypeFlow {
4545

4646
private final ConcurrentMap<AnalysisContext, MethodFlowsGraph> clonedMethodFlows;
@@ -116,7 +116,10 @@ public TypeState foldTypeFlow(PointsToAnalysis bb, TypeFlow<?> originalTypeFlow)
116116
if (originalTypeFlow == null) {
117117
return null;
118118
}
119-
119+
if (originalTypeFlow instanceof FieldTypeFlow || originalTypeFlow instanceof ArrayElementsTypeFlow) {
120+
// field and array flows are not call site sensitive and thus not cloneable
121+
return originalTypeFlow.state;
122+
}
120123
TypeState result = TypeState.forEmpty();
121124
for (MethodFlowsGraph methodFlows : clonedMethodFlows.values()) {
122125
TypeFlow<?> clonedTypeFlow = methodFlows.lookupCloneOf(bb, originalTypeFlow);
@@ -135,6 +138,10 @@ public TypeState foldTypeFlow(PointsToAnalysis bb, TypeFlow<?> originalTypeFlow)
135138
/** Check if the type flow is saturated, i.e., any of its clones is saturated. */
136139
@Override
137140
public boolean isSaturated(PointsToAnalysis bb, TypeFlow<?> originalTypeFlow) {
141+
if (originalTypeFlow instanceof FieldTypeFlow || originalTypeFlow instanceof ArrayElementsTypeFlow) {
142+
// field and array flows are not call site sensitive and thus not cloneable
143+
return originalTypeFlow.isSaturated();
144+
}
138145
boolean saturated = false;
139146
for (MethodFlowsGraph methodFlows : clonedMethodFlows.values()) {
140147
TypeFlow<?> clonedTypeFlow = methodFlows.lookupCloneOf(bb, originalTypeFlow);

0 commit comments

Comments
 (0)