Class GCArrayletObjectModelBase

java.lang.Object
com.ibm.j9ddr.vm29.j9.gc.GCBase
com.ibm.j9ddr.vm29.j9.gc.GCArrayletObjectModelBase

public abstract class GCArrayletObjectModelBase extends GCBase
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected UDATA
     
    protected UDATA
     
    protected UDATA
     
    protected com.ibm.j9ddr.vm29.pointer.generated.GC_ArrayletObjectModelPointer
     
    protected VoidPointer
     
    protected VoidPointer
     
    protected UDATA
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected UDATA
    externalArrayletsSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Get the total number of bytes consumed by arraylets external to the given indexable object.
    static com.ibm.j9ddr.vm29.j9.gc.GCArrayObjectModel
    Factory method to construct an appropriate array object model.
    protected long
    getArrayLayout(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer clazz, UDATA dataSizeInBytes)
    Get the layout of an indexable object given it's class, data size in bytes and the subspace's largestDesirableSpine.
    protected long
    getArrayLayout(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Get the layout for the given indexable object
    getArrayoidPointer(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the address of first arraylet leaf slot in the spine
    getDataPointerForContiguous(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the address of first data slot in the array
    getDataSizeInBytes(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the size of data in an indexable object, in bytes, including leaves, excluding the header.
    getElementAddress(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array, int elementIndex, int elementSize)
    Returns the address of the element at elementIndex logical offset into indexableObjectPointer, assuming that each element is dataSize bytes.
    getHashcodeOffset(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the offset of the hashcode slot, in bytes, from the beginning of the header.
    protected UDATA
    getHeaderSize(long layout)
    Get the spine size without header for an arraylet with these properties
    getHeaderSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the header size of a given indexable object.
    abstract UDATA
    getSizeInBytesWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the size of an indexable object, in bytes, including the header.
    getSizeInElements(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the size of an indexable object in elements.
    getSizeInSlotsWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Returns the size of an indexable object, in slots, including the header.
    protected UDATA
    getSpineSize(long layout, UDATA numberArraylets, UDATA dataSize, boolean alignData)
    Get the spine size for an arraylet with these properties
    protected UDATA
    getSpineSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Get the spine size for the given indexable object
    protected UDATA
    getSpineSizeWithoutHeader(long layout, UDATA numberArraylets, UDATA dataSize, boolean alignData)
    Get the spine size without header for an arraylet with these properties
    abstract UDATA
    getTotalFootprintInBytesWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer arrayPtr)
    Get the total footprint of an object, in bytes, including the object header and all data.
    boolean
    isInlineContiguousArraylet(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Check the given indexable object is inline contiguous
    protected UDATA
    numArraylets(UDATA unadjustedDataSizeInBytes)
    Return the total number of arraylets for an indexable object with a size of dataInSizeByte, including a (possibly empty) leaf in the spine.
    protected UDATA
    numExternalArraylets(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array)
    Return the total number of arraylets for an indexable object, not including the arraylet in the spine.
    protected boolean
    shouldAlignSpineDataSection(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer clazz)
    Determines whether or not a spine that represents an object of this class should have its data section aligned.
    protected boolean
    shouldAlignSpineDataSection(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz)
    Determines whether or not a spine that represents an object of this class should have its data section aligned.

    Methods declared in class com.ibm.j9ddr.vm29.j9.gc.GCBase

    getExtensions, getJavaVM

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • arrayletObjectModel

      protected com.ibm.j9ddr.vm29.pointer.generated.GC_ArrayletObjectModelPointer arrayletObjectModel
    • arrayletRangeBase

      protected VoidPointer arrayletRangeBase
    • arrayletRangeTop

      protected VoidPointer arrayletRangeTop
    • largestDesirableArraySpineSize

      protected UDATA largestDesirableArraySpineSize
    • arrayletLeafSize

      protected UDATA arrayletLeafSize
    • arrayletLeafLogSize

      protected UDATA arrayletLeafLogSize
    • arrayletLeafSizeMask

      protected UDATA arrayletLeafSizeMask
  • Constructor Details

  • Method Details

    • getSpineSize

      protected UDATA getSpineSize(long layout, UDATA numberArraylets, UDATA dataSize, boolean alignData) throws CorruptDataException
      Get the spine size for an arraylet with these properties
      Parameters:
      layout - The layout of the indexable object
      numberArraylets - Number of arraylets for this indexable object
      dataSize - How many elements are in the indexable object
      alignData - Should the data section be aligned
      J9Class - The class of the array.
      Returns:
      spineSize The actual size in byte of the spine
      Throws:
      CorruptDataException
    • getSizeInElements

      public UDATA getSizeInElements(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the size of an indexable object in elements.
      Parameters:
      array - Pointer to the indexable object whose size is required
      Returns:
      Size of object in elements
      Throws:
      CorruptDataException
    • getHeaderSize

      protected UDATA getHeaderSize(long layout)
      Get the spine size without header for an arraylet with these properties
      Parameters:
      layout - The layout of the indexable object
      numberArraylets - Number of arraylets for this indexable object
      dataSize - How many elements are in the indexable object
      alignData - Should the data section be aligned
      Returns:
      spineSize The actual size in byte of the spine
    • getHeaderSize

      public UDATA getHeaderSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the header size of a given indexable object. The arraylet layout is determined base on "small" size.
      Parameters:
      array - Ptr to an array for which header size will be returned
      Returns:
      Size of header in bytes
      Throws:
      CorruptDataException
    • getSpineSizeWithoutHeader

      protected UDATA getSpineSizeWithoutHeader(long layout, UDATA numberArraylets, UDATA dataSize, boolean alignData) throws CorruptDataException
      Get the spine size without header for an arraylet with these properties
      Parameters:
      layout - The layout of the indexable object
      numberArraylets - Number of arraylets for this indexable object
      dataSize - How many elements are in the indexable object
      alignData - Should the data section be aligned
      Returns:
      spineSize The actual size in byte of the spine
      Throws:
      CorruptDataException
    • getSpineSize

      protected UDATA getSpineSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Get the spine size for the given indexable object
      Parameters:
      objPtr - Pointer to an array object
      Returns:
      The total size in bytes of objPtr's array spine; includes header, arraylet ptrs, and (if present) padding invalid input: '&' inline data
      Throws:
      CorruptDataException
    • getArrayLayout

      protected long getArrayLayout(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Get the layout for the given indexable object
      Parameters:
      objPtr - Pointer to a array object
      Returns:
      the ArrayLayout for objectPtr
      Throws:
      CorruptDataException
    • getArrayLayout

      protected long getArrayLayout(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer clazz, UDATA dataSizeInBytes) throws CorruptDataException
      Get the layout of an indexable object given it's class, data size in bytes and the subspace's largestDesirableSpine.
      Parameters:
      clazz - The class of the object stored in the array.
      dataSizeInBytes - the size in bytes of the data of the array.
      largestDesirableSpine - The largest desirable spine of the arraylet.
      Throws:
      CorruptDataException
    • getDataSizeInBytes

      public UDATA getDataSizeInBytes(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the size of data in an indexable object, in bytes, including leaves, excluding the header.
      Parameters:
      array - Pointer to the indexable object whose size is required
      Returns:
      Size of object in bytes excluding the header
      Throws:
      CorruptDataException
    • getArrayoidPointer

      public ObjectReferencePointer getArrayoidPointer(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the address of first arraylet leaf slot in the spine
      Parameters:
      array - Ptr to an array
      Returns:
      Arrayoid ptr
      Throws:
      CorruptDataException
    • getDataPointerForContiguous

      public VoidPointer getDataPointerForContiguous(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the address of first data slot in the array
      Parameters:
      array - pointer to an array
      Returns:
      Address of first data slot in the array
      Throws:
      CorruptDataException
    • getHashcodeOffset

      public UDATA getHashcodeOffset(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the offset of the hashcode slot, in bytes, from the beginning of the header.
      Returns:
      offset of the hashcode slot
      Throws:
      CorruptDataException
    • isInlineContiguousArraylet

      public boolean isInlineContiguousArraylet(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Check the given indexable object is inline contiguous
      Parameters:
      objPtr - Pointer to an array object
      Returns:
      true of array is inline contiguous
      Throws:
      CorruptDataException
    • shouldAlignSpineDataSection

      protected boolean shouldAlignSpineDataSection(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer clazz) throws CorruptDataException
      Determines whether or not a spine that represents an object of this class should have its data section aligned.
      Parameters:
      clazz - The class to check alignment for
      Returns:
      needAlignment Should the data section be aligned
      Throws:
      CorruptDataException
    • shouldAlignSpineDataSection

      protected boolean shouldAlignSpineDataSection(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz) throws CorruptDataException
      Determines whether or not a spine that represents an object of this class should have its data section aligned.
      Parameters:
      clazz - The class to check alignment for
      Returns:
      needAlignment Should the data section be aligned
      Throws:
      CorruptDataException
    • getElementAddress

      public VoidPointer getElementAddress(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array, int elementIndex, int elementSize) throws CorruptDataException
      Returns the address of the element at elementIndex logical offset into indexableObjectPointer, assuming that each element is dataSize bytes.
      Parameters:
      array - The array from which we should look-up the address
      elementIndex - The logical index number of the element within the array
      elementSize - The size, in bytes, of a single element of the array
      Returns:
      A pointer to the element
      Throws:
      CorruptDataException
    • numArraylets

      protected UDATA numArraylets(UDATA unadjustedDataSizeInBytes) throws CorruptDataException
      Return the total number of arraylets for an indexable object with a size of dataInSizeByte, including a (possibly empty) leaf in the spine.
      Parameters:
      dataSizeInBytes - size of an array in bytes (not elements)
      Returns:
      the number of arraylets used for an array of dataSizeInBytes bytes
      Throws:
      CorruptDataException
    • numExternalArraylets

      protected UDATA numExternalArraylets(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Return the total number of arraylets for an indexable object, not including the arraylet in the spine. Note that discontiguous arrays always have an empty leaf contained in the spine.
      Parameters:
      array - pointer to array
      Returns:
      the number of leaf arraylets
      Throws:
      CorruptDataException
    • externalArrayletsSize

      protected UDATA externalArrayletsSize(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Get the total number of bytes consumed by arraylets external to the given indexable object.
      Parameters:
      array - Pointer to an array object
      Returns:
      the number of bytes consumed external to the spine
      Throws:
      CorruptDataException
    • from

      public static com.ibm.j9ddr.vm29.j9.gc.GCArrayObjectModel from() throws CorruptDataException
      Factory method to construct an appropriate array object model.
      Parameters:
      structure - the J9JavaVM structure to use
      Returns:
      an instance of ArrayObjectModel
      Throws:
      CorruptDataException
    • getSizeInBytesWithHeader

      public abstract UDATA getSizeInBytesWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the size of an indexable object, in bytes, including the header.
      Parameters:
      array - Pointer to the indexable object whose size is required
      Returns:
      Size of object in bytes including the header
      Throws:
      CorruptDataException
    • getSizeInSlotsWithHeader

      public UDATA getSizeInSlotsWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer array) throws CorruptDataException
      Returns the size of an indexable object, in slots, including the header.
      Parameters:
      array - Pointer to the indexable object whose size is required
      Returns:
      Size of object in slots including the header
      Throws:
      CorruptDataException
    • getTotalFootprintInBytesWithHeader

      public abstract UDATA getTotalFootprintInBytesWithHeader(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer arrayPtr) throws CorruptDataException
      Get the total footprint of an object, in bytes, including the object header and all data. If the object has a discontiguous representation, this method should return the size of the root object plus the total of all the discontiguous parts of the object.
      Parameters:
      arrayPtr - Pointer to an object
      Returns:
      the total size of an object, in bytes, including discontiguous parts
      Throws:
      CorruptDataException