001 package serp.bytecode; 002 003 import java.util.*; 004 005 /** 006 * An entity that maintains ptrs to instructions in a code block. 007 * 008 * @author Abe White 009 */ 010 public interface InstructionPtr { 011 /** 012 * Use the byte indexes read from the class file to calculate and 013 * set references to the target instruction(s) for this ptr. 014 * This method will be called after the byte code 015 * has been read in for the first time and before it is written after 016 * modification. 017 */ 018 public void updateTargets(); 019 020 /** 021 * Replace the given old, likely invalid, target with a new target. The 022 * new target Instruction is guaranteed to be in the same code 023 * block as this InstructionPtr. 024 */ 025 public void replaceTarget(Instruction oldTarget, Instruction newTarget); 026 027 /** 028 * Returns the Code block that owns the Instruction(s) this 029 * InstructionPtr points to. 030 */ 031 public Code getCode(); 032 }