trait ProdConsAnalyzerImpl extends AnyRef
This class provides additional queries over ASM's built-in SourceValue
analysis.
The analysis computes for each value in a frame a set of source instructions, which are the
potential producers. Most instructions produce either nothing or a stack value. For example,
a LOAD
instruction is the producer of the value pushed onto the stack. The exception are
STORE
instructions, which produce a new value for a local variable slot, so they are used
as producers for the value they stored.
Note that pseudo-instructions are used as initial producers for parameters and local variables. See the documentation on class InitialProducer.
This class implements the following queries over the data computed by the SourceValue analysis:
- producersForValueAt(insn, slot)
- consumersOfValueAt(insn, slot)
- producersForInputsOf(insn)
- consumersOfOutputsFrom(insn)
- initialProducersForValueAt(insn, slot)
- ultimateConsumersOfValueAt(insn, slot)
- initialProducersForInputsOf(insn)
- ultimateConsumersOfOutputsFrom(insn)
The following operations are considered as copying operations:
- xLOAD, xSTORE
- DUP, DUP2, DUP_X1, DUP_X2, DUP2_X1, DUP2_X2
- SWAP
- CHECKCAST
If ever needed, we could introduce a mode where primitive conversions (l2i) are considered as copying operations.
Note on performance: thee data flow analysis (SourceValue / SourceInterpreter, provided by ASM)
is roughly 2-3x slower than a simple analysis (like BasicValue). The reason is that the merge
function (merging producer sets) is more complex than merging simple basic values.
See also the doc comment in the package object analysis
.
- Alphabetic
- By Inheritance
- ProdConsAnalyzerImpl
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
- def consumersOfOutputsFrom(insn: AbstractInsnNode): Set[AbstractInsnNode]
-
def
consumersOfValueAt(insn: AbstractInsnNode, slot: Int): Set[AbstractInsnNode]
Returns the potential consumer instructions of a (local or stack) value in the frame of
insn
.Returns the potential consumer instructions of a (local or stack) value in the frame of
insn
. This is the counterpart ofproducersForValueAt
. - def initialProducersForInputsOf(insn: AbstractInsnNode): Set[AbstractInsnNode]
-
def
initialProducersForValueAt(insn: AbstractInsnNode, slot: Int): Set[AbstractInsnNode]
Returns the potential initial producer instructions of a value in the frame of
insn
.Returns the potential initial producer instructions of a value in the frame of
insn
.Unlike
producersForValueAt
, producers are tracked through copying instructions such as STORE and LOAD. If the producer of the value is a LOAD, then the producers of the stored value(s) are returned instead. -
def
producersForInputsOf(insn: AbstractInsnNode): Set[AbstractInsnNode]
Returns the potential producer instructions of any of the values consumed by
insn
. -
def
producersForValueAt(insn: AbstractInsnNode, slot: Int): Set[AbstractInsnNode]
Returns the potential producer instructions of a (local or stack) value in the frame of
insn
.Returns the potential producer instructions of a (local or stack) value in the frame of
insn
. This method simply returns the producer information computed by the SourceValue analysis. - def ultimateConsumersOfOutputsFrom(insn: AbstractInsnNode): Set[AbstractInsnNode]
-
def
ultimateConsumersOfValueAt(insn: AbstractInsnNode, slot: Int): Set[AbstractInsnNode]
Returns the potential ultimate consumers of a value in the frame of
insn
.Returns the potential ultimate consumers of a value in the frame of
insn
. Consumers are tracked through copying operations such as SOTRE and LOAD.
The Scala compiler and reflection APIs.