Pack200 - remove some unused methods and fields

git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/java/trunk@986603 13f79535-47bb-0310-9956-ffa450edef68
master
Sian January 14 years ago
parent 09a76443c8
commit fcf361ebe7
  1. 4
      src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
  2. 151
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteCodeForm.java
  3. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ByteForm.java
  4. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ClassRefForm.java
  5. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/DoubleForm.java
  6. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/FieldRefForm.java
  7. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/FloatRefForm.java
  8. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/IMethodRefForm.java
  9. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/IincForm.java
  10. 4
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/InitMethodReferenceForm.java
  11. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/IntRefForm.java
  12. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/LabelForm.java
  13. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/LocalForm.java
  14. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/LongForm.java
  15. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/MethodRefForm.java
  16. 12
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/MultiANewArrayForm.java
  17. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/NewInitMethodRefForm.java
  18. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/NoArgumentForm.java
  19. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ShortForm.java
  20. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/StringRefForm.java
  21. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/SuperFieldRefForm.java
  22. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/SuperInitMethodRefForm.java
  23. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/SuperMethodRefForm.java
  24. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/SwitchForm.java
  25. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ThisFieldRefForm.java
  26. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ThisInitMethodRefForm.java
  27. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/ThisMethodRefForm.java
  28. 8
      src/main/java/org/apache/harmony/unpack200/bytecode/forms/WideForm.java

@ -100,10 +100,6 @@ public class ByteCode extends ClassFileEntry {
return getByteCodeForm().getOpcode(); return getByteCodeForm().getOpcode();
} }
public int getOperandType() {
return getByteCodeForm().getOperandType();
}
private boolean hashcodeComputed; private boolean hashcodeComputed;
private int cachedHashCode; private int cachedHashCode;

