56
56
import com .ibm .wala .ipa .callgraph .propagation .InstanceKey ;
57
57
import com .ibm .wala .ipa .callgraph .propagation .NormalAllocationInNode ;
58
58
import com .ibm .wala .ipa .callgraph .propagation .PointerKey ;
59
- import com .ibm .wala .ipa .callgraph .propagation .cfa .CallStringContext ;
60
- import com .ibm .wala .ipa .callgraph .propagation .cfa .CallStringContextSelector ;
61
59
import com .ibm .wala .ipa .cfg .BasicBlockInContext ;
62
60
import com .ibm .wala .ipa .cha .IClassHierarchy ;
63
61
import com .ibm .wala .ipa .modref .ModRef ;
@@ -239,6 +237,7 @@ public void start() throws IOException, CoreException, CallGraphBuilderCancelExc
239
237
new PropertiesManager .IPropertyDescriptor [] { WholeProgramProperties .Props .LIVE_ANALYSIS });
240
238
TypeStateOptions typeStateOptions = new TypeStateOptions (manager );
241
239
typeStateOptions .setBooleanValue (WholeProgramProperties .Props .LIVE_ANALYSIS .getName (), false );
240
+ // TODO: #127 should also set entry points.
242
241
243
242
TypeReference typeReference = this .getStream ().getTypeReference ();
244
243
IClass streamClass = engine .getClassHierarchy ().lookupClass (typeReference );
@@ -415,7 +414,7 @@ public void start() throws IOException, CoreException, CallGraphBuilderCancelExc
415
414
// fill the instance to predecessors map.
416
415
for (Iterator <InstanceKey > it = result .iterateInstances (); it .hasNext ();) {
417
416
InstanceKey instance = it .next ();
418
- CallStringWithReceivers callString = getCallString (instance );
417
+ CallStringWithReceivers callString = Util . getCallString (instance );
419
418
Set <InstanceKey > possibleReceivers = new HashSet <>(callString .getPossibleReceivers ());
420
419
421
420
// get any additional receivers if necessary #36.
@@ -526,7 +525,7 @@ private static Collection<? extends InstanceKey> getAdditionalNecessaryReceivers
526
525
Collection <InstanceKey > ret = new HashSet <>();
527
526
LOGGER .fine (() -> "Instance is: " + instance );
528
527
529
- CallStringWithReceivers callString = getCallString (instance );
528
+ CallStringWithReceivers callString = Util . getCallString (instance );
530
529
531
530
// for each method in the call string.
532
531
for (IMethod calledMethod : callString .getMethods ()) {
@@ -550,7 +549,7 @@ private static Collection<? extends InstanceKey> getAdditionalNecessaryReceivers
550
549
LOGGER .fine (() -> "Found node: " + node );
551
550
552
551
// try to get its CallStringWithReceivers.
553
- CallStringWithReceivers calledMethodCallString = getCallString (node );
552
+ CallStringWithReceivers calledMethodCallString = Util . getCallString (node );
554
553
555
554
// what are its receivers?
556
555
Set <InstanceKey > possibleReceivers = calledMethodCallString .getPossibleReceivers ();
@@ -602,7 +601,7 @@ private static void discoverPossibleStatefulIntermediateOperations(AggregateSolv
602
601
if (!isStreamCreatedFromIntermediateOperation (instance , hierarchy , callGraph ))
603
602
continue ;
604
603
605
- CallStringWithReceivers callString = getCallString (instance );
604
+ CallStringWithReceivers callString = Util . getCallString (instance );
606
605
607
606
boolean found = false ;
608
607
for (CallSiteReference callSiteReference : callString .getCallSiteRefs ()) {
@@ -645,7 +644,7 @@ private void discoverIfReduceOrderingPossiblyMatters(
645
644
646
645
possibleReturnTypes = Util .getPossibleTypesInterprocedurally (block .getNode (), returnValue ,
647
646
this .getStream ().getAnalysisEngine ().getHeapGraph ().getHeapModel (),
648
- this .getStream ().getAnalysisEngine ().getPointerAnalysis (), this .getStream (), LOGGER );
647
+ this .getStream ().getAnalysisEngine ().getPointerAnalysis (), this .getStream ());
649
648
650
649
LOGGER .info ("Possible reduce types are: " + possibleReturnTypes );
651
650
} else {
@@ -864,7 +863,7 @@ private void discoverPossibleSideEffects(AggregateSolverResult result,
864
863
engine .getCallGraph ()))
865
864
continue ;
866
865
867
- CallStringWithReceivers callString = getCallString (instance );
866
+ CallStringWithReceivers callString = Util . getCallString (instance );
868
867
CallSiteReference [] callSiteRefs = callString .getCallSiteRefs ();
869
868
assert callSiteRefs .length == 2 : "Expecting call sites two-deep." ;
870
869
@@ -1026,7 +1025,7 @@ private static boolean filterPointerKey(PointerKey pointerKey, EclipseProjectAna
1026
1025
private static boolean isStreamCreatedFromIntermediateOperation (InstanceKey instance , IClassHierarchy hierarchy ,
1027
1026
CallGraph callGraph ) throws IOException , CoreException {
1028
1027
// Get the immediate possible receivers of the stream instance.
1029
- Set <InstanceKey > receivers = getCallString (instance ).getPossibleReceivers ();
1028
+ Set <InstanceKey > receivers = Util . getCallString (instance ).getPossibleReceivers ();
1030
1029
1031
1030
// Get any additional receivers we need to consider.
1032
1031
Collection <? extends InstanceKey > additionalReceivers = getAdditionalNecessaryReceiversFromPredecessors (
@@ -1045,23 +1044,6 @@ private static boolean isStreamCreatedFromIntermediateOperation(InstanceKey inst
1045
1044
});
1046
1045
}
1047
1046
1048
- private static CallStringWithReceivers getCallString (InstanceKey instance ) {
1049
- NormalAllocationInNode allocationInNode = (NormalAllocationInNode ) instance ;
1050
- return getCallString (allocationInNode );
1051
- }
1052
-
1053
- private static CallStringWithReceivers getCallString (NormalAllocationInNode allocationInNode ) {
1054
- CGNode node = allocationInNode .getNode ();
1055
- return getCallString (node );
1056
- }
1057
-
1058
- private static CallStringWithReceivers getCallString (CGNode node ) {
1059
- CallStringContext context = (CallStringContext ) node .getContext ();
1060
- CallStringWithReceivers callString = (CallStringWithReceivers ) context
1061
- .get (CallStringContextSelector .CALL_STRING );
1062
- return callString ;
1063
- }
1064
-
1065
1047
/**
1066
1048
* The typestate rules to use.
1067
1049
*/
0 commit comments