Skip to content

Commit 7f9e14f

Browse files
committed
We can't default ROM.
1 parent a0ac142 commit 7f9e14f

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamStateMachine.java

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,16 @@ private static boolean deriveRomForScalarMethod(SSAInvokeInstruction invokeInstr
201201
return deriveRomForVoidMethod(invokeInstruction);
202202
}
203203

204-
private static boolean deriveRomForVoidMethod(SSAInvokeInstruction invokeInstruction) {
204+
private static boolean deriveRomForVoidMethod(SSAInvokeInstruction invokeInstruction)
205+
throws UnknownIfReduceOrderMattersException {
205206
MethodReference declaredTarget = invokeInstruction.getCallSite().getDeclaredTarget();
206207

207208
if (isTerminalOperationWhereReduceOrderMatters(declaredTarget))
208209
return true;
209210
else if (isTerminalOperationWhereReduceOrderDoesNotMatter(declaredTarget))
210211
return false;
211-
else {
212-
boolean ret = true;
213-
LOGGER.warning(() -> "Can't decipher ROM for method: " + declaredTarget + ". Defaulting to: " + ret);
214-
return ret;
215-
}
212+
else
213+
throw new UnknownIfReduceOrderMattersException("Can't decipher ROM for method: " + declaredTarget + ".");
216214
}
217215

218216
/**
@@ -576,41 +574,39 @@ private void discoverIfReduceOrderingPossiblyMatters(EclipseProjectAnalysisEngin
576574

577575
Boolean rom = null;
578576

579-
if (isVoid(possibleReturnTypes))
580-
rom = deriveRomForVoidMethod(invokeInstruction);
581-
else {
582-
boolean scalar = Util.isScalar(possibleReturnTypes);
583-
if (scalar)
584-
try {
577+
try {
578+
if (isVoid(possibleReturnTypes))
579+
rom = deriveRomForVoidMethod(invokeInstruction);
580+
else {
581+
boolean scalar = Util.isScalar(possibleReturnTypes);
582+
if (scalar)
585583
rom = deriveRomForScalarMethod(invokeInstruction);
586-
} catch (UnknownIfReduceOrderMattersException e) {
587-
// for each possible receiver associated with the terminal block.
588-
OrdinalSet<InstanceKey> receivers = this.terminalBlockToPossibleReceivers.get(block);
589-
590-
for (InstanceKey instanceKey : receivers) {
591-
// get the stream for the instance key.
592-
Set<InstanceKey> originStreams = this.computePossibleOriginStreams(instanceKey);
593-
594-
// for each origin stream.
595-
for (InstanceKey origin : originStreams) {
596-
// get the "Stream" representing it.
597-
Stream stream = this.instanceToStreamMap.get(origin);
598-
599-
if (stream == null)
600-
LOGGER.warning(() -> "Can't find Stream instance for instance key: "
601-
+ instanceKey + " using origin: " + origin);
602-
else {
603-
LOGGER.log(Level.WARNING, "Unable to derive ROM for: " + stream.getCreation(),
604-
e);
605-
stream.addStatusEntry(PreconditionFailure.NON_DETERMINABLE_REDUCTION_ORDERING,
606-
"Cannot derive reduction ordering for stream: " + stream.getCreation()
607-
+ ".");
608-
}
609-
}
584+
else // !scalar
585+
rom = this.deriveRomForNonScalarMethod(possibleReturnTypes, orderingInference);
586+
}
587+
} catch (UnknownIfReduceOrderMattersException e) {
588+
// for each possible receiver associated with the terminal block.
589+
OrdinalSet<InstanceKey> receivers = this.terminalBlockToPossibleReceivers.get(block);
590+
591+
for (InstanceKey instanceKey : receivers) {
592+
// get the stream for the instance key.
593+
Set<InstanceKey> originStreams = this.computePossibleOriginStreams(instanceKey);
594+
595+
// for each origin stream.
596+
for (InstanceKey origin : originStreams) {
597+
// get the "Stream" representing it.
598+
Stream stream = this.instanceToStreamMap.get(origin);
599+
600+
if (stream == null)
601+
LOGGER.warning(() -> "Can't find Stream instance for instance key: " + instanceKey
602+
+ " using origin: " + origin);
603+
else {
604+
LOGGER.log(Level.WARNING, "Unable to derive ROM for: " + stream.getCreation(), e);
605+
stream.addStatusEntry(PreconditionFailure.NON_DETERMINABLE_REDUCTION_ORDERING,
606+
"Cannot derive reduction ordering for stream: " + stream.getCreation() + ".");
610607
}
611608
}
612-
else // !scalar
613-
rom = this.deriveRomForNonScalarMethod(possibleReturnTypes, orderingInference);
609+
}
614610
}
615611

616612
// if reduce ordering matters.

0 commit comments

Comments
 (0)