From 174daf2d82eb720c0d82beb3c64b24b33aa5560a Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 1 Sep 2024 06:07:19 -0400 Subject: [PATCH] fix: Regression in type inference in type-only analysis due to prior var-cache changes --- .../assembler/compile/analysis/frame/TypedFrameImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jasm-composition-jvm/src/main/java/me/darknet/assembler/compile/analysis/frame/TypedFrameImpl.java b/jasm-composition-jvm/src/main/java/me/darknet/assembler/compile/analysis/frame/TypedFrameImpl.java index 8c090a8..754c981 100644 --- a/jasm-composition-jvm/src/main/java/me/darknet/assembler/compile/analysis/frame/TypedFrameImpl.java +++ b/jasm-composition-jvm/src/main/java/me/darknet/assembler/compile/analysis/frame/TypedFrameImpl.java @@ -84,6 +84,11 @@ public boolean merge(@NotNull InheritanceChecker checker, @NotNull TypedFrame ot // Our frame doesn't have the local variable. // Copy it if we know the type. setLocal(index, otherLocal); + + // If we are learning the type of the variable where it was previously 'null' + // then we will mark the frame as being changed. But if the other frame also has 'null' + // as the type then we don't want to be marked as changed (will cause an infinite loop). + changed = otherType != null; } else if (otherLocal.isNull()) { // Our frame can be updated to fill in 'null' with a known type. setLocal(index, otherLocal.adaptType(ourType));