/** The last {@link Instruction} for which this local is in scope. */ public Instruction getEnd() { if (_end != null) return _end; int idx = _target.getByteIndex() + _length; Instruction end = getCode().getInstruction(idx); if (end != null && (end.prev instanceof Instruction)) { return (Instruction) end.prev; } return getCode().getLastInstruction(); }
/** Set the index into the code byte array at which this local starts. */ public void setStartPc(int startPc) { _target.setByteIndex(startPc); }
/** * Set the {@link Instruction} marking the beginning this local. The instruction must already be a * part of the method. WARNING: if this instruction is deleted, the results are undefined. */ public void setStart(Instruction instruction) { _target.setTargetInstruction(instruction); }
/** Return the instruction marking the beginning of this local. */ public Instruction getStart() { return _target.getTargetInstruction(); }
/** Return the index into the code byte array at which this local starts. */ public int getStartPc() { return _target.getByteIndex(); }
public void replaceTarget(Instruction oldTarget, Instruction newTarget) { _target.replaceTarget(oldTarget, newTarget); if (getEnd() == oldTarget) setEnd(newTarget); }
public void updateTargets() { _target.updateTargets(); _end = getEnd(); }
/** Get the number of bytes for which this local has a value in the code byte array. */ public int getLength() { if (_end != null) return _end.getByteIndex() + _end.getLength() - _target.getByteIndex(); return _length; }