From 410ee209ba1db89959f8e6be9cdaf2350e70fd27 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Thu, 17 Sep 2026 12:30:07 -0700 Subject: Fix phi widening --- chapter25/src/main/java/com/seaofnodes/simple/node/PhiNode.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'chapter25/src/main') 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; -- cgit v1.2.3