Search in sources :

Example 1 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class MonitorTableList method peek.

/**
 * Search all the monitor tables in the J9JavaVM->monitorTables for the inflated monitor corresponding to the specified object
 *
 * @throws CorruptDataException
 *
 * @param object the object
 *
 * @returns the J9ObjectMonitorPointer found in the table, or J9ObjectMonitorPointer.NULL if no entry was found
 *
 * @see util/thrinfo.c : monitorTablePeek
 */
public static J9ObjectMonitorPointer peek(J9ObjectPointer object) throws CorruptDataException {
    if ((null == object) || (object.isNull())) {
        return J9ObjectMonitorPointer.NULL;
    }
    MonitorTable table = null;
    if (!initialized) {
        initializeCaches();
    }
    J9ObjectMonitorPointer objectMonitor = J9ObjectMonitorPointer.NULL;
    long hashcode = new U32(ObjectModel.getObjectHashCode(object)).longValue();
    int index = (int) (hashcode % monitorTables.length);
    table = monitorTables[index];
    if (table == null) {
        return objectMonitor;
    }
    if (null != table) {
        objectMonitor = table.peek(object);
        if (null == objectMonitor) {
            return J9ObjectMonitorPointer.NULL;
        }
    }
    return objectMonitor;
}
Also used : U32(com.ibm.j9ddr.vm29.types.U32) J9ObjectMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer)

Example 2 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class MonitorTable method initializedCachedMonitorTable.

private void initializedCachedMonitorTable() {
    cachedMonitorTable = new HashMap<J9ObjectPointer, J9ObjectMonitorPointer>();
    try {
        Iterator<J9ObjectMonitorPointer> iterator = iterator();
        while (iterator.hasNext()) {
            J9ObjectMonitorPointer objectMonitor = iterator.next();
            J9ObjectPointer object = J9ObjectPointer.cast(objectMonitor.monitor().userData());
            cachedMonitorTable.put(object, objectMonitor);
        }
    } catch (CorruptDataException e) {
        raiseCorruptDataEvent("Error building cached monitor table", e, false);
    }
}
Also used : J9ObjectMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 3 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class StringTable method iterator.

public SlotIterator<J9ObjectPointer> iterator() {
    return new SlotIterator<J9ObjectPointer>() {

        private SlotIterator<PointerPointer> hashTableIterator = null;

        private long currentIndex = 0;

        public boolean hasNext() {
            while (true) {
                // Is the current iterator good?
                if (hashTableIterator != null) {
                    // Are there still entries?
                    if (hashTableIterator.hasNext()) {
                        return true;
                    }
                    // Move to the next hash table
                    currentIndex++;
                }
                // Are there more hash tables?
                if (currentIndex >= _tableCount) {
                    hashTableIterator = null;
                    return false;
                }
                // Get the next hash table iterator
                try {
                    J9HashTablePointer hashTable = J9HashTablePointer.cast(_stringTable._table().at(currentIndex));
                    HashTable<PointerPointer> currentHashTable = HashTable.fromJ9HashTable(hashTable, false, PointerPointer.class, _hashFn, new StringComparatorFunction<PointerPointer>());
                    hashTableIterator = currentHashTable.iterator();
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                // Keep trying
                }
            }
        }

        public J9ObjectPointer next() {
            if (hasNext()) {
                PointerPointer next = hashTableIterator.next();
                return J9ObjectPointer.cast(next);
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public VoidPointer nextAddress() {
            if (hasNext()) {
                return VoidPointer.cast(hashTableIterator.nextAddress());
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public void remove() {
            throw new UnsupportedOperationException("The image is read only and cannot be modified.");
        }
    };
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) NoSuchElementException(java.util.NoSuchElementException)

Example 4 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class RootScanner method scanNonCollectableObjectsInternal.

private void scanNonCollectableObjectsInternal(long memoryType) throws CorruptDataException {
    GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
    while (regionIterator.hasNext()) {
        GCHeapRegionDescriptor region = regionIterator.next();
        if (new UDATA(region.getTypeFlags()).allBitsIn(memoryType)) {
            GCObjectHeapIterator objectIterator = GCObjectHeapIterator.fromHeapRegionDescriptor(region, true, false);
            while (objectIterator.hasNext()) {
                J9ObjectPointer object = objectIterator.next();
                doClassSlot(J9ObjectHelper.clazz(object));
                GCObjectIterator fieldIterator = GCObjectIterator.fromJ9Object(object, true);
                GCObjectIterator fieldAddressIterator = GCObjectIterator.fromJ9Object(object, true);
                while (fieldIterator.hasNext()) {
                    doNonCollectableObjectSlot(fieldIterator.next(), fieldAddressIterator.nextAddress());
                }
            }
        }
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) UDATA(com.ibm.j9ddr.vm29.types.UDATA) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) GCObjectHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator) GCObjectIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 5 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class StringTable method search.

public J9ObjectPointer search(J9ObjectPointer objectPointer) throws CorruptDataException {
    UDATA hashCode = _hashFn.hash(PointerPointer.cast(objectPointer));
    UDATA tableIndex = getTableIndex(hashCode);
    J9HashTablePointer hashTablePtr = getTable(tableIndex);
    HashTable<J9ObjectPointer> currentHashTable = HashTable.fromJ9HashTable(hashTablePtr, false, J9ObjectPointer.class, new StringTable.StringHashFunction<J9ObjectPointer>(), new StringTable.StringComparatorFunction<J9ObjectPointer>());
    J9ObjectPointer result = currentHashTable.find(objectPointer);
    return result;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) MM_StringTable(com.ibm.j9ddr.vm29.structure.MM_StringTable) J9HashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Aggregations

J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)76 CorruptDataException (com.ibm.j9ddr.CorruptDataException)48 UDATA (com.ibm.j9ddr.vm29.types.UDATA)22 NoSuchElementException (java.util.NoSuchElementException)18 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)17 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)12 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)7 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)6 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)5 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)5 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)4 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)4 ArrayList (java.util.ArrayList)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)3 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)3