29
29
import java .util .concurrent .ConcurrentHashMap ;
30
30
import java .util .concurrent .ConcurrentMap ;
31
31
32
- import jdk .graal .compiler .options .OptionValues ;
33
-
34
32
import com .oracle .graal .pointsto .PointsToAnalysis ;
35
33
import com .oracle .graal .pointsto .api .PointstoOptions ;
36
34
import com .oracle .graal .pointsto .flow .context .AnalysisContext ;
41
39
import com .oracle .graal .pointsto .typestate .TypeState ;
42
40
import com .oracle .graal .pointsto .util .AnalysisError ;
43
41
42
+ import jdk .graal .compiler .options .OptionValues ;
43
+
44
44
public class CallSiteSensitiveMethodTypeFlow extends MethodTypeFlow {
45
45
46
46
private final ConcurrentMap <AnalysisContext , MethodFlowsGraph > clonedMethodFlows ;
@@ -116,7 +116,10 @@ public TypeState foldTypeFlow(PointsToAnalysis bb, TypeFlow<?> originalTypeFlow)
116
116
if (originalTypeFlow == null ) {
117
117
return null ;
118
118
}
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
+ }
120
123
TypeState result = TypeState .forEmpty ();
121
124
for (MethodFlowsGraph methodFlows : clonedMethodFlows .values ()) {
122
125
TypeFlow <?> clonedTypeFlow = methodFlows .lookupCloneOf (bb , originalTypeFlow );
@@ -135,6 +138,10 @@ public TypeState foldTypeFlow(PointsToAnalysis bb, TypeFlow<?> originalTypeFlow)
135
138
/** Check if the type flow is saturated, i.e., any of its clones is saturated. */
136
139
@ Override
137
140
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
+ }
138
145
boolean saturated = false ;
139
146
for (MethodFlowsGraph methodFlows : clonedMethodFlows .values ()) {
140
147
TypeFlow <?> clonedTypeFlow = methodFlows .lookupCloneOf (bb , originalTypeFlow );
0 commit comments