class ProdConsAnalyzer extends AsmAnalyzer[SourceValue]
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
.
- Source
- ProdConsAnalyzer.scala
- Alphabetic
- By Inheritance
- ProdConsAnalyzer
- AsmAnalyzer
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ProdConsAnalyzer(methodNode: MethodNode, classInternalName: InternalName)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toany2stringadd[ProdConsAnalyzer] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (ProdConsAnalyzer, B)
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toArrowAssoc[ProdConsAnalyzer] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val analyzer: Analyzer[SourceValue]
- Definition Classes
- AsmAnalyzer
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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 ensuring(cond: (ProdConsAnalyzer) => Boolean, msg: => Any): ProdConsAnalyzer
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toEnsuring[ProdConsAnalyzer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (ProdConsAnalyzer) => Boolean): ProdConsAnalyzer
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toEnsuring[ProdConsAnalyzer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): ProdConsAnalyzer
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toEnsuring[ProdConsAnalyzer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): ProdConsAnalyzer
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toEnsuring[ProdConsAnalyzer] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toStringFormat[ProdConsAnalyzer] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
- def frameAt(instruction: AbstractInsnNode): Frame[SourceValue]
- Definition Classes
- AsmAnalyzer
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def →[B](y: B): (ProdConsAnalyzer, B)
- Implicit
- This member is added by an implicit conversion from ProdConsAnalyzer toArrowAssoc[ProdConsAnalyzer] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
The Scala compiler and reflection APIs.