/** * Set the collection of {@link JumpInstruction}s to the given instruction, * clearing the collection in the process. */ protected void setTarget(Instruction ins, Collection<Instruction> jumps) { for (Iterator<Instruction> it = jumps.iterator(); it.hasNext();) ((JumpInstruction) it.next()).setTarget(ins); jumps.clear(); }
void read(DataInput in) throws IOException { super.read(in); switch (getOpcode()) { case Constants.GOTOW: case Constants.JSRW: _target.setByteIndex(getByteIndex() + in.readInt()); break; default: _target.setByteIndex(getByteIndex() + in.readShort()); } }
int getLength() { return super.getLength() + 2; }
public void replaceTarget(Instruction oldTarget, Instruction newTarget) { super.replaceTarget(oldTarget, newTarget); for (Iterator itr = _cases.iterator(); itr.hasNext();) ((InstructionPtrStrategy) itr.next()).replaceTarget(oldTarget, newTarget); }
void read(Instruction orig) { super.read(orig); SwitchInstruction ins = (SwitchInstruction) orig; _cases.clear(); InstructionPtrStrategy incoming; for (Iterator itr = ins._cases.iterator(); itr.hasNext();) { incoming = (InstructionPtrStrategy) itr.next(); InstructionPtrStrategy next = new InstructionPtrStrategy(this); next.setByteIndex(incoming.getByteIndex()); _cases.add(next); } }
public int getOffset() { return _target.getByteIndex() - getByteIndex(); } }
/** * JumpInstructions are equal if they represent the same operation and * the instruction they jump to is the * same, or if the jump Instruction of either is unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!super.equalsInstruction(other)) return false; Instruction target = ((JumpInstruction) other).getTarget(); return target == null || getTarget() == null || target == getTarget(); }
public void enterJumpInstruction(JumpInstruction obj) { _out.print(obj.getOffset()); }
public int getStackChange() { switch (getOpcode()) { case Constants.IFACMPEQ: case Constants.IFACMPNE: case Constants.IFICMPEQ: case Constants.IFICMPNE: case Constants.IFICMPLT: case Constants.IFICMPGT: case Constants.IFICMPLE: case Constants.IFICMPGE: return -2; case Constants.IFEQ: case Constants.IFNE: case Constants.IFLT: case Constants.IFGT: case Constants.IFLE: case Constants.IFGE: case Constants.IFNULL: case Constants.IFNONNULL: return -1; default: return super.getStackChange(); } }
public void replaceTarget(Instruction oldTarget, Instruction newTarget) { super.replaceTarget(oldTarget, newTarget); for (Iterator itr = _cases.iterator(); itr.hasNext();) ((InstructionPtrStrategy) itr.next()).replaceTarget(oldTarget, newTarget); }
void read(Instruction orig) { super.read(orig); SwitchInstruction ins = (SwitchInstruction) orig; _cases.clear(); InstructionPtrStrategy incoming; for (Iterator itr = ins._cases.iterator(); itr.hasNext();) { incoming = (InstructionPtrStrategy) itr.next(); InstructionPtrStrategy next = new InstructionPtrStrategy(this); next.setByteIndex(incoming.getByteIndex()); _cases.add(next); } }
public int getOffset() { return _target.getByteIndex() - getByteIndex(); } }
/** * JumpInstructions are equal if they represent the same operation and * the instruction they jump to is the * same, or if the jump Instruction of either is unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!super.equalsInstruction(other)) return false; Instruction target = ((JumpInstruction) other).getTarget(); return target == null || getTarget() == null || target == getTarget(); }
public void enterJumpInstruction(JumpInstruction obj) { _out.print(obj.getOffset()); }
public int getStackChange() { switch (getOpcode()) { case Constants.IFACMPEQ: case Constants.IFACMPNE: case Constants.IFICMPEQ: case Constants.IFICMPNE: case Constants.IFICMPLT: case Constants.IFICMPGT: case Constants.IFICMPLE: case Constants.IFICMPGE: return -2; case Constants.IFEQ: case Constants.IFNE: case Constants.IFLT: case Constants.IFGT: case Constants.IFLE: case Constants.IFGE: case Constants.IFNULL: case Constants.IFNONNULL: return -1; default: return super.getStackChange(); } }
/** * Set the collection of {@link JumpInstruction}s to the given instruction, * clearing the collection in the process. */ protected void setTarget(Instruction ins, Collection<Instruction> jumps) { for (Iterator<Instruction> it = jumps.iterator(); it.hasNext();) ((JumpInstruction) it.next()).setTarget(ins); jumps.clear(); }
void write(DataOutput out) throws IOException { super.write(out); switch (getOpcode()) { case Constants.GOTOW: case Constants.JSRW: out.writeInt(_target.getByteIndex() - getByteIndex()); break; default: out.writeShort(_target.getByteIndex() - getByteIndex()); } }
public void replaceTarget(Instruction oldTarget, Instruction newTarget) { super.replaceTarget(oldTarget, newTarget); for (Iterator itr = _cases.iterator(); itr.hasNext();) ((InstructionPtrStrategy) itr.next()).replaceTarget(oldTarget, newTarget); }
void read(Instruction orig) { super.read(orig); LookupSwitchInstruction ins = (LookupSwitchInstruction) orig; _matches = new LinkedList(ins._matches); _cases.clear(); for (Iterator itr = ins._cases.iterator(); itr.hasNext();) { InstructionPtrStrategy origPtr = (InstructionPtrStrategy)itr.next(); InstructionPtrStrategy newPtr = new InstructionPtrStrategy(this); newPtr.setByteIndex(origPtr.getByteIndex()); _cases.add(newPtr); } invalidateByteIndexes(); }
int getLength() { return super.getLength() + 2; }