1 package serp.bytecode;
2
3 import java.util.*;
4
5 /***
6 * An entity that maintains ptrs to instructions in a code block.
7 *
8 * @author Abe White
9 */
10 public interface InstructionPtr {
11 /***
12 * Use the byte indexes read from the class file to calculate and
13 * set references to the target instruction(s) for this ptr.
14 * This method will be called after the byte code
15 * has been read in for the first time and before it is written after
16 * modification.
17 */
18 public void updateTargets();
19
20 /***
21 * Replace the given old, likely invalid, target with a new target. The
22 * new target Instruction is guaranteed to be in the same code
23 * block as this InstructionPtr.
24 */
25 public void replaceTarget(Instruction oldTarget, Instruction newTarget);
26
27 /***
28 * Returns the Code block that owns the Instruction(s) this
29 * InstructionPtr points to.
30 */
31 public Code getCode();
32 }