View Javadoc

1   package serp.bytecode;
2   
3   import java.io.*;
4   
5   import serp.bytecode.visitor.*;
6   
7   /***
8    * The <code>ret</code> instruction is used in the implementation of finally.
9    *
10   * @author Abe White
11   */
12  public class RetInstruction extends LocalVariableInstruction {
13      RetInstruction(Code owner) {
14          super(owner, Constants.RET);
15      }
16  
17      int getLength() {
18          return super.getLength() + 1;
19      }
20  
21      public boolean equalsInstruction(Instruction other) {
22          if (this == other)
23              return true;
24          if (!(other instanceof RetInstruction))
25              return false;
26          return super.equalsInstruction(other);
27      }
28  
29      public void acceptVisit(BCVisitor visit) {
30          visit.enterRetInstruction(this);
31          visit.exitRetInstruction(this);
32      }
33  
34      void read(DataInput in) throws IOException {
35          super.read(in);
36          setLocal(in.readUnsignedByte());
37      }
38  
39      void write(DataOutput out) throws IOException {
40          super.write(out);
41          out.writeByte(getLocal());
42      }
43  }