Search in sources :

Example 41 with J9ObjectPointer

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

the class RootScanner method scanOwnableSynchronizerObjects.

protected void scanOwnableSynchronizerObjects() throws CorruptDataException {
    setReachability(Reachability.WEAK);
    GCOwnableSynchronizerObjectListIterator ownableSynchronizerObjectListIterator = GCOwnableSynchronizerObjectListIterator.from();
    while (ownableSynchronizerObjectListIterator.hasNext()) {
        J9ObjectPointer ownableSynchronizerObject = ownableSynchronizerObjectListIterator.next();
        doOwnableSynchronizerObject(ownableSynchronizerObject);
    }
}
Also used : GCOwnableSynchronizerObjectListIterator(com.ibm.j9ddr.vm29.j9.gc.GCOwnableSynchronizerObjectListIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 42 with J9ObjectPointer

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

the class StringTable method cacheIterator.

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

        private UDATA cacheTableIndex;

        private UDATA cacheSize;

        private PointerPointer cache;

        {
            // Instance initialiser
            cacheTableIndex = new UDATA(0);
            try {
                cacheSize = getCacheSize();
                cache = _stringTable._cacheEA();
            } catch (CorruptDataException e) {
                raiseCorruptDataEvent("Error getting next item", e, false);
                cacheSize = new UDATA(0);
            }
        }

        public boolean hasNext() {
            while (cacheTableIndex.lt(cacheSize)) {
                try {
                    if (cache.at(cacheTableIndex).notNull()) {
                        return true;
                    }
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                }
                cacheTableIndex = cacheTableIndex.add(1);
            }
            return false;
        }

        public J9ObjectPointer next() {
            if (hasNext()) {
                try {
                    J9ObjectPointer cachedString = J9ObjectPointer.cast(cache.at(cacheTableIndex));
                    cacheTableIndex = cacheTableIndex.add(1);
                    return cachedString;
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                    return null;
                }
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public VoidPointer nextAddress() {
            if (hasNext()) {
                VoidPointer address = VoidPointer.cast(cache.add(cacheTableIndex));
                cacheTableIndex = cacheTableIndex.add(1);
                return address;
            } 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 : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 43 with J9ObjectPointer

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

the class GCClassIterator method next.

public J9ObjectPointer next() {
    if (hasNext()) {
        switch(state) {
            case state_statics:
                return staticsIterator.next();
            case state_constant_pool:
                return constantPoolSlotIterator.next();
            case state_slots:
                if (clazz != null) {
                    J9ObjectPointer classObject = null;
                    try {
                        classObject = clazz.classObject();
                    } catch (CorruptDataException e) {
                        // can try to recover from this
                        raiseCorruptDataEvent("Error fetching the class object", e, false);
                    }
                    clazz = null;
                    return classObject;
                }
        }
    }
    throw new NoSuchElementException("There are no more items available through this iterator");
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 44 with J9ObjectPointer

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

the class GCHeapMapWordIterator method next.

public J9ObjectPointer next() {
    if (hasNext()) {
        J9ObjectPointer objectToReturn = _next;
        _next = nextObject();
        return objectToReturn;
    } else {
        throw new NoSuchElementException("There are no more items available through this iterator");
    }
}
Also used : J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 45 with J9ObjectPointer

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

the class GCHeapMapWordIterator method nextObject.

private J9ObjectPointer nextObject() {
    J9ObjectPointer nextObject = null;
    if (!_cache.eq(0)) {
        /* TODO: lpnguyen, Note that numberOfTrailingZeros in java refers == numberOfLeadingZeros in C verison of this.. */
        int trailingZeros = _cache.numberOfTrailingZeros();
        long slotsToSkip = (trailingZeros * MM_HeapMap.J9MODRON_HEAP_SLOTS_PER_HEAPMAP_BIT);
        _heapSlotCurrent = _heapSlotCurrent.add(slotsToSkip);
        _cache = _cache.rightShift(trailingZeros);
        nextObject = J9ObjectPointer.cast(_heapSlotCurrent);
        /* skip to the next bit in _heapSlotCurrent and in _cache */
        _heapSlotCurrent = _heapSlotCurrent.add(MM_HeapMap.J9MODRON_HEAP_SLOTS_PER_HEAPMAP_BIT);
        _cache = _cache.rightShift(1);
    }
    return nextObject;
}
Also used : 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