Module openj9.dtfj

Interface JavaObject

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void arraycopy​(int srcStart, Object dst, int dstStart, int length)
      Copies data from the image array into a local Java array.
      boolean equals​(Object obj)
      Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
      int getArraySize()
      Get the number of elements in this array.
      long getHashcode()
      Fetch the basic hash code for the object.
      JavaHeap getHeap()
      Gets the heap where this object is located.
      ImagePointer getID()
      The ID of an object is a unique address is memory which identifies the object.
      JavaClass getJavaClass()
      Get the JavaClass instance which represents the class of this object.
      long getPersistentHashcode()
      Fetch the basic hash code of the object in the image.
      Iterator getReferences()
      Get the set of references from this object.
      Iterator getSections()
      An object is represented in the Java runtime by one or more regions of memory.
      long getSize()
      Get the number of bytes of memory occupied by this object on the heap.
      int hashCode()
      Answers an integer hash code for the receiver.
      boolean isArray()
      Is this object an array?
    • Method Detail

      • arraycopy

        void arraycopy​(int srcStart,
                       Object dst,
                       int dstStart,
                       int length)
                throws CorruptDataException,
                       MemoryAccessException
        Copies data from the image array into a local Java array. The dst object must be an array of the appropriate type -- a base type array for base types, or a JavaObject array for reference arrays.
        Parameters:
        srcStart - index in the receiver to start copying from
        dst - the destination array
        dstStart - index in the destination array to start copying into
        length - the number of elements to be copied
        Throws:
        CorruptDataException
        MemoryAccessException
        NullPointerException - if dst is null
        IllegalArgumentException - if the receiver is not an array, or if dst is not an array of the appropriate type
        IndexOutOfBoundsException - if srcStart, dstStart, or length are out of bounds in either the receiver or the destination array
      • getHashcode

        long getHashcode()
                  throws DataUnavailable,
                         CorruptDataException
        Fetch the basic hash code for the object. This is the hash code which would be returned if a Java thread had requested it. Typically the hash code is based on the address of an object, and may change if the object is moved by a garbage collection cycle.
        Returns:
        the basic hash code of the object in the image
        Throws:
        DataUnavailable - if the hash code cannot be determined
        CorruptDataException
        See Also:
        getPersistentHashcode()
      • getPersistentHashcode

        long getPersistentHashcode()
                            throws DataUnavailable,
                                   CorruptDataException
        Fetch the basic hash code of the object in the image. This hash code is guaranteed to be persistent between multiple snapshots of the same Image. If the hash code cannot be determined, or if the hash code for this object could change between snapshots, an exception is thrown.

        If the VM uses a 'hasBeenHashed' bit, the value of this bit can be inferred by calling getPersistentHashcode(). If the persistent hash code is not available, then the 'hasBeenHashed' bit has not been set, and the hash of the object could change if the object moves between snapshots

        Returns:
        the basic hash code of the object in the image
        Throws:
        DataUnavailable - if a hash code cannot be determined, or if the hash code could change between successive snapshots
        CorruptDataException
        See Also:
        getHashcode()
      • getID

        ImagePointer getID()
        The ID of an object is a unique address is memory which identifies the object. The data at this memory is implementation defined. The object may be non-contiguous. Portions of the object may appear below or above this address.
        Returns:
        the runtime-wide unique identifier for the object
      • getSections

        Iterator getSections()
        An object is represented in the Java runtime by one or more regions of memory. These include the object's header and the data in the object. In certain allocation strategies, an object's header and data may be allocated contiguously. In this case, this method may return an iterator for a single section. In other schemes, the header may be separate from the data or the data may be broken up into multiple regions. Additionally, this function does not guarantee that the memory used by this object is not also shared by one or more other objects. Callers should not make any assumptions about the contents of the memory.
        Returns:
        a collection of sections that make up this object
        See Also:
        ImageSection, CorruptData
      • getReferences

        Iterator getReferences()
        Get the set of references from this object. Corrupt references will be returned as CorruptData objects by the Iterator.
        Returns:
        an iterator of JavaReference and CorruptData objects
        See Also:
        JavaReference, CorruptData
      • equals

        boolean equals​(Object obj)
        Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. The implementation in Object answers true only if the argument is the exact same object as the receiver (==).
        Overrides:
        equals in class Object
        Parameters:
        obj - Object the object to compare with this object.
        Returns:
        boolean true if the object is the same as this object false if it is different from this object.
        See Also:
        Object.hashCode()
      • hashCode

        int hashCode()
        Answers an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.
        Overrides:
        hashCode in class Object
        Returns:
        the receiver's hash.
        See Also:
        Object.equals(java.lang.Object)