toString added.

addOperand


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@398 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent e5d9af2c18
commit 4e93ed861f
  1. 30
      jode/jode/flow/VariableStack.java

@ -80,24 +80,12 @@ public class VariableStack {
public Expression mergeIntoExpression(Expression expr, VariableSet used) { public Expression mergeIntoExpression(Expression expr, VariableSet used) {
/* assert expr.getOperandCount() == stackMap.length */ /* assert expr.getOperandCount() == stackMap.length */
ComplexExpression parent = null; for (int i = stackMap.length-1; i >= 0; i--) {
Expression inner = expr;
while (inner instanceof ComplexExpression) {
parent = (ComplexExpression)inner;
inner = parent.getSubExpressions()[0];
}
Expression[] loads = new Expression[stackMap.length];
for (int i=0; i< stackMap.length; i++) {
if (!used.contains(stackMap[i])) if (!used.contains(stackMap[i]))
used.addElement(stackMap[i]); used.addElement(stackMap[i]);
loads[i] = new LocalLoadOperator(stackMap[i].getType(), expr = expr.addOperand
stackMap[i]); (new LocalLoadOperator(stackMap[i].getType(), stackMap[i]));
} }
Expression newExpr = new ComplexExpression((Operator)inner, loads);
if (parent != null)
parent.setSubExpressions(0, newExpr);
else
expr = newExpr;
return expr; return expr;
} }
@ -153,4 +141,14 @@ public class VariableStack {
} else } else
throw new jode.AssertError("Unknown SpecialBlock"); throw new jode.AssertError("Unknown SpecialBlock");
} }
public String toString() {
StringBuffer result = new StringBuffer("[");
for (int i=0; i < stackMap.length; i++) {
if (i>0)
result.append(", ");
result.append(stackMap[i].getName());
}
return result.append("]").toString();
}
} }

Loading…
Cancel
Save