Top Description Inners Fields Constructors Methods
org.droidparts.dexmaker.dx.rop.code

public final Class BasicBlockList

extends LabeledList
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.type.StdTypeList, .TypeList, org.droidparts.dexmaker.dx.util.Hex, .IntList, .LabeledList

List of BasicBlock instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
BasicBlockList.RegCountVisitor

Instruction visitor class for counting registers used.

Field Summary

Modifier and TypeField and Description
private int
regCount

>= -1; the count of registers required by this method or -1 if not yet calculated

Constructor Summary

AccessConstructor and Description
public
BasicBlockList(int
the size of the list
size
)

Constructs an instance.

private
BasicBlockList(BasicBlockList
block to copy
old
)

Constructs a mutable copy for getMutableCopy().

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the two blocks' non-primary successors are identical
catchesEqual
(BasicBlock
non-null; one block to compare
block1
,
BasicBlock
non-null; the other block to compare
block2
)

Compares the catches of two blocks for equality.

public void
forEachInsn(Insn.Visitor
non-null; visitor to use
visitor
)

Visits each instruction of each block in the list, in order.

public BasicBlock

Returns:

non-null; element at that index
get
(int
>= 0, < size(); which index
n
)

Gets the element at the given index.

public int

Returns:

>= 0; the total instruction count
getEffectiveInstructionCount
()

Gets the total instruction count for this instance, ignoring mark-local instructions which are not actually emitted.

public int

Returns:

>= 0; the total instruction count
getInstructionCount
()

Gets the total instruction count for this instance.

public BasicBlockList

Returns:

non-null; an appropriately-constructed instance
getMutableCopy
()

Returns a mutable copy of this list.

public int

Returns:

>= 0; the register count
getRegCount
()

Returns how many registers this method requires.

public BasicBlock

Returns:

non-null; the so-labelled block
labelToBlock
(int
>= 0; the label to look for
label
)

Gets the first block in the list with the given label, if any.

public BasicBlock

Returns:

null-ok; the preferred successor, if any
preferredSuccessorOf
(BasicBlock
non-null; the block in question
block
)

Gets the preferred successor for the given block.

public void
set(int
>= 0, < size(); which index
n
,
BasicBlock
null-ok; the element to set at n
bb
)

Sets the basic block at the given index.

public BasicBlockList

Returns:

non-null; an appropriately-constructed instance
withRegisterOffset
(int
the amount to offset register numbers by
delta
)

Returns an instance that is identical to this one, except that the registers in each instruction are offset by the given amount.

Inherited from org.droidparts.dexmaker.dx.util.LabeledList:
getLabelsInOrdergetMaxLabelindexOfLabelsetshrinkToFit

Field Detail

regCountback to summary
private int regCount

>= -1; the count of registers required by this method or -1 if not yet calculated

Constructor Detail

BasicBlockListback to summary
public BasicBlockList(int size)

Constructs an instance. All indices initially contain null, and the first-block label is initially -1.

Parameters
size:int

the size of the list

BasicBlockListback to summary
private BasicBlockList(BasicBlockList old)

Constructs a mutable copy for getMutableCopy().

Parameters
old:BasicBlockList

block to copy

Method Detail

catchesEqualback to summary
public boolean catchesEqual(BasicBlock block1, BasicBlock block2)

Compares the catches of two blocks for equality. This includes both the catch types and target labels.

Parameters
block1:BasicBlock

non-null; one block to compare

block2:BasicBlock

non-null; the other block to compare

Returns:boolean

true if the two blocks' non-primary successors are identical

forEachInsnback to summary
public void forEachInsn(Insn.Visitor visitor)

Visits each instruction of each block in the list, in order.

Parameters
visitor:Insn.Visitor

non-null; visitor to use

getback to summary
public BasicBlock get(int n)

Gets the element at the given index. It is an error to call this with the index for an element which was never set; if you do that, this will throw NullPointerException.

Parameters
n:int

>= 0, < size(); which index

Returns:BasicBlock

non-null; element at that index

getEffectiveInstructionCountback to summary
public int getEffectiveInstructionCount()

Gets the total instruction count for this instance, ignoring mark-local instructions which are not actually emitted.

Returns:int

>= 0; the total instruction count

getInstructionCountback to summary
public int getInstructionCount()

Gets the total instruction count for this instance. This is the sum of the instruction counts of each block.

Returns:int

>= 0; the total instruction count

getMutableCopyback to summary
public BasicBlockList getMutableCopy()

Returns a mutable copy of this list.

Returns:BasicBlockList

non-null; an appropriately-constructed instance

getRegCountback to summary
public int getRegCount()

