edu.rit.classfile
Class Location

java.lang.Object
  extended by edu.rit.classfile.Instruction
      extended by edu.rit.classfile.Location

public class Location
extends Instruction

Class Location is a pseudoinstruction used to represent a location within a sequence of bytecodes that can be the target of a branch instruction. You add locations to a subroutine in the same way as you add instructions. You can branch either backward or forward to a location. For example:

     SynthesizedMethodDescription theMethod = . . .;
     Location L1 = new Location();
     Location L2 = new Location();
     . . .
     theMethod.addInstruction (L1);
     . . .
     theMethod.addInstruction (Op.GOTO (L1));
     . . .
     theMethod.addInstruction (Op.GOTO (L2));
     . . .
     theMethod.addInstruction (L2);


Constructor Summary
Location()
          Construct a new location.
 
Method Summary
 byte[] getByteCodes()
          Returns a copy of this instruction's bytecodes.
 int getLength()
          Returns this instruction's length, i.e., number of bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Location

public Location()
Construct a new location.

Method Detail

getLength

public int getLength()
Returns this instruction's length, i.e., number of bytes. For a location pseudoinstruction, this method returns 0.

Specified by:
getLength in class Instruction

getByteCodes

public byte[] getByteCodes()
Returns a copy of this instruction's bytecodes. (Altering the return value will not affect this instruction's bytecodes.) For a location pseudoinstruction, this method returns a zero-length array.

Specified by:
getByteCodes in class Instruction


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.