Skip to content

Commit 029d311

Browse files
alexjordanmatneu
authored andcommitted
[GR-68833] Fix impossible-redundant-condition warnings from Parfait.
PullRequest: graal/22324
2 parents 8c608d6 + 5849af9 commit 029d311

File tree

20 files changed

+58
-69
lines changed

20 files changed

+58
-69
lines changed

compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalFeature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private static Path readLibgraalJavaHome(ClassLoader cl) {
131131
throw new GraalError(cl.getClass().getName() + " does not support META-INF/libgraal.java.home protocol (see javadoc of HostedLibGraalClassLoader)");
132132
}
133133
return Path.of(new String(in.readAllBytes()));
134-
} catch (IOException e) {
134+
} catch (IOException e) { // Parfait_ALLOW impossible-redundant-condition (PARSEC-7191)
135135
throw new GraalError(e);
136136
}
137137
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/asm/amd64/AMD64BaseAssembler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ private void emitOperandHelper(int reg, AMD64Address addr, boolean force4Byte, i
667667
int newDisp = disp / evexDisp8Scale;
668668
if (isByte(newDisp)) {
669669
disp = newDisp;
670-
assert isByte(disp) && !overriddenForce4Byte : disp;
670+
assert isByte(disp) : disp;
671671
}
672672
} else {
673673
overriddenForce4Byte = true;
@@ -703,7 +703,7 @@ private void emitOperandHelper(int reg, AMD64Address addr, boolean force4Byte, i
703703
int newDisp = disp / evexDisp8Scale;
704704
if (isByte(newDisp)) {
705705
disp = newDisp;
706-
assert isByte(disp) && !overriddenForce4Byte : disp;
706+
assert isByte(disp) : disp;
707707
}
708708
} else {
709709
overriddenForce4Byte = true;
@@ -737,7 +737,7 @@ private void emitOperandHelper(int reg, AMD64Address addr, boolean force4Byte, i
737737
int newDisp = disp / evexDisp8Scale;
738738
if (isByte(newDisp)) {
739739
disp = newDisp;
740-
assert isByte(disp) && !overriddenForce4Byte : disp;
740+
assert isByte(disp) : disp;
741741
}
742742
} else {
743743
overriddenForce4Byte = true;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/Graph.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,6 @@ public void close() {
898898
cur = cur.next;
899899
}
900900

901-
assert cur == listener : "Listener not found";
902901
last.next = listener.next;
903902
}
904903

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/amd64/AMD64ConvertFloatToIntegerOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public AMD64ConvertFloatToIntegerOp(LIRGeneratorTool tool, OpcodeEmitter opcodeE
134134
}
135135

136136
private static boolean needZeroTmp(boolean canOverflow, boolean canBeNaN, Signedness signedness, AMD64SIMDInstructionEncoding encoding) {
137-
return canOverflow || (signedness == Signedness.UNSIGNED && encoding == AMD64SIMDInstructionEncoding.EVEX && (canOverflow || canBeNaN));
137+
return canOverflow || (signedness == Signedness.UNSIGNED && encoding == AMD64SIMDInstructionEncoding.EVEX && canBeNaN);
138138
}
139139

140140
@Override

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/loop/phases/SpeculativeGuardMovementPhase.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,6 @@ private OptimizedCompareTests shouldOptimizeCompare(CompareNode compare, Inducti
622622
if (l == null) {
623623
return null;
624624
}
625-
assert l != null : "Loop for guard anchor block must not be null:" + guardAnchorBlock.getBeginNode() + " loop " + iv.getLoop() + " inverted?" +
626-
isInverted(iv.getLoop());
627625
do {
628626
if (!allowsSpeculativeGuardMovement(guard.getReason(), (LoopBeginNode) l.getHeader().getBeginNode(), true)) {
629627
debug.log("shouldOptimizeCompare(%s):The guard would not hoist", guard);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/FrameState.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ public FrameState duplicateModified(StructuredGraph graph,
611611
}
612612
}
613613
if (newStackState == StackState.Rethrow && stackState != StackState.Rethrow && popKind == JavaKind.Void) {
614-
assert popKind == JavaKind.Void : Assertions.errorMessage(popKind);
615614
copyStackSize = 0;
616615
} else {
617616
if (popKind != JavaKind.Void) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/classfile/ClassfileBytecodeProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ private synchronized Classfile getClassfile(Class<?> c) {
110110
if (classfile == null) {
111111
try {
112112
ResolvedJavaType type = metaAccess.lookupJavaType(c);
113+
// Parfait_ALLOW impossible-redundant-condition (Parfait bug PARSEC-7191)
113114
try (InputStream in = GraalServices.getClassfileAsStream(c)) {
114115
if (in != null) {
115116
DataInputStream stream = new DataInputStream(in);

truffle/src/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/SpecializationStatistics.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ void accept(EnabledNodeStatistics statistics) {
406406
}
407407
combinationSumStat.accept(combinationSum, sourceSection);
408408

409+
// Parfait_ALLOW impossible-redundant-condition
409410
if (nodeSum != 0) {
410411
nodeStat.accept(nodeSum, sourceSection);
411412
}

truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/EventBinding.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ boolean isInstrumentedFull(Set<Class<?>> providedTags, RootNode rootNode, Node n
511511
if (!instrumentedLeaf || rootNode == null) {
512512
return false;
513513
}
514-
if (!isProbe || nearestSourceSections == null || isProbe && isNearestSection(nodeSourceSection)) {
514+
if (!isProbe || nearestSourceSections == null || isNearestSection(nodeSourceSection)) {
515515
return isInstrumentedRoot(providedTags, rootNode, rootNode.getSourceSection(), 0);
516516
}
517517
return false;

truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/ProbeNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,6 @@ ProbeNode findParentProbe() {
718718
} else if (node instanceof InstrumentableNode instrumentable) {
719719
probe = instrumentable.findProbe();
720720
if (probe != null && probe.eagerProbe && probe != this) {
721-
assert probe != this;
722721
return probe;
723722
}
724723
} else if (node instanceof RootNode) {

0 commit comments

Comments
 (0)