Returns how many registers this method requires. This is simply the maximum of register-number-plus-category referred to by this instance's instructions (indirectly through BasicBlock instances).

Returns:int

>= 0; the register count

labelToBlockback to summary
public BasicBlock labelToBlock(int label)

Gets the first block in the list with the given label, if any.

Parameters
label:int

>= 0; the label to look for

Returns:BasicBlock

non-null; the so-labelled block

Exceptions
IllegalArgumentException:
thrown if the label isn't found
preferredSuccessorOfback to summary
public BasicBlock preferredSuccessorOf(BasicBlock block)

Gets the preferred successor for the given block. If the block only has one successor, then that is the preferred successor. Otherwise, if the block has a primay successor, then that is the preferred successor. If the block has no successors, then this returns null.

Parameters
block:BasicBlock

non-null; the block in question

Returns:BasicBlock

null-ok; the preferred successor, if any

setback to summary
public void set(int n, BasicBlock bb)

Sets the basic block at the given index.

Parameters
n:int

>= 0, < size(); which index

bb:BasicBlock

null-ok; the element to set at n

withRegisterOffsetback to summary
public BasicBlockList withRegisterOffset(int delta)

Returns an instance that is identical to this one, except that the registers in each instruction are offset by the given amount. Mutability of the result is inherited from the original.

Parameters
delta:int

the amount to offset register numbers by

Returns:BasicBlockList

non-null; an appropriately-constructed instance

org.droidparts.dexmaker.dx.rop.code back to summary

private Class BasicBlockList.RegCountVisitor

extends Object
implements Visitor
Class Inheritance
  • java.lang.Object
  • org.droidparts.dexmaker.dx.rop.code.BasicBlockList.RegCountVisitor
All Implemented Interfaces
org.droidparts.dexmaker.dx.rop.code.Insn.Visitor

Instruction visitor class for counting registers used.

Field Summary

Modifier and TypeField and Description
private int
regCount

>= 0; register count in-progress

Constructor Summary

AccessConstructor and Description
public
RegCountVisitor()

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

>= 0; the count
getRegCount
()

Gets the register count.

private void
processReg(RegisterSpec
non-null; the register spec
spec
)

Processes the given register spec.

private void
visit(Insn
non-null; instruction being visited
insn
)

Helper for all the visit* methods.

public void
public void
public void
visitPlainInsn(PlainInsn
non-null; the instruction to visit
insn
)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitPlainInsn.

Visits a PlainInsn.
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

regCountback to summary
private int regCount

>= 0; register count in-progress

Constructor Detail

RegCountVisitorback to summary
public RegCountVisitor()

Constructs an instance.

Method Detail

getRegCountback to summary
public int getRegCount()

Gets the register count.

Returns:int

>= 0; the count

processRegback to summary
private void processReg(RegisterSpec spec)

Processes the given register spec.

Parameters
spec:RegisterSpec

non-null; the register spec

visitback to summary
private void visit(Insn insn)

Helper for all the visit* methods.

Parameters
insn:Insn

non-null; instruction being visited

visitFillArrayDataInsnback to summary
public void visitFillArrayDataInsn(FillArrayDataInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitFillArrayDataInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitFillArrayDataInsn.

Visits a FillArrayDataInsn.

Parameters
insn:FillArrayDataInsn

non-null; the instruction to visit

visitPlainCstInsnback to summary
public void visitPlainCstInsn(PlainCstInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitPlainCstInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitPlainCstInsn.

Visits a PlainCstInsn.

Parameters
insn:PlainCstInsn

non-null; the instruction to visit

visitPlainInsnback to summary
public void visitPlainInsn(PlainInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitPlainInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitPlainInsn.

Visits a PlainInsn.

Parameters
insn:PlainInsn

non-null; the instruction to visit

visitSwitchInsnback to summary
public void visitSwitchInsn(SwitchInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitSwitchInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitSwitchInsn.

Visits a SwitchInsn.

Parameters
insn:SwitchInsn

non-null; the instruction to visit

visitThrowingCstInsnback to summary
public void visitThrowingCstInsn(ThrowingCstInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitThrowingCstInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitThrowingCstInsn.

Visits a ThrowingCstInsn.

Parameters
insn:ThrowingCstInsn

non-null; the instruction to visit

visitThrowingInsnback to summary
public void visitThrowingInsn(ThrowingInsn insn)

Implements org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitThrowingInsn.

Doc from org.droidparts.dexmaker.dx.rop.code.Insn.Visitor.visitThrowingInsn.

Visits a ThrowingInsn.

Parameters
insn:ThrowingInsn

non-null; the instruction to visit