1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import java.io.*; 57 58 64 public class GOTO extends GotoInstruction implements VariableLengthInstruction { 65 69 GOTO() {} 70 71 public GOTO(InstructionHandle target) { 72 super(com.sun.org.apache.bcel.internal.Constants.GOTO, target); 73 } 74 75 79 public void dump(DataOutputStream out) throws IOException { 80 index = getTargetOffset(); 81 if(opcode == com.sun.org.apache.bcel.internal.Constants.GOTO) 82 super.dump(out); 83 else { index = getTargetOffset(); 85 out.writeByte(opcode); 86 out.writeInt(index); 87 } 88 } 89 90 93 protected int updatePosition(int offset, int max_offset) { 94 int i = getTargetOffset(); 96 position += offset; 98 if(Math.abs(i) >= (32767 - max_offset)) { opcode = com.sun.org.apache.bcel.internal.Constants.GOTO_W; 100 length = 5; 101 return 2; } 103 104 return 0; 105 } 106 107 115 public void accept(Visitor v) { 116 v.visitVariableLengthInstruction(this); 117 v.visitUnconditionalBranch(this); 118 v.visitBranchInstruction(this); 119 v.visitGotoInstruction(this); 120 v.visitGOTO(this); 121 } 122 } 123 | Popular Tags |