1 17 package org.apache.bcel.generic; 18 19 import java.io.DataOutputStream ; 20 import java.io.IOException ; 21 22 28 public class JSR extends JsrInstruction implements VariableLengthInstruction { 29 30 34 JSR() { 35 } 36 37 38 public JSR(InstructionHandle target) { 39 super(org.apache.bcel.Constants.JSR, target); 40 } 41 42 43 47 public void dump( DataOutputStream out ) throws IOException { 48 index = getTargetOffset(); 49 if (opcode == org.apache.bcel.Constants.JSR) { 50 super.dump(out); 51 } else { index = getTargetOffset(); 53 out.writeByte(opcode); 54 out.writeInt(index); 55 } 56 } 57 58 59 protected int updatePosition( int offset, int max_offset ) { 60 int i = getTargetOffset(); position += offset; if (Math.abs(i) >= (32767 - max_offset)) { opcode = org.apache.bcel.Constants.JSR_W; 64 length = 5; 65 return 2; } 67 return 0; 68 } 69 70 71 79 public void accept( Visitor v ) { 80 v.visitStackProducer(this); 81 v.visitVariableLengthInstruction(this); 82 v.visitBranchInstruction(this); 83 v.visitJsrInstruction(this); 84 v.visitJSR(this); 85 } 86 } 87 | Popular Tags |