FileDocCategorySizeDatePackage
RET.javaAPI DocJava SE 6 API5381Tue Jun 10 00:22:22 BST 2008com.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.2.1 2005/07/31 23:45:17 jeffsuttor 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;