@@ -683,6 +683,7 @@ private void discoverIfReduceOrderingPossiblyMatters(EclipseProjectAnalysisEngin
683
683
assert numOfRetVals <= 1 : "How could you possibly return " + numOfRetVals + " values?" ;
684
684
685
685
Collection <TypeAbstraction > possibleReturnTypes = null ;
686
+ Boolean rom = null ;
686
687
687
688
// if it's a non-void method.
688
689
if (numOfRetVals > 0 ) {
@@ -691,49 +692,62 @@ private void discoverIfReduceOrderingPossiblyMatters(EclipseProjectAnalysisEngin
691
692
possibleReturnTypes = Util .getPossibleTypesInterprocedurally (block .getNode (), returnValue , engine ,
692
693
orderingInference );
693
694
695
+ // if no return types can be found.
696
+ if (possibleReturnTypes .isEmpty ()) {
697
+ // default to true.
698
+ rom = true ;
699
+
700
+ LOGGER .warning ("Number of returned values are: " + numOfRetVals
701
+ + " but cannot find possible return types for node: " + block .getNode ()
702
+ + " and return value:" + returnValue + ". Defaulting ROM to: " + rom + " for block: "
703
+ + block + "." );
704
+ }
705
+
694
706
LOGGER .fine ("Possible reduce types are: " + possibleReturnTypes );
695
707
} else {
696
708
// it's a void method.
697
709
possibleReturnTypes = Collections .singleton (JavaPrimitiveType .VOID );
698
710
}
699
711
700
- Boolean rom = null ;
701
-
702
- if (isVoid (possibleReturnTypes ))
703
- rom = deriveRomForVoidMethod (invokeInstruction );
704
- else {
705
- boolean scalar = Util .isScalar (possibleReturnTypes );
706
- if (scalar )
707
- try {
708
- rom = deriveRomForScalarMethod (invokeInstruction );
709
- } catch (UnknownIfReduceOrderMattersException e ) {
710
- // for each possible receiver associated with the terminal block.
711
- OrdinalSet <InstanceKey > receivers = terminalBlockToPossibleReceivers .get (block );
712
-
713
- for (InstanceKey instanceKey : receivers ) {
714
- // get the stream for the instance key.
715
- Set <InstanceKey > originStreams = computePossibleOriginStreams (instanceKey );
716
-
717
- // for each origin stream.
718
- for (InstanceKey origin : originStreams ) {
719
- // get the "Stream" representing it.
720
- Stream stream = instanceToStreamMap .get (origin );
721
-
722
- if (stream == null )
723
- LOGGER .warning (() -> "Can't find Stream instance for instance key: "
724
- + instanceKey + " using origin: " + origin );
725
- else {
726
- LOGGER .log (Level .WARNING , "Unable to derive ROM for : " + stream .getCreation (),
727
- e );
728
- stream .addStatusEntry (PreconditionFailure .NON_DETERMINABLE_REDUCTION_ORDERING ,
729
- "Cannot derive reduction ordering for stream: " + stream .getCreation ()
730
- + "." );
712
+ // if we haven't determined ROM yet.
713
+ if (rom == null ) {
714
+ if (isVoid (possibleReturnTypes ))
715
+ rom = deriveRomForVoidMethod (invokeInstruction );
716
+ else {
717
+ boolean scalar = Util .isScalar (possibleReturnTypes );
718
+ if (scalar )
719
+ try {
720
+ rom = deriveRomForScalarMethod (invokeInstruction );
721
+ } catch (UnknownIfReduceOrderMattersException e ) {
722
+ // for each possible receiver associated with the terminal block.
723
+ OrdinalSet <InstanceKey > receivers = terminalBlockToPossibleReceivers .get (block );
724
+
725
+ for (InstanceKey instanceKey : receivers ) {
726
+ // get the stream for the instance key.
727
+ Set <InstanceKey > originStreams = computePossibleOriginStreams (instanceKey );
728
+
729
+ // for each origin stream.
730
+ for (InstanceKey origin : originStreams ) {
731
+ // get the "Stream" representing it.
732
+ Stream stream = instanceToStreamMap .get (origin );
733
+
734
+ if (stream == null )
735
+ LOGGER .warning (() -> "Can't find Stream instance for instance key: "
736
+ + instanceKey + " using origin: " + origin );
737
+ else {
738
+ LOGGER .log (Level .WARNING ,
739
+ "Unable to derive ROM for : " + stream .getCreation (), e );
740
+ stream .addStatusEntry (
741
+ PreconditionFailure .NON_DETERMINABLE_REDUCTION_ORDERING ,
742
+ "Cannot derive reduction ordering for stream: "
743
+ + stream .getCreation () + "." );
744
+ }
731
745
}
732
746
}
733
747
}
734
- }
735
- else // !scalar
736
- rom = deriveRomForNonScalarMethod ( possibleReturnTypes , orderingInference );
748
+ else // !scalar
749
+ rom = deriveRomForNonScalarMethod ( possibleReturnTypes , orderingInference );
750
+ }
737
751
}
738
752
739
753
// if reduce ordering matters.
0 commit comments