From 25e2f38ce919af07a7bdf037aa8a334382469d74 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 15 Mar 1999 18:00:35 +0000 Subject: [PATCH] fix for multiple combining expreessions git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@430 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/CreateExpression.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/jode/jode/flow/CreateExpression.java b/jode/jode/flow/CreateExpression.java index 91a9a23..d2aa4cc 100644 --- a/jode/jode/flow/CreateExpression.java +++ b/jode/jode/flow/CreateExpression.java @@ -66,7 +66,24 @@ public class CreateExpression { || lastExpression.canCombine(expr) <= 0) return false; - lastExpression = expr; + /* Hmm, we should really set lastExpression to + * lastExpression.combine(expr), but that may change the + * expressions :-( XXX + * + * We do a conservative approach and check if there are + * no possible side effects with the skipped expressions. + * Theoretically we would only have to check expressions, + * that are combined at an earlier point. + */ + SequentialBlock block = sequBlock; + while (block != last.outer) { + block = (SequentialBlock) block.subBlocks[1]; + if (((InstructionBlock)block.subBlocks[0]) + .getInstruction().hasSideEffects(expr)) + return false; + } + + if (!(sequBlock.outer instanceof SequentialBlock)) return false; sequBlock = (SequentialBlock) sequBlock.outer;