Class CodeAddress


public final class CodeAddress extends ZeroSizeInsn
Pseudo-instruction which is used to track an address within a code array. Instances are used for such things as branch targets and exception handler ranges. Its code size is zero, and so instances do not in general directly wind up in any output (either human-oriented or binary file).
  • Constructor Details

    • CodeAddress

      public CodeAddress(SourcePosition position)
      Constructs an instance. The output address of this instance is initially unknown (-1).
      Parameters:
      position - non-null; source position
    • CodeAddress

      public CodeAddress(SourcePosition position, boolean bindsClosely)
      Constructs an instance. The output address of this instance is initially unknown (-1).
      Parameters:
      position - non-null; source position
      bindsClosely - if the address should bind closely to the following real instruction.
  • Method Details

    • withRegisters

      public final DalvInsn withRegisters(RegisterSpecList registers)
      Returns an instance that is just like this one, except that the register list is replaced by the given one, and its address is reset.
      Specified by:
      withRegisters in class DalvInsn
      Parameters:
      registers - non-null; new register list
      Returns:
      non-null; an appropriately-constructed instance
    • argString

      protected String argString()
      Gets the string form for any arguments to this instance. Subclasses must override this.
      Specified by:
      argString in class DalvInsn
      Returns:
      null-ok; the string version of any arguments or null if there are none
    • listingString0

      protected String listingString0(boolean noteIndices)
      Helper for DalvInsn.listingString(java.lang.String, int, boolean), which returns the string form of this instance suitable for inclusion in a human-oriented listing dump, not including the instruction address and without respect for any output formatting. This method should return null if this instance should not appear in a listing.
      Specified by:
      listingString0 in class DalvInsn
      Parameters:
      noteIndices - whether to include an explicit notation of constant pool indices
      Returns:
      null-ok; the listing string
    • getBindsClosely

      public boolean getBindsClosely()
      Gets whether this address binds closely to the following "real" (non-zero-length) instruction. When a prefix is added to an instruction (for example, to move a value from a high register to a low register), this determines whether this CodeAddress will point to the prefix, or to the instruction itself. If bindsClosely is true, the address will point to the instruction itself, otherwise it will point to the prefix (if any)
      Returns:
      true if this address binds closely to the next real instruction