Module openj9.dtfj

Class ObjectModel


  • public final class ObjectModel
    extends Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static UDATA adjustSizeInBytes​(UDATA sizeInBytes)
      Object size should be at least minimumConsumedSize and 8 byte aligned.
      static GCHeapRegionDescriptor findRegionForPointer​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM, GCHeapRegionManager hrm, AbstractPointer pointer, GCHeapRegionDescriptor region)
      Returns the heap region of a pointer.
      static U32 getAge​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the age of an object.
      static UDATA getClassShape​(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz)
      Returns the shape of an object.
      static UDATA getClassShape​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the shape of an object.
      static UDATA getConsumedSizeInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Same as getSizeInBytesWithHeader, except it takes into account object alignment and minimum object size
      UDATA getConsumedSizeInSlotsWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Same as getSizeInSlotsWithHeader, except it takes into account object alignment and minimum object size
      static UDATA 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.
      static VoidPointer getElementAddress​(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer indexableObjectPointer, int elementIndex, int elementSize)
      Returns the address of an element.
      static UDATA getHashcodeOffset​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)  
      static UDATA getHeaderSize​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size of an object header, in bytes.
      static long getObjectAlignmentInBytes()
      Object size should be at least minimumConsumedSize and 8 byte aligned.
      static I32 getObjectHashCode​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Determine the basic hash code for the specified object.
      static UDATA getRememberedBits​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the collector bits from object's header.
      static long getScanType​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)  
      static UDATA getSizeInBytesHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size in bytes of a hole object.
      static UDATA getSizeInBytesMultiSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size, in bytes, of a multi-slot hole object.
      static UDATA getSizeInBytesSingleSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size, in bytes, of a single slot hole object.
      static UDATA getSizeInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size of an object, in bytes, including the header.
      static UDATA getSizeInElements​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size of an indexable object in elements.
      UDATA getSizeInSlotsWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns the size of an object, in slots, including the header.
      static UDATA getTotalFootprintInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Get the total footprint of an object, in bytes, including the object header and all data.
      static boolean hasBeenHashed​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object has been hashed, FALSE otherwise.
      static boolean hasBeenMoved​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object has been moved after being hashed, FALSE otherwise.
      static boolean isDarkMatterObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is dark matter, FALSE otherwise.
      static boolean isHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is a hole, FALSE otherwise.
      static boolean isIndexable​(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz)
      Returns TRUE if an class is indexable, FALSE otherwise.
      static boolean isIndexable​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is indexable, FALSE otherwise.
      static boolean isInlineContiguousArraylet​(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer arrayPtr)  
      static boolean isOld​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is old, FALSE otherwise.
      static boolean isPointerInHeap​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM, AbstractPointer pointer)
      Returns true if a pointer is in stored in heap.
      static boolean isPointerInRegion​(AbstractPointer pointer, GCHeapRegionDescriptor region)
      Returns true if a pointer is in stored in specified region.
      static boolean isRemembered​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is remembered, FALSE otherwise.
      static boolean isSingleSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
      Returns TRUE if an object is a single slot hole object, FALSE otherwise.
      static GCHeapRegionDescriptor regionForAddress​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM, GCHeapRegionManager hrm, AbstractPointer pointer)
      Returns the heap region for address of a pointer.
    • Field Detail

      • gcObjectModel

        protected static final GCObjectModel gcObjectModel
    • Method Detail

      • adjustSizeInBytes

        public static UDATA adjustSizeInBytes​(UDATA sizeInBytes)
        Object size should be at least minimumConsumedSize and 8 byte aligned.
        Parameters:
        sizeInBytes - Real size of an object
        Returns:
        Adjusted size
      • getObjectAlignmentInBytes

        public static long getObjectAlignmentInBytes()
        Object size should be at least minimumConsumedSize and 8 byte aligned.
        Parameters:
        sizeInBytes - Real size of an object
        Returns:
        Adjusted size
      • getClassShape

        public static UDATA getClassShape​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                   throws CorruptDataException
        Returns the shape of an object.
        Parameters:
        object - Pointer to object whose shape is required.
        Returns:
        The shape of the object
        Throws:
        CorruptDataException
      • getClassShape

        public static UDATA getClassShape​(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz)
                                   throws CorruptDataException
        Returns the shape of an object.
        Parameters:
        clazz - Pointer to J9Class whose shape is required.
        Returns:
        The shape of the object
        Throws:
        CorruptDataException
      • isIndexable

        public static boolean isIndexable​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                   throws CorruptDataException
        Returns TRUE if an object is indexable, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is indexable, FALSE otherwise
        Throws:
        CorruptDataException
      • isIndexable

        public static boolean isIndexable​(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer clazz)
                                   throws CorruptDataException
        Returns TRUE if an class is indexable, FALSE otherwise.
        Parameters:
        clazz - Pointer to an J9Class
        Returns:
        TRUE if an class is indexable, FALSE otherwise
        Throws:
        CorruptDataException
      • isHoleObject

        public static boolean isHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                    throws CorruptDataException
        Returns TRUE if an object is a hole, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is a hole, FALSE otherwise
        Throws:
        CorruptDataException
      • isSingleSlotHoleObject

        public static boolean isSingleSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                              throws CorruptDataException
        Returns TRUE if an object is a single slot hole object, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is a single slot hole object, FALSE otherwise
        Throws:
        CorruptDataException
      • getSizeInBytesMultiSlotHoleObject

        public static UDATA getSizeInBytesMultiSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                                       throws CorruptDataException
        Returns the size, in bytes, of a multi-slot hole object.
        Parameters:
        object - Pointer to an object
        Returns:
        The size, in bytes, of a multi-slot hole object
        Throws:
        CorruptDataException
      • getSizeInBytesSingleSlotHoleObject

        public static UDATA getSizeInBytesSingleSlotHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
        Returns the size, in bytes, of a single slot hole object.
        Parameters:
        object - Pointer to an object
        Returns:
        The size, in bytes, of a single slot hole object
      • getSizeInBytesHoleObject

        public static UDATA getSizeInBytesHoleObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                              throws CorruptDataException
        Returns the size in bytes of a hole object.
        Parameters:
        object - Pointer to an object
        Returns:
        The size in bytes of a hole object
        Throws:
        CorruptDataException
      • isDarkMatterObject

        public static boolean isDarkMatterObject​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                          throws CorruptDataException
        Returns TRUE if an object is dark matter, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is dark matter, FALSE otherwise
        Throws:
        CorruptDataException
      • getSizeInBytesWithHeader

        public static UDATA getSizeInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                              throws CorruptDataException
        Returns the size of an object, in bytes, including the header.
        Parameters:
        object - Pointer to an object
        Returns:
        The size of an object, in bytes, including the header
        Throws:
        CorruptDataException
      • getTotalFootprintInBytesWithHeader

        public static UDATA getTotalFootprintInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                                        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:
        object - Pointer to an object
        Returns:
        the total size of an object, in bytes, including discontiguous parts
        Throws:
        CorruptDataException
      • getConsumedSizeInBytesWithHeader

        public static UDATA getConsumedSizeInBytesWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                                      throws CorruptDataException
        Same as getSizeInBytesWithHeader, except it takes into account object alignment and minimum object size
        Parameters:
        object - Pointer to an object
        Returns:
        The consumed heap size of an object, in bytes, including the header
        Throws:
        CorruptDataException
      • getSizeInSlotsWithHeader

        public UDATA getSizeInSlotsWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                       throws CorruptDataException
        Returns the size of an object, in slots, including the header.
        Parameters:
        object - Pointer to an object
        Returns:
        The size of an object, in slots, including the header
        Throws:
        CorruptDataException
      • getConsumedSizeInSlotsWithHeader

        public UDATA getConsumedSizeInSlotsWithHeader​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                               throws CorruptDataException
        Same as getSizeInSlotsWithHeader, except it takes into account object alignment and minimum object size
        Parameters:
        object - Pointer to an object
        Returns:
        The consumed heap size of an object, in slots, including the header
        Throws:
        CorruptDataException
      • getAge

        public static U32 getAge​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                          throws CorruptDataException
        Returns the age of an object.
        Parameters:
        object - Pointer to an object
        Returns:
        The age of the object
        Throws:
        CorruptDataException
      • isRemembered

        public static boolean isRemembered​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                    throws CorruptDataException
        Returns TRUE if an object is remembered, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is remembered, FALSE otherwise
        Throws:
        CorruptDataException
      • getRememberedBits

        public static UDATA getRememberedBits​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                       throws CorruptDataException
        Returns the collector bits from object's header.
        Parameters:
        object - Pointer to an object
        Returns:
        collector bits
        Throws:
        CorruptDataException
      • isOld

        public static boolean isOld​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                             throws CorruptDataException
        Returns TRUE if an object is old, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object is in the old area, FALSE otherwise
        Throws:
        CorruptDataException
      • hasBeenHashed

        public static boolean hasBeenHashed​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                     throws CorruptDataException
        Returns TRUE if an object has been hashed, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object has been hashed, FALSE otherwise
        Throws:
        CorruptDataException
      • hasBeenMoved

        public static boolean hasBeenMoved​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                    throws CorruptDataException
        Returns TRUE if an object has been moved after being hashed, FALSE otherwise.
        Parameters:
        object - Pointer to an object
        Returns:
        TRUE if an object has been moved after being hashed, FALSE otherwise
        Throws:
        CorruptDataException
      • getObjectHashCode

        public static I32 getObjectHashCode​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                     throws CorruptDataException
        Determine the basic hash code for the specified object.
        Parameters:
        object - [in] the object to be hashed
        Returns:
        the persistent, basic hash code for the object
        Throws:
        CorruptDataException
      • getDataSizeInBytes

        public static 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:
        the size of an object in bytes excluding the header
        Throws:
        CorruptDataException
      • getHeaderSize

        public static UDATA getHeaderSize​(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer object)
                                   throws CorruptDataException
        Returns the size of an object header, in bytes.

        Parameters:
        object - Pointer to an object
        Returns:
        The size of an object header, in bytes.
        Throws:
        CorruptDataException
      • getElementAddress

        public static VoidPointer getElementAddress​(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer indexableObjectPointer,
                                                    int elementIndex,
                                                    int elementSize)
                                             throws CorruptDataException
        Returns the address of an element.
        Parameters:
        indexableObjectPointer - Pointer to a J9 indexable object
        elementIndex - Index of the element
        elementSize - Size of the element
        Returns:
        The address of an element.
        Throws:
        CorruptDataException
      • findRegionForPointer

        public static GCHeapRegionDescriptor findRegionForPointer​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM,
                                                                  GCHeapRegionManager hrm,
                                                                  AbstractPointer pointer,
                                                                  GCHeapRegionDescriptor region)
        Returns the heap region of a pointer.
        Parameters:
        javaVM - J9JavaVMPointer
        hrm - The gc heap region manager
        pointer - Any abstract pointer
        region - A gc heap region descriptor
        Returns:
        The heap region descriptor of the given pointer.
      • regionForAddress

        public static GCHeapRegionDescriptor regionForAddress​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM,
                                                              GCHeapRegionManager hrm,
                                                              AbstractPointer pointer)
        Returns the heap region for address of a pointer.
        Parameters:
        javaVM - J9JavaVMPointer
        hrm - The gc heap region manager
        pointer - Any abstract pointer
        Returns:
        The heap region descriptor for address of a pointer.
      • isPointerInRegion

        public static boolean isPointerInRegion​(AbstractPointer pointer,
                                                GCHeapRegionDescriptor region)
        Returns true if a pointer is in stored in specified region.
        Parameters:
        pointer - Any abstract pointer
        region - Descriptor for a region in heap
        Returns:
        If the AbstractPointer pointer is in stored in the given region in heap.
      • isPointerInHeap

        public static boolean isPointerInHeap​(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer javaVM,
                                              AbstractPointer pointer)
        Returns true if a pointer is in stored in heap.
        Parameters:
        javaVM - J9JavaVMPointer
        pointer - Any abstract pointer
        Returns:
        If the AbstractPointer pointer is in stored in heap.
      • isInlineContiguousArraylet

        public static boolean isInlineContiguousArraylet​(com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer arrayPtr)
                                                  throws CorruptDataException
        Parameters:
        arrayPtr - array object we are checking for isInlineContiguousArraylet
        Throws:
        CorruptDataException - If there's a problem accessing the layout of the indexable object