Class MemoryFactory

java.lang.Object
org.qbicc.interpreter.memory.MemoryFactory

public final class MemoryFactory extends Object
Factory methods for producing memory instances.
  • Method Details

    • getEmpty

      public static Memory getEmpty()
      Get an empty memory. The memory may have any type (or none) and is not guaranteed to be extendable or copyable.
      Returns:
      an empty memory (not null)
    • replicate

      public static Memory replicate(Memory first, int nCopies)
    • compose

      public static Memory compose(Memory... memories)
    • wrap

      public static ByteArrayMemory wrap(byte[] array, ByteOrder byteOrder)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static ShortArrayMemory wrap(short[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static IntArrayMemory wrap(int[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static LongArrayMemory wrap(long[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static CharArrayMemory wrap(char[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static FloatArrayMemory wrap(float[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static DoubleArrayMemory wrap(double[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static BooleanArrayMemory wrap(boolean[] array)
      Wrap the given array as a memory of the same size and type.
      Parameters:
      array - the array to wrap (must not be null)
      Returns:
      the wrapper memory (must not be null)
    • wrap

      public static ReferenceArrayMemory wrap(VmObject[] array, ReferenceType refType)
      Wrap the given array as a memory of the same size and type. The size of a reference is acquired from the given type.
      Parameters:
      array - the array to wrap (must not be null)
      refType - the reference type (must not be null)
      Returns:
      the wrapper memory (must not be null)