Class MethodLocals


  • public final class MethodLocals
    extends Object
    The parameter slot layout of a method: which local slots hold the receiver and parameters, and how those map to parameter indices.
    • Constructor Detail

      • MethodLocals

        public MethodLocals​(IRMethod method)
        Walks the method's SSA parameter list once to assign each entry its local slot, counting long and double as two.
        Parameters:
        method - the method whose slot layout to compute
    • Method Detail

      • parameterSlotCount

        public int parameterSlotCount()
        Returns:
        the number of local slots the receiver and parameters occupy, so the first body local's index
      • slotOfParameter

        public int slotOfParameter​(SSAValue value)
        Parameters:
        value - the SSA value to locate
        Returns:
        the local slot the parameter or receiver occupies, or -1 when the value is neither
      • isParameterOrThisSlot

        public boolean isParameterOrThisSlot​(int slot)
        Parameters:
        slot - the local slot
        Returns:
        true when the slot starts the receiver or a parameter rather than a body local
      • parameterIndexForSlot

        public int parameterIndexForSlot​(int slot)
        The zero-based parameter index for a parameter start slot (receiver excluded).
        Parameters:
        slot - the local slot
        Returns:
        the parameter index, or -1 if the slot starts no parameter