summaryrefslogtreecommitdiff
path: root/chapter25/src/main/java/com
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-09-17 12:30:07 -0700
committerCliff Click <cliffc@acm.org>2026-09-17 12:30:07 -0700
commit410ee209ba1db89959f8e6be9cdaf2350e70fd27 (patch)
tree3e3a7beb862d96a6008978fb0affa8f3e5ee782c /chapter25/src/main/java/com
parent8adb94d5405d2235e721590d365beab8a8bf7696 (diff)
downloadSimple-410ee209ba1db89959f8e6be9cdaf2350e70fd27.tar.gz
Simple-410ee209ba1db89959f8e6be9cdaf2350e70fd27.zip
Fix phi widening
Diffstat (limited to 'chapter25/src/main/java/com')
-rw-r--r--chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java b/chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java
index 5ed4382f..4d357fda 100644
--- a/chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java
+++ b/chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java
@@ -90,12 +90,10 @@ public class PhiNode extends Node {
// phi loop widening part
if( r instanceof LoopNode && // Only around loops
- t != _type && // Types changed and are falling (the optimistic case, expected to fall forever)
- !t.isConstant() && // No need to widen constants
- t instanceof TypeInteger newi && // Only widen integers
- (!(_type instanceof TypeInteger oldi) || newi._widen <= oldi._widen) ) {
+ t instanceof TypeInteger ti && // Only widen integers
+ !ti.isConstant() ) { // No need to widen constants
// Widen, to prevent infinite falling of TypeIntegers
- return newi.same_but_slightly_wider_than();
+ return ti.same_but_slightly_wider_than();
}
return t;