Skip to content

Commit bdf112f

Browse files
committed
Fix reachability analysis needs to take cached bound state into account.
1 parent 7a73d00 commit bdf112f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

truffle/src/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SuppressWarningTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public abstract static class DeprecationTestNode extends Node {
5555
* Suppress deprecated warning with deprecated.
5656
*/
5757
@SuppressWarnings("deprecated")
58-
@Specialization(guards = "deprecatedGuard(v)")
58+
@Specialization(guards = {"deprecatedGuard(v)", "v == 0"})
5959
int s0(int v) {
6060
return v;
6161
}
@@ -64,7 +64,7 @@ int s0(int v) {
6464
* Suppress deprecated warning with all.
6565
*/
6666
@SuppressWarnings("all")
67-
@Specialization(guards = "deprecatedGuard(v)")
67+
@Specialization(guards = {"deprecatedGuard(v)", "v == 1"})
6868
int s1(int v) {
6969
return v;
7070
}

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,11 @@ public boolean isReachableAfter(SpecializationData prev) {
951951
Iterator<GuardExpression> currentGuards = getGuards().iterator();
952952
while (prevGuards.hasNext()) {
953953
GuardExpression prevGuard = prevGuards.next();
954+
if (prev.isGuardBoundWithCache(prevGuard)) {
955+
// if a guard with cache is bound the next specialization is always reachable
956+
return true;
957+
}
958+
954959
GuardExpression currentGuard = currentGuards.hasNext() ? currentGuards.next() : null;
955960
if (currentGuard == null || !currentGuard.implies(prevGuard)) {
956961
return true;

0 commit comments

Comments
 (0)