use of com.ibm.j9ddr.vm29.pointer.VoidPointer 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.VoidPointer 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.VoidPointer in project openj9 by eclipse.
the class SimpleRootScanner method doMonitorReference.
@Override
protected void doMonitorReference(J9ObjectMonitorPointer slot, VoidPointer address) {
try {
J9ThreadAbstractMonitorPointer monitor = J9ThreadAbstractMonitorPointer.cast(slot.monitor());
doSlot(J9ObjectPointer.cast(monitor.userData()), VoidPointer.cast(monitor.userDataEA()));
} catch (CorruptDataException e) {
EventManager.raiseCorruptDataEvent("Errror accessing object slot from J9ObjectMonitorPointer: " + slot.getHexAddress(), e, false);
}
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class Pool_29_V0 method pool_nextDo.
// re-uses the existing state
private VoidPointer pool_nextDo() throws CorruptDataException {
slot = 1 + state.lastSlot;
UDATAPointer currAddr = null;
if (state.leftToDo == 0) {
if ((state.currentPuddle != null) && (state.currentPuddle.notNull())) {
return poolPuddle_startDo(state.currentPuddle, true);
} else {
return null;
}
}
while (isPuddleSlotFree(state.currentPuddle)) {
slot++;
}
currAddr = UDATAPointer.cast(state.currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
state.lastSlot = slot;
state.leftToDo--;
if (state.leftToDo == 0) {
if ((state.flags & POOLSTATE_FOLLOW_NEXT_POINTERS) == POOLSTATE_FOLLOW_NEXT_POINTERS) {
state.currentPuddle = state.currentPuddle.nextPuddle();
state.lastSlot = -1;
} else {
state.currentPuddle = null;
}
}
logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
if (logger.isLoggable(Level.FINER)) {
logger.finer(state.toString());
}
return VoidPointer.cast(currAddr);
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer 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