OuterValues added

inner/anonymous classes completely reworked
use getSubExpressions()[0] instead of getLValue()


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1193 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 38a01116c1
commit 8fc12f679e
  1. 22
      jode/jode/flow/CreateAssignExpression.java
  2. 9
      jode/jode/flow/CreatePrePostIncExpression.java
  3. 1
      jode/jode/flow/FlowBlock.java.in
  4. 1230
      jode/jode/flow/TransformConstructors.java

@ -58,14 +58,15 @@ public class CreateAssignExpression {
StoreInstruction store = (StoreInstruction) ic.getInstruction(); StoreInstruction store = (StoreInstruction) ic.getInstruction();
if (!store.isFreeOperator()) if (!store.isFreeOperator())
return false; return false;
int lvalueCount = store.getLValue().getFreeOperandCount(); Expression lvalue = store.getSubExpressions()[0];
int lvalueCount = lvalue.getFreeOperandCount();
boolean isAssignOp = false; boolean isAssignOp = false;
if (opBlock.subBlocks[0] instanceof SpecialBlock) { if (opBlock.subBlocks[0] instanceof SpecialBlock) {
SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0]; SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0];
if (dup.type != SpecialBlock.DUP if (dup.type != SpecialBlock.DUP
|| dup.depth != lvalueCount || dup.depth != lvalueCount
|| dup.count != store.getLValue().getType().stackSize() || dup.count != lvalue.getType().stackSize()
|| !(opBlock.outer instanceof SequentialBlock)) || !(opBlock.outer instanceof SequentialBlock))
return false; return false;
opBlock = (SequentialBlock) opBlock.outer; opBlock = (SequentialBlock) opBlock.outer;
@ -102,7 +103,7 @@ public class CreateAssignExpression {
if (expr instanceof ConvertOperator if (expr instanceof ConvertOperator
&& expr.getSubExpressions()[0] instanceof Operator && expr.getSubExpressions()[0] instanceof Operator
&& expr.getType().isOfType(store.getLValue().getType())) { && expr.getType().isOfType(lvalue.getType())) {
/* This gets tricky. We need to allow something like /* This gets tricky. We need to allow something like
* s = (short) (int) ((double) s / 0.1); * s = (short) (int) ((double) s / 0.1);
@ -129,9 +130,9 @@ public class CreateAssignExpression {
|| !(loadExpr.isFreeOperator(lvalueCount))) || !(loadExpr.isFreeOperator(lvalueCount)))
return false; return false;
if (store.getLValue() instanceof LocalStoreOperator) if (lvalue instanceof LocalStoreOperator)
((LocalLoadOperator)loadExpr).getLocalInfo().combineWith ((LocalLoadOperator)loadExpr).getLocalInfo().combineWith
(((LocalStoreOperator)store.getLValue()).getLocalInfo()); (((LocalStoreOperator)lvalue).getLocalInfo());
rightHandSide = expr.getSubExpressions()[1]; rightHandSide = expr.getSubExpressions()[1];
} else { } else {
@ -159,9 +160,9 @@ public class CreateAssignExpression {
|| !(((Operator) simple).isFreeOperator(lvalueCount))) || !(((Operator) simple).isFreeOperator(lvalueCount)))
return false; return false;
if (store.getLValue() instanceof LocalStoreOperator) if (lvalue instanceof LocalStoreOperator)
((LocalLoadOperator)simple).getLocalInfo().combineWith ((LocalLoadOperator)simple).getLocalInfo().combineWith
(((LocalStoreOperator)store.getLValue()).getLocalInfo()); (((LocalStoreOperator)lvalue).getLocalInfo());
/* ... and remove it. */ /* ... and remove it. */
if (parent != null) { if (parent != null) {
@ -177,7 +178,7 @@ public class CreateAssignExpression {
dup.removeBlock(); dup.removeBlock();
ib.setInstruction(rightHandSide); ib.setInstruction(rightHandSide);
store.getLValue().setType(rvalueType); lvalue.setType(rvalueType);
store.makeOpAssign(store.OPASSIGN_OP + opIndex); store.makeOpAssign(store.OPASSIGN_OP + opIndex);
if (isAssignOp) if (isAssignOp)
@ -199,10 +200,11 @@ public class CreateAssignExpression {
if (sequBlock.subBlocks[0] instanceof SpecialBlock if (sequBlock.subBlocks[0] instanceof SpecialBlock
&& store.isFreeOperator()) { && store.isFreeOperator()) {
Expression lvalue = store.getSubExpressions()[0];
SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0]; SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0];
if (dup.type != SpecialBlock.DUP if (dup.type != SpecialBlock.DUP
|| dup.depth != store.getLValue().getFreeOperandCount() || dup.depth != lvalue.getFreeOperandCount()
|| dup.count != store.getLValue().getType().stackSize()) || dup.count != lvalue.getType().stackSize())
return false; return false;
dup.removeBlock(); dup.removeBlock();

@ -113,8 +113,9 @@ public class CreatePrePostIncExpression {
* not yet resolved (and note that the rvalue part * not yet resolved (and note that the rvalue part
* should also have 1 remaining operand) * should also have 1 remaining operand)
*/ */
int lvalueCount = store.getLValue().getFreeOperandCount(); Expression lvalue = store.getSubExpressions()[0];
if (!store.getLValue().isFreeOperator() int lvalueCount = lvalue.getFreeOperandCount();
if (!((Operator)lvalue).isFreeOperator()
|| !store.isVoid() || !store.isVoid()
|| !(store.getSubExpressions()[1] instanceof BinaryOperator)) || !(store.getSubExpressions()[1] instanceof BinaryOperator))
return false; return false;
@ -148,7 +149,7 @@ public class CreatePrePostIncExpression {
SpecialBlock dup = (SpecialBlock) sb.subBlocks[0]; SpecialBlock dup = (SpecialBlock) sb.subBlocks[0];
if (dup.type != SpecialBlock.DUP if (dup.type != SpecialBlock.DUP
|| dup.count != store.getLValue().getType().stackSize() || dup.count != lvalue.getType().stackSize()
|| dup.depth != lvalueCount) || dup.depth != lvalueCount)
return false; return false;
@ -176,7 +177,7 @@ public class CreatePrePostIncExpression {
return false; return false;
} }
ic.setInstruction ic.setInstruction
(new PrePostFixOperator(store.getLValue().getType(), op, (new PrePostFixOperator(lvalue.getType(), op,
store.getLValue(), true)); store.getLValue(), true));
ic.moveDefinitions(sb, last); ic.moveDefinitions(sb, last);
last.replace(sb); last.replace(sb);

@ -1743,4 +1743,3 @@ public class FlowBlock {
} }
} }
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save