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;
}
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);
}
}
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.");
}
};
}
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());
}
}
}
}
}
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;
}
Aggregations