From 47b3820f0d2205832e994e346f4d560283493c5f Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 5 Feb 1999 12:51:23 +0000 Subject: [PATCH] check for combineable operator git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@182 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/CombineIfGotoExpressions.java | 3 ++- jode/jode/flow/CreateExpression.java | 3 ++- jode/jode/flow/CreateForInitializer.java | 2 ++ jode/jode/flow/FlowBlock.java | 8 +++++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/jode/jode/flow/CombineIfGotoExpressions.java b/jode/jode/flow/CombineIfGotoExpressions.java index 787a015..42fcb40 100644 --- a/jode/jode/flow/CombineIfGotoExpressions.java +++ b/jode/jode/flow/CombineIfGotoExpressions.java @@ -44,7 +44,8 @@ public class CombineIfGotoExpressions { return false; Expression expr = ib.getInstruction(); - if (lastCombined.canCombine(expr) + e[1].canCombine(expr) <= 0) + if (!(expr.getOperator() instanceof CombineableOperator) + || lastCombined.canCombine(expr) + e[1].canCombine(expr) <= 0) /* Tricky, the above is true, iff one of the two * Expressions conflict, or both fail. */ return false; diff --git a/jode/jode/flow/CreateExpression.java b/jode/jode/flow/CreateExpression.java index 727836d..2f14f1e 100644 --- a/jode/jode/flow/CreateExpression.java +++ b/jode/jode/flow/CreateExpression.java @@ -72,11 +72,12 @@ public class CreateExpression { Expression expr = ((InstructionBlock) sequBlock.subBlocks[0]).getInstruction(); - if (!expr.isVoid()) { if (--i == 0) break; } else if (lastExpression == null + || !(expr.getOperator() + instanceof CombineableOperator) || lastExpression.canCombine(expr) <= 0) return false; diff --git a/jode/jode/flow/CreateForInitializer.java b/jode/jode/flow/CreateForInitializer.java index 6e6ed6d..3be28e1 100644 --- a/jode/jode/flow/CreateForInitializer.java +++ b/jode/jode/flow/CreateForInitializer.java @@ -41,6 +41,8 @@ public class CreateForInitializer { InstructionBlock init = (InstructionBlock) sequBlock.subBlocks[0]; if (!init.getInstruction().isVoid() + || !(init.getInstruction().getOperator() + instanceof CombineableOperator) || !forBlock.conditionMatches(init)) return false; diff --git a/jode/jode/flow/FlowBlock.java b/jode/jode/flow/FlowBlock.java index 97d8d46..f743dad 100644 --- a/jode/jode/flow/FlowBlock.java +++ b/jode/jode/flow/FlowBlock.java @@ -21,6 +21,7 @@ package jode.flow; import java.util.*; import jode.*; import jode.decompiler.Expression; +import jode.decompiler.CombineableOperator; /** * A flow block is the structure of which the flow graph consists. A @@ -783,9 +784,10 @@ public class FlowBlock { } if (!createdForBlock - && ((InstructionBlock) - lastModified).getInstruction().isVoid()) { - + && (((InstructionBlock) + lastModified).getInstruction().getOperator() + instanceof CombineableOperator)) { + /* The only jump is the jump of the last * instruction lastModified, there is a big * chance, that this is a for block, but we