use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeInTree.
private VoidPointer hashTableFindNodeInTree(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
J9AVLTreePointer tree = avlTreeUntag(head.at(0));
AVLTree avlTree = AVLTree.fromJ9AVLTreePointer(tree, _avlTreeComparatorFunction);
J9AVLTreeNodePointer searchResult = avlTree.search(UDATA.cast(entry));
if (searchResult.notNull()) {
return avlNodeToData(searchResult);
} else {
return VoidPointer.NULL;
}
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeInList.
private VoidPointer hashTableFindNodeInList(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
/* Look through the list looking for the correct key */
VoidPointer node = head.at(0);
StructType currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
while ((!node.isNull()) && (!_equalFunctionWrapper.equal(currentStruct, entry))) {
node = nextEA(node).at(0);
currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
}
return VoidPointer.cast(currentStruct);
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class Pool_29_V0 method hasNext.
@SuppressWarnings("unchecked")
public boolean hasNext() {
// prevents multiple calls to hasNext() walking the pool further.
if (nextStruct != null) {
return true;
}
try {
// any handlers are likely to have been installed.
if (!inited) {
// start the pool walk
nextItem = pool_startDo();
} else {
// continue the pool walk
nextItem = pool_nextDo();
}
} catch (CorruptDataException e) {
// cannot try to recover from this
raiseCorruptDataEvent("Error creating iterator", e, true);
// make the pool look empty
nextItem = null;
} finally {
// make sure we don't do this again
inited = true;
}
while ((nextItem != null) && nextItem.notNull()) {
try {
if (!isInline) {
PointerPointer ptr = PointerPointer.cast(nextItem);
nextItem = ptr.at(0);
}
nextStruct = (StructType) DataType.getStructure(structType, nextItem.getAddress());
} catch (CorruptDataException e) {
// may be able to recover from this
raiseCorruptDataEvent("Error getting next pool item", e, false);
}
if (nextStruct != null) {
// Found an item, move on.
break;
} else {
// the next item in the pool.
try {
// continue the pool walk
nextItem = pool_nextDo();
} catch (CorruptDataException e) {
// cannot try to recover from this
raiseCorruptDataEvent("Error creating iterator", e, true);
// make the pool look empty
nextItem = null;
}
}
}
return nextStruct != null;
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class MonitorTableList method initializeCaches.
private static synchronized void initializeCaches() throws CorruptDataException {
if (!initialized) {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
PointerPointer cursor = vm.monitorTables();
int count = vm.monitorTableCount().intValue();
monitorTables = new MonitorTable[count];
for (int i = 0; i < count; i++) {
J9MonitorTableListEntryPointer entries = vm.monitorTableList();
while (entries.notNull()) {
if (entries.monitorTable().eq(cursor.at(i))) {
monitorTables[i] = MonitorTable.from(entries);
break;
}
entries = entries.next();
}
}
initialized = true;
}
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer 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.");
}
};
}
Aggregations