Package com.aparapi.internal.instruction
Class Instruction
- java.lang.Object
-
- com.aparapi.internal.instruction.Instruction
-
- Direct Known Subclasses:
InstructionSet.ArrayAccess
,InstructionSet.Branch
,InstructionSet.BytecodeEncodedConstant
,InstructionSet.CloneInstruction
,InstructionSet.CompositeInstruction
,InstructionSet.DUP
,InstructionSet.FieldArrayElementAssign
,InstructionSet.FieldArrayElementIncrement
,InstructionSet.I_ACONST_NULL
,InstructionSet.I_ARRAYLENGTH
,InstructionSet.I_ATHROW
,InstructionSet.I_DCMPG
,InstructionSet.I_DCMPL
,InstructionSet.I_END
,InstructionSet.I_MONITORENTER
,InstructionSet.I_MONITOREXIT
,InstructionSet.I_NEWARRAY
,InstructionSet.I_NOP
,InstructionSet.I_POP
,InstructionSet.I_POP2
,InstructionSet.I_SWAP
,InstructionSet.I_WIDE
,InstructionSet.ImmediateConstant
,InstructionSet.IncrementInstruction
,InstructionSet.Index
,InstructionSet.InlineAssignInstruction
,InstructionSet.MultiAssignInstruction
,InstructionSet.OperatorInstruction
,InstructionSet.Return
public abstract class Instruction extends java.lang.Object
Initially represents a single Java bytecode instruction. Instructions for each bytecode are created when the bytecode is first scanned. Each Instruction will contain a pc (program counter) offset from the beginning of the sequence of bytecode and the length will be determined by the information gleaned from InstructionSet.BYTECODE.
-
-
Field Summary
Fields Modifier and Type Field Description private InstructionSet.ByteCode
byteCode
private Instruction
firstChild
private java.util.LinkedList<InstructionSet.ConditionalBranch>
forwardConditionalBranchTargets
private java.util.LinkedList<InstructionSet.Branch>
forwardUnconditionalBranchTargets
private Instruction
lastChild
private int
length
protected MethodModel
method
private Instruction
nextExpr
private Instruction
nextPC
private Instruction
parentExpr
protected int
pc
private Instruction
prevExpr
private Instruction
prevPC
private java.util.LinkedList<InstructionSet.ConditionalBranch>
reverseConditionalBranchTargets
private java.util.LinkedList<InstructionSet.Branch>
reverseUnconditionalBranchTargets
-
Constructor Summary
Constructors Modifier Constructor Description protected
Instruction(MethodModel _method, InstructionSet.ByteCode _byteCode, int _pc)
protected
Instruction(MethodModel _method, InstructionSet.ByteCode _byteCode, ByteReader _byteReader, boolean _wide)
-
Method Summary
-
-
-
Field Detail
-
method
protected MethodModel method
-
byteCode
private final InstructionSet.ByteCode byteCode
-
length
private int length
-
pc
protected int pc
-
nextPC
private Instruction nextPC
-
prevPC
private Instruction prevPC
-
nextExpr
private Instruction nextExpr
-
prevExpr
private Instruction prevExpr
-
parentExpr
private Instruction parentExpr
-
forwardConditionalBranchTargets
private java.util.LinkedList<InstructionSet.ConditionalBranch> forwardConditionalBranchTargets
-
reverseConditionalBranchTargets
private java.util.LinkedList<InstructionSet.ConditionalBranch> reverseConditionalBranchTargets
-
forwardUnconditionalBranchTargets
private java.util.LinkedList<InstructionSet.Branch> forwardUnconditionalBranchTargets
-
reverseUnconditionalBranchTargets
private java.util.LinkedList<InstructionSet.Branch> reverseUnconditionalBranchTargets
-
firstChild
private Instruction firstChild
-
lastChild
private Instruction lastChild
-
-
Constructor Detail
-
Instruction
protected Instruction(MethodModel _method, InstructionSet.ByteCode _byteCode, int _pc)
-
Instruction
protected Instruction(MethodModel _method, InstructionSet.ByteCode _byteCode, ByteReader _byteReader, boolean _wide)
-
-
Method Detail
-
getDescription
abstract java.lang.String getDescription()
-
setChildren
public void setChildren(Instruction _firstChild, Instruction _lastChild)
-
getPrevExpr
public Instruction getPrevExpr()
-
getNextExpr
public Instruction getNextExpr()
-
setNextPC
public void setNextPC(Instruction _nextByPC)
-
setPrevPC
public void setPrevPC(Instruction _prevByPC)
-
setPrevExpr
public void setPrevExpr(Instruction _prevExpr)
-
setNextExpr
public void setNextExpr(Instruction _nextExpr)
-
toInstruction
public Instruction toInstruction()
-
getLength
public int getLength()
-
setLength
public void setLength(int _length)
-
getByteCode
public final InstructionSet.ByteCode getByteCode()
-
getThisPC
public int getThisPC()
-
getStartPC
public int getStartPC()
-
getStackConsumeCount
public int getStackConsumeCount()
-
getStackProduceCount
public int getStackProduceCount()
-
getStackDelta
public int getStackDelta()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isBranch
public boolean isBranch()
-
compareTo
public int compareTo(Instruction _other)
-
isAfter
public boolean isAfter(Instruction _other)
-
isAfterOrEqual
public boolean isAfterOrEqual(Instruction _other)
-
isBefore
public boolean isBefore(Instruction _other)
-
isBeforeOrEqual
public boolean isBeforeOrEqual(Instruction _other)
-
getFirstChild
public Instruction getFirstChild()
-
getLastChild
public Instruction getLastChild()
-
getStartInstruction
public Instruction getStartInstruction()
-
getMethod
public MethodModel getMethod()
-
getNextPC
public Instruction getNextPC()
-
getPrevPC
public Instruction getPrevPC()
-
setParentExpr
public void setParentExpr(Instruction _parentExpr)
-
getParentExpr
public Instruction getParentExpr()
-
getRootExpr
public Instruction getRootExpr()
-
isReverseConditionalBranchTarget
public boolean isReverseConditionalBranchTarget()
-
isForwardConditionalBranchTarget
public boolean isForwardConditionalBranchTarget()
-
isReverseUnconditionalBranchTarget
public boolean isReverseUnconditionalBranchTarget()
-
isForwardUnconditionalBranchTarget
public boolean isForwardUnconditionalBranchTarget()
-
isReverseBranchTarget
public boolean isReverseBranchTarget()
-
isConditionalBranchTarget
public boolean isConditionalBranchTarget()
-
isUnconditionalBranchTarget
public boolean isUnconditionalBranchTarget()
-
isForwardBranchTarget
public boolean isForwardBranchTarget()
-
isBranchTarget
public boolean isBranchTarget()
-
producesStack
public boolean producesStack()
-
getReal
public Instruction getReal()
-
asBranch
public InstructionSet.Branch asBranch()
-
consumesStack
public boolean consumesStack()
-
addBranchTarget
public void addBranchTarget(InstructionSet.Branch _branch)
-
removeBranchTarget
public void removeBranchTarget(InstructionSet.Branch _branch)
-
getForwardUnconditionalBranches
public java.util.LinkedList<InstructionSet.Branch> getForwardUnconditionalBranches()
-
getForwardConditionalBranches
public java.util.LinkedList<InstructionSet.ConditionalBranch> getForwardConditionalBranches()
-
getReverseUnconditionalBranches
public java.util.LinkedList<InstructionSet.Branch> getReverseUnconditionalBranches()
-
getReverseConditionalBranches
public java.util.LinkedList<InstructionSet.ConditionalBranch> getReverseConditionalBranches()
-
isForwardBranch
public boolean isForwardBranch()
-
sameAs
public boolean sameAs(Instruction _other)
-
-