Top Description Fields Constructors Methods
org.aspectj.apache.bcel.generic

public Class Instruction

extends Object
implements Cloneable, Serializable, Constants
Class Inheritance
All Implemented Interfaces
org.aspectj.apache.bcel.Constants, java.io.Serializable, java.lang.Cloneable
Known Direct Subclasses
org.aspectj.apache.bcel.generic.InstructionBranch, org.aspectj.apache.bcel.generic.InstructionByte, org.aspectj.apache.bcel.generic.InstructionCP, org.aspectj.apache.bcel.generic.InstructionShort, org.aspectj.apache.bcel.generic.RET, org.aspectj.apache.bcel.generic.InstructionLV
Imports
java.io.DataOutputStream, .IOException, .Serializable, org.aspectj.apache.bcel.Constants, org.aspectj.apache.bcel.classfile.ConstantPool, org.aspectj.apache.bcel.util.ByteSequence

Abstract super class for all Java byte codes.
Author
M. Dahm
Version
$Id: Instruction.java,v 1.10 2011/04/05 15:15:33 aclement Exp $

Field Summary

Modifier and TypeField and Description
public short

Constructor Summary

AccessConstructor and Description
public
Instruction(short opcode)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

Number of words consumed from stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically
consumeStack
(ConstantPool cpg)

public final Instruction

Returns:

(shallow) copy of an instruction
copy
()

Use with caution, since 'BranchInstruction's have a 'target' reference which is not copied correctly (only basic types are).

pack-priv void
dispose()

Some instructions may be reused, so don't do anything by default

public void
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
public int
public ObjectType
public String
public short
public Type
public Type
public Number
public Object
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public int

Returns:

Number of words produced onto stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically
produceStack
(ConstantPool cpg)

public static final Instruction

Returns:

instruction object being read
readInstruction
(ByteSequence
file to read from
bytes
)

Read an instruction bytecode from an input stream and return the appropriate object.

public void
setIndex(int i)

public String
toString(boolean verbose)

Long output format: 'name of opcode' "[" 'opcode number' "]" "(" 'length of instruction' ")"

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

opcodeback to summary
public short opcode

Constructor Detail

Instructionback to summary
public Instruction(short opcode)

Method Detail

consumeStackback to summary
public int consumeStack(ConstantPool cpg)
Returns:int

Number of words consumed from stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically

copyback to summary
public final Instruction copy()

Use with caution, since 'BranchInstruction's have a 'target' reference which is not copied correctly (only basic types are). This also applies for 'Select' instructions with their multiple branch targets.

Returns:Instruction

(shallow) copy of an instruction

disposeback to summary
pack-priv void dispose()

Some instructions may be reused, so don't do anything by default

dumpback to summary
public void dump(DataOutputStream out) throws IOException
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getIndexback to summary
public int getIndex()
getLengthback to summary
public int getLength()
getLoadClassTypeback to summary
public ObjectType getLoadClassType(ConstantPool cpg)
getNameback to summary
public String getName()
getOpcodeback to summary
public short getOpcode()
getTypeback to summary
public Type getType()
getTypeback to summary
public Type getType(ConstantPool cp)
getValueback to summary
public Number getValue()
getValueback to summary
public Object getValue(ConstantPool cpg)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isALOADback to summary
public boolean isALOAD()
isArrayCreationInstructionback to summary
public boolean isArrayCreationInstruction()
isASTOREback to summary
public boolean isASTORE()
isConstantInstructionback to summary
public boolean isConstantInstruction()
isConstantPoolInstructionback to summary
public boolean isConstantPoolInstruction()
isIndexedInstructionback to summary
public boolean isIndexedInstruction()
isJsrInstructionback to summary
public boolean isJsrInstruction()
isLoadInstructionback to summary
public boolean isLoadInstruction()
isLocalVariableInstructionback to summary
public boolean isLocalVariableInstruction()
isReturnInstructionback to summary
public boolean isReturnInstruction()
isStackConsumerback to summary
public boolean isStackConsumer()
isStackProducerback to summary
public boolean isStackProducer()
isStoreInstructionback to summary
public boolean isStoreInstruction()
produceStackback to summary
public int produceStack(ConstantPool cpg)
Returns:int

Number of words produced onto stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically

readInstructionback to summary
public static final Instruction readInstruction(ByteSequence bytes) throws IOException

Read an instruction bytecode from an input stream and return the appropriate object.

Parameters
bytes:ByteSequence

file to read from

Returns:Instruction

instruction object being read

setIndexback to summary
public void setIndex(int i)
toStringback to summary
public String toString(boolean verbose)

Long output format: 'name of opcode' "[" 'opcode number' "]" "(" 'length of instruction' ")"

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override