From 44e526853636644a5aacda94f61b77b78f55a6d7 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 15 Mar 1999 21:28:31 +0000 Subject: [PATCH] Fixed for new early addOperand git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@438 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/CreateConstantArray.java | 40 +++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/jode/jode/flow/CreateConstantArray.java b/jode/jode/flow/CreateConstantArray.java index 8483fcb..aee2857 100644 --- a/jode/jode/flow/CreateConstantArray.java +++ b/jode/jode/flow/CreateConstantArray.java @@ -38,41 +38,37 @@ public class CreateConstantArray { SequentialBlock sequBlock = (SequentialBlock) last.outer; - if (!(ic.getInstruction() instanceof ArrayStoreOperator) - || !(sequBlock.subBlocks[0] instanceof InstructionBlock) + Operator storeOp = ic.getInstruction().getOperator(); + if (!(ic.getInstruction() instanceof ComplexExpression) + || !(ic.getInstruction().getOperator() + instanceof ArrayStoreOperator) + || ic.getInstruction().getOperandCount() != 1 + || !(sequBlock.subBlocks[0] instanceof SpecialBlock) || !(sequBlock.outer instanceof SequentialBlock)) return false; - ArrayStoreOperator store - = (ArrayStoreOperator) ic.getInstruction(); - InstructionBlock ib = (InstructionBlock)sequBlock.subBlocks[0]; - sequBlock = (SequentialBlock) sequBlock.outer; - if (!(sequBlock.subBlocks[0] instanceof InstructionBlock) - || !(sequBlock.outer instanceof SequentialBlock)) - return false; + ComplexExpression storeExpr + = (ComplexExpression) ic.getInstruction(); + ArrayStoreOperator store + = (ArrayStoreOperator) storeExpr.getOperator(); - Expression expr = ib.getInstruction(); - ib = (InstructionBlock)sequBlock.subBlocks[0]; - sequBlock = (SequentialBlock) sequBlock.outer; + Expression[] storeSub = storeExpr.getSubExpressions(); + if (!(storeSub[0] instanceof NopOperator) + || !(storeSub[1] instanceof ConstOperator)) + return false; - if (expr.getOperandCount() > 0 - || !(ib.getInstruction() instanceof ConstOperator) - || !(sequBlock.subBlocks[0] instanceof SpecialBlock) - || !(sequBlock.outer instanceof SequentialBlock)) - return false; - - ConstOperator indexOp = (ConstOperator) ib.getInstruction(); + Expression expr = storeSub[2]; + ConstOperator indexOp = (ConstOperator) storeSub[1]; SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0]; sequBlock = (SequentialBlock) sequBlock.outer; - if (!indexOp.getType().isOfType(Type.tUInt) - || dup.type != SpecialBlock.DUP + if (dup.type != SpecialBlock.DUP || dup.depth != 0 || dup.count != 1 || !(sequBlock.subBlocks[0] instanceof InstructionBlock)) return false; int index = Integer.parseInt(indexOp.getValue()); - ib = (InstructionBlock)sequBlock.subBlocks[0]; + InstructionBlock ib = (InstructionBlock)sequBlock.subBlocks[0]; if (ib.getInstruction() instanceof ComplexExpression && (ib.getInstruction().getOperator()