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

public final Class DalvCode

extends Object
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.cst.Constant, org.droidparts.dexmaker.dx.rop.type.Type, java.util.HashSet

Container for all the pieces of a concrete method. Each instance corresponds to a code structure in a .dex file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
DalvCode.AssignIndicesCallback

Class used as a callback for assignIndices.

Field Summary

Modifier and TypeField and Description
private CatchTable
catches

null-ok; catch table; set in finishProcessingIfNecessary

private DalvInsnList
insns

null-ok; the processed instruction list; set in finishProcessingIfNecessary

private LocalList
locals

null-ok; local variable list; set in finishProcessingIfNecessary

private final int
positionInfo

how much position info to preserve; one of the static constants in PositionList

private PositionList
positions

null-ok; source positions list; set in finishProcessingIfNecessary

private CatchBuilder
unprocessedCatches

non-null; unprocessed catch table; nulled out in finishProcessingIfNecessary

private OutputFinisher
unprocessedInsns

null-ok; the instruction list, ready for final processing; nulled out in finishProcessingIfNecessary

Constructor Summary

AccessConstructor and Description
public
DalvCode(int
how much position info to preserve; one of the static constants in PositionList
positionInfo
,
OutputFinisher
non-null; the instruction list, ready for final processing
unprocessedInsns
,
CatchBuilder
non-null; unprocessed catch (exception handler) table
unprocessedCatches
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public void
assignIndices(DalvCode.AssignIndicesCallback
non-null; callback object
callback
)

Assign indices in all instructions that need them, using the given callback to perform lookups.

private void
finishProcessingIfNecessary()

Finish up processing of the method.

public CatchTable

Returns:

non-null; the catch table
getCatches
()

Gets the catch (exception handler) table.

public HashSet<Type>

Returns:

non-null; the set of catch types
getCatchTypes
()

Gets the set of catch types handled anywhere in the code.

public HashSet<Constant>

Returns:

non-null; the set of constants
getInsnConstants
()

Gets the set of all constants referred to by instructions in the code.

public DalvInsnList

Returns:

non-null; the instruction list
getInsns
()

Gets the list of instructions.

public LocalList

Returns:

non-null; the source positions list
getLocals
()

Gets the source positions list.

public PositionList

Returns:

non-null; the source positions list
getPositions
()

Gets the source positions list.

public boolean

Returns:

whether this instance has any catches at all
hasAnyCatches
()

Gets whether this instance has any catches at all (either typed or catch-all).

public boolean

Returns:

true iff this instance has any local variable data to represent
hasLocals
()

Gets whether this instance has any local variable data to represent.

public boolean

Returns:

true iff this instance has any position data to represent
hasPositions
()

Gets whether this instance has any position data to represent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

catchesback to summary
private CatchTable catches

null-ok; catch table; set in finishProcessingIfNecessary

insnsback to summary
private DalvInsnList insns

null-ok; the processed instruction list; set in finishProcessingIfNecessary

localsback to summary
private LocalList locals

null-ok; local variable list; set in finishProcessingIfNecessary

positionInfoback to summary
private final int positionInfo

how much position info to preserve; one of the static constants in PositionList

positionsback to summary
private PositionList positions

null-ok; source positions list; set in finishProcessingIfNecessary

unprocessedCatchesback to summary
private CatchBuilder unprocessedCatches

non-null; unprocessed catch table; nulled out in finishProcessingIfNecessary

unprocessedInsnsback to summary
private OutputFinisher unprocessedInsns

null-ok; the instruction list, ready for final processing; nulled out in finishProcessingIfNecessary

Constructor Detail

DalvCodeback to summary
public DalvCode(int positionInfo, OutputFinisher unprocessedInsns, CatchBuilder unprocessedCatches)

Constructs an instance.

Parameters
positionInfo:int

how much position info to preserve; one of the static constants in PositionList

unprocessedInsns:OutputFinisher

non-null; the instruction list, ready for final processing

unprocessedCatches:CatchBuilder

non-null; unprocessed catch (exception handler) table

Method Detail

assignIndicesback to summary
public void assignIndices(DalvCode.AssignIndicesCallback callback)

Assign indices in all instructions that need them, using the given callback to perform lookups. This must be called before getInsns.

Parameters
callback:DalvCode.AssignIndicesCallback

non-null; callback object

finishProcessingIfNecessaryback to summary
private void finishProcessingIfNecessary()

Finish up processing of the method.

getCatchesback to summary
public CatchTable getCatches()

Gets the catch (exception handler) table.

Returns:CatchTable

non-null; the catch table

getCatchTypesback to summary
public HashSet<Type> getCatchTypes()

Gets the set of catch types handled anywhere in the code.

Returns:HashSet<Type>

non-null; the set of catch types

getInsnConstantsback to summary
public HashSet<Constant> getInsnConstants()

Gets the set of all constants referred to by instructions in the code.

Returns:HashSet<Constant>

non-null; the set of constants

getInsnsback to summary
public DalvInsnList getInsns()

Gets the list of instructions.

Returns:DalvInsnList

non-null; the instruction list

getLocalsback to summary
public LocalList getLocals()

Gets the source positions list.

Returns:LocalList

non-null; the source positions list

getPositionsback to summary
public PositionList getPositions()

Gets the source positions list.

Returns:PositionList

non-null; the source positions list

hasAnyCatchesback to summary
public boolean hasAnyCatches()

Gets whether this instance has any catches at all (either typed or catch-all).

Returns:boolean

whether this instance has any catches at all

hasLocalsback to summary
public boolean hasLocals()

Gets whether this instance has any local variable data to represent.

Returns:boolean

true iff this instance has any local variable data to represent

hasPositionsback to summary
public boolean hasPositions()

Gets whether this instance has any position data to represent.

Returns:boolean

true iff this instance has any position data to represent

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

public Interface DalvCode.AssignIndicesCallback


Class used as a callback for assignIndices.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

>= -1; the index or -1 if the constant shouldn't actually be reified with an index
getIndex
(Constant
non-null; the constant
cst
)

Gets the index for the given constant.

Method Detail

getIndexback to summary
public int getIndex(Constant cst)

Gets the index for the given constant.

Parameters
cst:Constant

non-null; the constant

Returns:int

>= -1; the index or -1 if the constant shouldn't actually be reified with an index