/** * Equivalent to <code>setLocal (0).setType (Object.class)</code>; the * <code>this</code> ptr is always passed in local variable 0. * * @return this instruction, for method chaining */ public LoadInstruction setThis() { return (LoadInstruction) setLocal(0).setType(Object.class); }
LocalVariableInstruction(Code owner, int opcode) { super(owner, opcode); calculateLocal(); }
/** * Set the index of the local variable that this instruction operates on. * * @return this instruction, for method chaining */ public LocalVariableInstruction setLocal(int index) { _index = index; calculateOpcode(); return this; }
/** * Set the method parameter that this instruction operates on. This * will set both the local index and the type of the instruction based * on the current method parameters. */ public LocalVariableInstruction setParam(int param) { int local = getCode().getLocalsIndex(param); if (local != -1) { BCMethod method = getCode().getMethod(); setType(method.getParamNames()[param]); } return setLocal(local); }
/** * Set the local variable object this instruction * operates on. This method will set both the type and local index * of this instruction from the given local variable. * * @return this instruction, for method chaining */ public LocalVariableInstruction setLocalVariable(LocalVariable local) { if (local == null) return setLocal(-1); String type = local.getTypeName(); if (type != null) setType(type); return setLocal(local.getLocal()); }
void read(Instruction orig) { super.read(orig); StoreInstruction ins = (StoreInstruction) orig; _type = ins._type; }
public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!(other instanceof RetInstruction)) return false; return super.equalsInstruction(other); }
int getLength() { // opcode, ins, index int length = super.getLength() + 1 + 2; // increment if (_ins == Constants.IINC) length += 2; return length; }
/** * Two local variable instructions are equal if the local index they * reference is equal or if either index is 0/unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!getClass().equals(other.getClass())) return false; LocalVariableInstruction ins = (LocalVariableInstruction) other; int index = getLocal(); int insIndex = ins.getLocal(); return index == -1 || insIndex == -1 || index == insIndex; }
/** * Set the method parameter that this instruction operates on. This * will set both the local index and the type of the instruction based * on the current method parameters. */ public LocalVariableInstruction setParam(int param) { int local = getCode().getLocalsIndex(param); if (local != -1) { BCMethod method = getCode().getMethod(); setType(method.getParamNames()[param]); } return setLocal(local); }
/** * Set the local variable object this instruction * operates on. This method will set both the type and local index * of this instruction from the given local variable. * * @return this instruction, for method chaining */ public LocalVariableInstruction setLocalVariable(LocalVariable local) { if (local == null) return setLocal(-1); String type = local.getTypeName(); if (type != null) setType(type); return setLocal(local.getLocal()); }
void read(Instruction orig) { super.read(orig); StoreInstruction ins = (StoreInstruction) orig; _type = ins._type; }
public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!(other instanceof RetInstruction)) return false; return super.equalsInstruction(other); }
int getLength() { // opcode, ins, index int length = super.getLength() + 1 + 2; // increment if (_ins == Constants.IINC) length += 2; return length; }
/** * Two local variable instructions are equal if the local index they * reference is equal or if either index is 0/unset. */ public boolean equalsInstruction(Instruction other) { if (this == other) return true; if (!getClass().equals(other.getClass())) return false; LocalVariableInstruction ins = (LocalVariableInstruction) other; int index = getLocal(); int insIndex = ins.getLocal(); return index == -1 || insIndex == -1 || index == insIndex; }
/** * Equivalent to <code>setLocal (0).setType (Object.class)</code>; the * <code>this</code> ptr is always passed in local variable 0. * * @return this instruction, for method chaining */ public LoadInstruction setThis() { return (LoadInstruction) setLocal(0).setType(Object.class); }