Class NewArrayInstruction


  • public class NewArrayInstruction
    extends IRInstruction
    An array allocation covering newarray, anewarray, and multianewarray.
    • Constructor Detail

      • NewArrayInstruction

        public NewArrayInstruction​(SSAValue result,
                                   IRType elementType,
                                   Value length)
        Creates a one-dimensional array allocation.
        Parameters:
        result - the SSA value receiving the array reference
        elementType - the element type
        length - the array length
      • NewArrayInstruction

        public NewArrayInstruction​(SSAValue result,
                                   IRType elementType,
                                   List<Value> dimensions)
        Creates a multi-dimensional array allocation.
        Parameters:
        result - the SSA value receiving the array reference
        elementType - the element type
        dimensions - the length of each allocated dimension
    • Method Detail

      • getElementType

        public IRType getElementType()
        Returns:
        the element type
      • getDimensions

        public List<Value> getDimensions()
        Returns:
        the dimensions
      • isMultiDimensional

        public boolean isMultiDimensional()
        Checks if this is a multi-dimensional array allocation.
        Returns:
        true if array has multiple dimensions
      • replaceOperand

        public void replaceOperand​(Value oldValue,
                                   Value newValue)
        Description copied from class: IRInstruction
        Replaces an operand value with a new value.
        Specified by:
        replaceOperand in class IRInstruction
        Parameters:
        oldValue - the value to replace
        newValue - the replacement value
      • accept

        public <T> T accept​(IRVisitor<T> visitor)
        Description copied from class: IRInstruction
        Accepts a visitor for this instruction.
        Specified by:
        accept in class IRInstruction
        Type Parameters:
        T - the return type
        Parameters:
        visitor - the visitor to accept
        Returns:
        the visitor result