Class DE.fub.inf.JVM.ClassGen.Instruction
java.lang.Object
|
+--DE.fub.inf.JVM.ClassGen.Instruction
- Subclasses:
- AALOAD, AASTORE, ACONST_NULL, ARRAYLENGTH, ATHROW, BALOAD, BASTORE, BIPUSH, BranchInstruction, CALOAD, CASTORE, CPInstruction, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST, DDIV, DMUL, DNEG, DREM, DSUB, DUP_X1, DUP_X2, DUP2_X1, DUP2_X2, DUP2, DUP, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST, FDIV, FMUL, FNEG, FREM, FSUB, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST, IDIV, IINC, IMPDEP1, IMPDEP2, IMUL, INEG, IOR, IREM, ISHL, ISHR, ISUB, IUSHR, IXOR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST, LDIV, LMUL, LNEG, LocalVariableInstruction, LOR, LREM, LSHL, LSHR, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, NEWARRAY, NOP, PopInstruction, RET, ReturnInstruction, SALOAD, SASTORE, SIPUSH, SWAP
- public abstract class Instruction
- extends java.lang.Object
- implements Constants, java.lang.Cloneable, java.io.Serializable, CompoundInstruction
This abstract class is the super class for all java byte codes.
- Version:
- $Id: Instruction.java,v 1.6 1998/08/26 09:06:28 dahm Exp $
- Author:
- M. Dahm
- See Also:
- Serialized Form
Constructor Summary
|
Instruction(short tag,
short length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
position
protected int position
length
protected short length
tag
protected short tag
Instruction
public Instruction(short tag,
short length)
dump
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
- Dump instruction as byte code to stream out.
- Parameters:
out
- Output stream
updatePosition
protected int updatePosition(int offset,
int max_offset)
- Called by InstructionList.setPositions when setting the position for every
instruction. In the presence of variable length instructions `setPositions'
performs multiple passes over the instruction list to calculate the
correct (byte) positions and offsets by calling this function.
- Parameters:
offset
- additional offset caused by preceding (variable length) instructions
max_offset
- the maximum offset that may be caused by these instructions- Returns:
- additional offset caused by possible change of this instruction's length
toString
public java.lang.String toString(boolean verbose)
- Long output format:
<position in byte code>
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
- Parameters:
verbose
- long/short format switch- Returns:
- mnemonic for instruction
toString
public java.lang.String toString()
- Returns:
- mnemonic for instruction in verbose format
- Overrides:
- toString in class java.lang.Object
toString
public java.lang.String toString(ConstantPool cp)
- Returns:
- mnemonic for instruction with sumbolic references resolved
initFromFile
protected void initFromFile(ByteSequence bytes,
boolean wide)
throws java.io.IOException
- Read needed data (e.g. index) from file.
readInstruction
public static final Instruction readInstruction(ByteSequence bytes)
throws java.io.IOException
- Read an instruction from (byte code) input stream and return the
appropiate object.
- Parameters:
file
- file to read from- Returns:
- instruction object being read
consumeStack
public int consumeStack()
- Returns:
- Number of words consumed from stack by this instruction
produceStack
public int produceStack()
- Returns:
- Number of words produced onto stack by this instruction
getTag
public short getTag()
- Returns:
- opcode number
getLength
public int getLength()
- Returns:
- length (in bytes) of instruction
getPosition
public int getPosition()
- Returns:
- (absolute) position in byte code of this instruction in the current
method.
setPosition
public void setPosition(int position)
- Update position of instruction
getInstructionList
public final InstructionList getInstructionList()
- Description copied from interface:
- Specified by:
- getInstructionList in interface CompoundInstruction