/** Add back 'this' in all HashSet in which it should be registered. */ void notifyTargetChanged() { // hashCode depends on 'index', 'start', and 'end'. // Therefore before changing any of these values we // need to unregister 'this' from any HashSet where // this is registered, and then we need to add it // back... // Register 'this' in the HashSet held by start. BranchInstruction.notifyTargetChanged(this.start, this); if (this.end != this.start) { // Since hashCode() has changed we need to register // 'this' again in 'end'. // Add back 'this' in the HashSet held by 'end'. BranchInstruction.notifyTargetChanged(this.end, this); } }
/** Remove this from any known HashSet in which it might be registered. */ void notifyTargetChanging() { // hashCode depends on 'index', 'start', and 'end'. // Therefore before changing any of these values we // need to unregister 'this' from any HashSet where // this is registered, and then we need to add it // back... // Unregister 'this' from the HashSet held by 'start'. BranchInstruction.notifyTargetChanging(this.start, this); if (this.end != this.start) { // Since hashCode() is going to change we need to unregister // 'this' both form 'start' and 'end'. // Unregister 'this' from the HashSet held by 'end'. BranchInstruction.notifyTargetChanging(this.end, this); } }
/* Set end of handler * @param end_pc End of handled region (inclusive) */ public final void setEndPC(InstructionHandle end_pc) { BranchInstruction.notifyTargetChanging(this.end_pc, this); this.end_pc = end_pc; BranchInstruction.notifyTargetChanged(this.end_pc, this); }
/* Set handler code * @param handler_pc Start of handler */ public final void setHandlerPC(InstructionHandle handler_pc) { BranchInstruction.notifyTargetChanging(this.handler_pc, this); this.handler_pc = handler_pc; BranchInstruction.notifyTargetChanged(this.handler_pc, this); }
/* Set start of handler * @param start_pc Start of handled region (inclusive) */ public final void setStartPC(InstructionHandle start_pc) { BranchInstruction.notifyTargetChanging(this.start_pc, this); this.start_pc = start_pc; BranchInstruction.notifyTargetChanged(this.start_pc, this); }