FileDocCategorySizeDatePackage
RET.javaAPI DocJava SE 5 API5378Fri Aug 26 14:55:24 BST 2005com.sun.org.apache.bcel.internal.generic

RET

public class RET extends Instruction implements TypedInstruction, IndexedInstruction
RET - Return from subroutine
Stack: ..., -> ..., address
version
$Id: RET.java,v 1.1.1.1 2001/10/29 20:00:25 jvanzyl Exp $
author
M. Dahm

Fields Summary
private boolean
wide
private int
index
Constructors Summary
RET()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

public RET(int index)

    super(com.sun.org.apache.bcel.internal.Constants.RET, (short)2);
    setIndex(index);   // May set wide as side effect
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.generic.Visitor v)
Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.

param
v Visitor object

    v.visitRET(this);
  
public voiddump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out.

param
out Output stream

    if(wide)
      out.writeByte(com.sun.org.apache.bcel.internal.Constants.WIDE);

    out.writeByte(opcode);

    if(wide)
      out.writeShort(index);
    else
      out.writeByte(index);
  
public final intgetIndex()

return
index of local variable containg the return address

 return index; 
public com.sun.org.apache.bcel.internal.generic.TypegetType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cp)

return
return address type

      return ReturnaddressType.NO_TARGET;
  
protected voidinitFromFile(com.sun.org.apache.bcel.internal.util.ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.

    this.wide = wide;

    if(wide) {
      index  = bytes.readUnsignedShort();
      length = 4;
    } else {
      index = bytes.readUnsignedByte();
      length = 2;
    }
  
public final voidsetIndex(int n)
Set index of local variable containg the return address

 
    if(n < 0)
      throw new ClassGenException("Negative index value: " + n);

    index = n;
    setWide();
  
private final voidsetWide()

    if(wide = index > com.sun.org.apache.bcel.internal.Constants.MAX_BYTE)
      length = 4; // Including the wide byte  
    else
      length = 2;
  
public java.lang.StringtoString(boolean verbose)

return
mnemonic for instruction

    return super.toString(verbose) + " " + index;