Class JSRInlinerAdapter.Instantiation

java.lang.Object
java.util.AbstractMap<LabelNode,LabelNode>
org.objectweb.asm.commons.JSRInlinerAdapter.Instantiation
All Implemented Interfaces:
Map<LabelNode,LabelNode>
Enclosing class:
JSRInlinerAdapter

private final class JSRInlinerAdapter.Instantiation extends AbstractMap<LabelNode,LabelNode>
An instantiation of a subroutine.
  • Field Details

    • parent

      The instantiation from which this one was created (or null for the instantiation of the main "subroutine").
    • subroutineInsns

      final BitSet subroutineInsns
      The original instructions that belong to the subroutine which is instantiated. Bit i is set iff instruction at index i belongs to this subroutine.
    • clonedLabels

      final Map<LabelNode,LabelNode> clonedLabels
      A map from labels from the original code to labels pointing at code specific to this instantiation, for use in remapping try/catch blocks, as well as jumps.

      Note that in the presence of instructions belonging to several subroutines, we map the target label of a GOTO to the label used by the oldest instantiation (parent instantiations are older than their children). This avoids code duplication during inlining in most cases.

    • returnLabel

      final LabelNode returnLabel
      The return label for this instantiation, to which all original returns will be mapped.
  • Constructor Details

  • Method Details

    • findOwner

      JSRInlinerAdapter.Instantiation findOwner(int insnIndex)
      Returns the "owner" of a particular instruction relative to this instantiation: the owner refers to the Instantiation which will emit the version of this instruction that we will execute.

      Typically, the return value is either this or null. this indicates that this instantiation will generate the version of this instruction that we will execute, and null indicates that this instantiation never executes the given instruction.

      Sometimes, however, an instruction can belong to multiple subroutines; this is called a shared instruction, and occurs when multiple subroutines branch to common points of control. In this case, the owner is the oldest instantiation which owns the instruction in question (parent instantiations are older than their children).

      Parameters:
      insnIndex - the index of an instruction in the original code.
      Returns:
      the "owner" of a particular instruction relative to this instantiation.
    • getClonedLabelForJumpInsn

      LabelNode getClonedLabelForJumpInsn(LabelNode labelNode)
      Returns the clone of the given original label that is appropriate for use in a jump instruction.
      Parameters:
      labelNode - a label of the original code.
      Returns:
      a clone of the given label for use in a jump instruction in the inlined code.
    • getClonedLabel

      LabelNode getClonedLabel(LabelNode labelNode)
      Returns the clone of the given original label that is appropriate for use by a try/catch block or a variable annotation.
      Parameters:
      labelNode - a label of the original code.
      Returns:
      a clone of the given label for use by a try/catch block or a variable annotation in the inlined code.
    • entrySet

      public Set<Map.Entry<LabelNode,LabelNode>> entrySet()
      Specified by:
      entrySet in interface Map<LabelNode,LabelNode>
      Specified by:
      entrySet in class AbstractMap<LabelNode,LabelNode>
    • get

      public LabelNode get(Object key)
      Specified by:
      get in interface Map<LabelNode,LabelNode>
      Overrides:
      get in class AbstractMap<LabelNode,LabelNode>
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface Map<LabelNode,LabelNode>
      Overrides:
      equals in class AbstractMap<LabelNode,LabelNode>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<LabelNode,LabelNode>
      Overrides:
      hashCode in class AbstractMap<LabelNode,LabelNode>