Class ConcreteLocals


  • public final class ConcreteLocals
    extends Object
    Fixed-size local variable table of concrete values, with wide values occupying two slots.
    • Constructor Detail

      • ConcreteLocals

        public ConcreteLocals​(int maxLocals)
        Creates an empty table.
        Parameters:
        maxLocals - number of slots
    • Method Detail

      • setInt

        public void setInt​(int slot,
                           int value)
        Stores an int.
        Parameters:
        slot - target slot
        value - value to store
      • setLong

        public void setLong​(int slot,
                            long value)
        Stores a long.
        Parameters:
        slot - target slot
        value - value to store
      • setFloat

        public void setFloat​(int slot,
                             float value)
        Stores a float.
        Parameters:
        slot - target slot
        value - value to store
      • setDouble

        public void setDouble​(int slot,
                              double value)
        Stores a double.
        Parameters:
        slot - target slot
        value - value to store
      • setReference

        public void setReference​(int slot,
                                 ObjectInstance instance)
        Stores a reference.
        Parameters:
        slot - target slot
        instance - instance to store
      • setNull

        public void setNull​(int slot)
        Stores a null reference.
        Parameters:
        slot - target slot
      • getInt

        public int getInt​(int slot)
        Reads a slot as an int.
        Parameters:
        slot - slot to read
        Returns:
        the int value
      • getLong

        public long getLong​(int slot)
        Reads a slot as a long.
        Parameters:
        slot - slot to read
        Returns:
        the long value
      • getFloat

        public float getFloat​(int slot)
        Reads a slot as a float.
        Parameters:
        slot - slot to read
        Returns:
        the float value
      • getDouble

        public double getDouble​(int slot)
        Reads a slot as a double.
        Parameters:
        slot - slot to read
        Returns:
        the double value
      • getReference

        public ObjectInstance getReference​(int slot)
        Reads a slot as a reference.
        Parameters:
        slot - slot to read
        Returns:
        the instance, or null for a null reference
      • size

        public int size()
        Returns:
        the number of slots
      • isDefined

        public boolean isDefined​(int slot)
        Tests whether a slot holds a value.
        Parameters:
        slot - slot to test
        Returns:
        true if the slot is in range and defined
      • snapshot

        public Map<Integer,​ConcreteValue> snapshot()
        Captures the defined slots as an unmodifiable map.
        Returns:
        slot-to-value map of defined slots
      • forMethod

        public static ConcreteLocals forMethod​(MethodEntry method,
                                               ConcreteValue[] args)
        Creates a table sized for a method with its arguments preloaded by slot category.
        Parameters:
        method - the method to size for
        args - argument values in order, or null for none
        Returns:
        the initialized locals
        Throws:
        IllegalArgumentException - if the method is null or the arguments overflow the table