001 package serp.bytecode; 002 003 import java.io.*; 004 005 import serp.bytecode.visitor.*; 006 007 /** 008 * The <code>ret</code> instruction is used in the implementation of finally. 009 * 010 * @author Abe White 011 */ 012 public class RetInstruction extends LocalVariableInstruction { 013 RetInstruction(Code owner) { 014 super(owner, Constants.RET); 015 } 016 017 int getLength() { 018 return super.getLength() + 1; 019 } 020 021 public boolean equalsInstruction(Instruction other) { 022 if (this == other) 023 return true; 024 if (!(other instanceof RetInstruction)) 025 return false; 026 return super.equalsInstruction(other); 027 } 028 029 public void acceptVisit(BCVisitor visit) { 030 visit.enterRetInstruction(this); 031 visit.exitRetInstruction(this); 032 } 033 034 void read(DataInput in) throws IOException { 035 super.read(in); 036 setLocal(in.readUnsignedByte()); 037 } 038 039 void write(DataOutput out) throws IOException { 040 super.write(out); 041 out.writeByte(getLocal()); 042 } 043 }