ProdConsAnalyzer

dotty.tools.backend.jvm.analysis.ProdConsAnalyzer
class ProdConsAnalyzer(methodNode: MethodNode, classInternalName: String) 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: the 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.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Returns the potential consumer instructions of a (local or stack) value in the frame of insn. This is the counterpart of producersForValueAt.

Returns the potential consumer instructions of a (local or stack) value in the frame of insn. This is the counterpart of producersForValueAt.

Attributes

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.

Attributes

Returns the potential producer instructions of the values consumed by insn.

Returns the potential producer instructions of the values consumed by insn.

Attributes

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.

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.

Attributes

Returns the potential ultimate consumers of a value in the frame of insn. Consumers are tracked through copying operations such as STORE and LOAD.

Returns the potential ultimate consumers of a value in the frame of insn. Consumers are tracked through copying operations such as STORE and LOAD.

Attributes

Inherited methods

Attributes

Inherited from:
AsmAnalyzer

Inherited fields

Attributes

Inherited from:
AsmAnalyzer