@ -23,39 +23,7 @@ import org.apache.harmony.unpack200.bytecode.ByteCode;
import org.apache.harmony.unpack200.bytecode.CodeAttribute; import org.apache.harmony.unpack200.bytecode.CodeAttribute;
import org.apache.harmony.unpack200.bytecode.OperandManager; import org.apache.harmony.unpack200.bytecode.OperandManager;
public class ByteCodeForm { public abstract class ByteCodeForm {
// Operand types. Those with no operands and
// those with operands on the operand stack are
// treated similarly. These types are used to
// distinguish different kinds of non-stack
// bytecode operands
protected static final int TYPE_NONE = 0;
protected static final int TYPE_BYTE = 1;
protected static final int TYPE_SHORT = 2;
protected static final int TYPE_INTREF = 3;
protected static final int TYPE_FLOATREF = 4;
protected static final int TYPE_STRINGREF = 5;
protected static final int TYPE_CLASSREF = 6;
protected static final int TYPE_LONG = 7;
protected static final int TYPE_DOUBLE = 8;
protected static final int TYPE_LOCAL = 9;
protected static final int TYPE_LABEL = 10;
protected static final int TYPE_FIELDREF = 11;
protected static final int TYPE_METHODREF = 12;
protected static final int TYPE_IMETHODREF = 13;
protected static final int TYPE_WIDE = 14;
protected static final int TYPE_IINC = 15;
protected static final int TYPE_SWITCH = 16;
protected static final int TYPE_MULTIANEWARRAY = 17;
protected static final int TYPE_THISFIELDREF = 18;
protected static final int TYPE_THISMETHODREF = 19;
protected static final int TYPE_SUPERFIELDREF = 20;
protected static final int TYPE_SUPERMETHODREF = 21;
protected static final int TYPE_THISINITMETHODREF = 22;
protected static final int TYPE_SUPERINITMETHODREF = 23;
protected static final int TYPE_NEWINITMETHODREF = 24;
protected static final int TYPE_NEWCLASSREF = 25;
protected static final boolean WIDENED = true; protected static final boolean WIDENED = true;
@ -480,13 +448,8 @@ public class ByteCodeForm {
return (ByteCodeForm) byteCodeArray[opcode]; return (ByteCodeForm) byteCodeArray[opcode];
} }
public static ByteCodeForm get(String name) {
return (ByteCodeForm) byteCodesByName.get(name);
}
public String toString() { public String toString() {
return this.getClass().getName() + "(" + getName() + ":" return this.getClass().getName() + "(" + getName() + ")";
+ getOperandType() + ")";
} }
public int getOpcode() { public int getOpcode() {
@ -497,10 +460,6 @@ public class ByteCodeForm {
return name; return name;
} }
public int getOperandType() {
return -1;
}
public int[] getRewrite() { public int[] getRewrite() {
return rewrite; return rewrite;
} }
@ -523,106 +482,6 @@ public class ByteCodeForm {
return false; return false;
} }
public boolean hasByteOperand() {
return false;
}
public boolean hasShortOperand() {
return false;
}
public boolean hasIntRefOperand() {
return false;
}
public boolean hasFloatRefOperand() {
return false;
}
public boolean hasStringRefOperand() {
return false;
}
public boolean hasClassRefOperand() {
return false;
}
public boolean hasLongOperand() {
return false;
}
public boolean hasDoubleOperand() {
return false;
}
public boolean hasLocalOperand() {
return false;
}
public boolean hasLabelOperand() {
return false;
}
public boolean hasFieldRefOperand() {
return false;
}
public boolean hasMethodRefOperand() {
return false;
}
public boolean hasIMethodRefOperand() {
return false;
}
public boolean hasWideOperand() {
return false;
}
public boolean hasIincOperand() {
return false;
}
public boolean hasSwitchOperand() {
return false;
}
public boolean hasMultianewarrayOperand() {
return false;
}
public boolean hasThisFieldRefOperand() {
return false;
}
public boolean hasThisMethodRefOperand() {
return false;
}
public boolean hasSuperFieldRefOperand() {
return false;
}
public boolean hasSuperMethodRefOperand() {
return false;
}
public boolean hasThisInitMethodRefOperand() {
return false;
}
public boolean hasSuperInitMethodRefOperand() {
return false;
}
public boolean hasNewInitMethodRefOperand() {
return false;
}
public boolean hasInitMethodRefOperand() {
return false;
}
/** /**
* This method will answer true if the receiver is a multi-bytecode * This method will answer true if the receiver is a multi-bytecode
* instruction (such as aload0_putfield_super); otherwise, it will answer * instruction (such as aload0_putfield_super); otherwise, it will answer
@ -657,10 +516,8 @@ public class ByteCodeForm {
* of the method. Used in calculating padding for some * of the method. Used in calculating padding for some
* variable-length bytecodes (such as lookupswitch, tableswitch). * variable-length bytecodes (such as lookupswitch, tableswitch).
*/ */
public void setByteCodeOperands(ByteCode byteCode, public abstract void setByteCodeOperands(ByteCode byteCode,
OperandManager operandManager, int codeLength) { OperandManager operandManager, int codeLength);
throw new Error("My subclass should have implemented this");
}
/** /**
* The ByteCodeForm knows how to fix up a bytecode if it needs to be fixed * The ByteCodeForm knows how to fix up a bytecode if it needs to be fixed

@ -28,14 +28,6 @@ public class ByteForm extends ByteCodeForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_BYTE;
}
public boolean hasByteOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -61,14 +61,6 @@ public class ClassRefForm extends ReferenceForm {
byteCode.setNestedPositions(new int[][] { { 0, 2 } }); byteCode.setNestedPositions(new int[][] { { 0, 2 } });
} }
public int getOperandType() {
return TYPE_CLASSREF;
}
public boolean hasClassRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextClassRef(); return operandManager.nextClassRef();
} }

@ -29,14 +29,6 @@ public class DoubleForm extends ReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_DOUBLE;
}
public boolean hasDoubleOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextDoubleRef(); return operandManager.nextDoubleRef();
} }

@ -29,14 +29,6 @@ public class FieldRefForm extends ReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_FIELDREF;
}
public boolean hasFieldRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextFieldRef(); return operandManager.nextFieldRef();
} }

@ -33,14 +33,6 @@ public class FloatRefForm extends SingleByteReferenceForm {
this.widened = widened; this.widened = widened;
} }
public int getOperandType() {
return TYPE_FLOATREF;
}
public boolean hasFloatRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextFloatRef(); return operandManager.nextFloatRef();
} }

@ -31,14 +31,6 @@ public class IMethodRefForm extends ReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_IMETHODREF;
}
public boolean hasIMethodRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextIMethodRef(); return operandManager.nextIMethodRef();
} }

@ -29,14 +29,6 @@ public class IincForm extends ByteCodeForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_IINC;
}
public boolean hasIincOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -35,10 +35,6 @@ public abstract class InitMethodReferenceForm extends
protected abstract String context(OperandManager operandManager); protected abstract String context(OperandManager operandManager);
public boolean hasInitMethodRefOperand() {
return true;
}
protected int getPoolID() { protected int getPoolID() {
return SegmentConstantPool.CP_METHOD; return SegmentConstantPool.CP_METHOD;
} }

@ -34,14 +34,6 @@ public class IntRefForm extends SingleByteReferenceForm {
this.widened = widened; this.widened = widened;
} }
public int getOperandType() {
return TYPE_INTREF;
}
public boolean hasIntRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextIntRef(); return operandManager.nextIntRef();
} }

@ -37,14 +37,6 @@ public class LabelForm extends ByteCodeForm {
this.widened = widened; this.widened = widened;
} }
public int getOperandType() {
return TYPE_LABEL;
}
public boolean hasLabelOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -34,14 +34,6 @@ public class LocalForm extends ByteCodeForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_LOCAL;
}
public boolean hasLocalOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -29,14 +29,6 @@ public class LongForm extends ReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_LONG;
}
public boolean hasLongOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextLongRef(); return operandManager.nextLongRef();
} }

@ -31,14 +31,6 @@ public class MethodRefForm extends ReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_METHODREF;
}
public boolean hasMethodRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextMethodRef(); return operandManager.nextMethodRef();
} }

@ -31,18 +31,6 @@ public class MultiANewArrayForm extends ClassRefForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_MULTIANEWARRAY;
}
public boolean hasMultianewarrayOperand() {
return true;
}
public boolean hasClassRefOperand() {
return false;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -32,14 +32,6 @@ public class NewInitMethodRefForm extends InitMethodReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_NEWINITMETHODREF;
}
public boolean hasNewInitMethodRefOperand() {
return true;
}
protected String context(OperandManager operandManager) { protected String context(OperandManager operandManager) {
final String result = operandManager.getNewClass(); final String result = operandManager.getNewClass();
return result; return result;

@ -30,14 +30,6 @@ public class NoArgumentForm extends ByteCodeForm {
super(opcode, name); super(opcode, name);
} }
public int getOperandType() {
return TYPE_NONE;
}
public boolean hasNoOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -28,14 +28,6 @@ public class ShortForm extends ByteCodeForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_SHORT;
}
public boolean hasShortOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -38,14 +38,6 @@ public class StringRefForm extends SingleByteReferenceForm {
this.widened = widened; this.widened = widened;
} }
public int getOperandType() {
return TYPE_STRINGREF;
}
public boolean hasStringRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextStringRef(); return operandManager.nextStringRef();
} }

@ -31,14 +31,6 @@ public class SuperFieldRefForm extends ClassSpecificReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_SUPERFIELDREF;
}
public boolean hasSuperFieldRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextSuperFieldRef(); return operandManager.nextSuperFieldRef();
} }

@ -26,14 +26,6 @@ public class SuperInitMethodRefForm extends InitMethodReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_SUPERINITMETHODREF;
}
public boolean hasSuperInitMethodRefOperand() {
return true;
}
protected String context( protected String context(
org.apache.harmony.unpack200.bytecode.OperandManager operandManager) { org.apache.harmony.unpack200.bytecode.OperandManager operandManager) {
return operandManager.getSuperClass(); return operandManager.getSuperClass();

@ -31,14 +31,6 @@ public class SuperMethodRefForm extends ClassSpecificReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_SUPERMETHODREF;
}
public boolean hasSuperMethodRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextSuperMethodRef(); return operandManager.nextSuperMethodRef();
} }

@ -30,14 +30,6 @@ public abstract class SwitchForm extends VariableInstructionForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_SWITCH;
}
public boolean hasSwitchOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

@ -31,14 +31,6 @@ public class ThisFieldRefForm extends ClassSpecificReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_THISFIELDREF;
}
public boolean hasThisFieldRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextThisFieldRef(); return operandManager.nextThisFieldRef();
} }

@ -28,14 +28,6 @@ public class ThisInitMethodRefForm extends InitMethodReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_THISINITMETHODREF;
}
public boolean hasThisInitMethodRefOperand() {
return true;
}
protected String context(OperandManager operandManager) { protected String context(OperandManager operandManager) {
return operandManager.getCurrentClass(); return operandManager.getCurrentClass();
} }

@ -31,14 +31,6 @@ public class ThisMethodRefForm extends ClassSpecificReferenceForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_THISMETHODREF;
}
public boolean hasThisMethodRefOperand() {
return true;
}
protected int getOffset(OperandManager operandManager) { protected int getOffset(OperandManager operandManager) {
return operandManager.nextThisMethodRef(); return operandManager.nextThisMethodRef();
} }

@ -34,14 +34,6 @@ public class WideForm extends VariableInstructionForm {
super(opcode, name, rewrite); super(opcode, name, rewrite);
} }
public int getOperandType() {
return TYPE_WIDE;
}
public boolean hasWideOperand() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

Loading…
Cancel
Save