use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class HashTable_V1 method find.
// find by pointer value
@Override
public StructType find(StructType entry) throws CorruptDataException {
UDATA hash = _hashFn.hash(entry).mod(_table.tableSize());
PointerPointer head = _table.nodes().add(hash);
VoidPointer findNode = VoidPointer.NULL;
if (_table.listNodePool().isNull()) {
PointerPointer node = hashTableFindNodeSpaceOpt(_table, entry, head);
if (node.at(0).notNull()) {
findNode = VoidPointer.cast(node);
} else {
findNode = VoidPointer.NULL;
}
} else if (head.at(0).isNull()) {
findNode = VoidPointer.NULL;
} else if (isAVLTreeTagged(head.at(0))) {
findNode = hashTableFindNodeInTree(_table, entry, head);
} else {
findNode = hashTableFindNodeInList(_table, entry, head);
}
if (!_isInline && findNode.notNull()) {
findNode = PointerPointer.cast(findNode).at(0);
}
StructType node = (StructType) DataType.getStructure(_structType, findNode.getAddress());
return node;
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeSpaceOpt.
private PointerPointer hashTableFindNodeSpaceOpt(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
PointerPointer node = head;
StructType nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
while ((node.at(0).notNull()) && (!_equalFunctionWrapper.equal(nodeStruct, entry))) {
node = node.add(1);
if (node == table.nodes().add(table.tableSize())) {
node = table.nodes();
}
nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
}
return node;
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer 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.PointerPointer in project openj9 by eclipse.
the class GCConstantPoolSlotIterator method initializeSlots_V1.
protected void initializeSlots_V1(J9ClassPointer clazz, boolean returnClassSlots, boolean returnObjectSlots) throws CorruptDataException {
U32Pointer cpDescriptionSlots = clazz.romClass().cpShapeDescription();
PointerPointer cpEntry = PointerPointer.cast(clazz.ramConstantPool());
long cpDescription = 0;
long cpEntryCount = clazz.romClass().ramConstantPoolCount().longValue();
long cpDescriptionIndex = 0;
ArrayList<AbstractPointer> slots = new ArrayList<AbstractPointer>();
ArrayList<VoidPointer> addresses = new ArrayList<VoidPointer>();
while (cpEntryCount > 0) {
if (0 == cpDescriptionIndex) {
// Load a new description word
cpDescription = cpDescriptionSlots.at(0).longValue();
cpDescriptionSlots = cpDescriptionSlots.add(1);
cpDescriptionIndex = J9_CP_DESCRIPTIONS_PER_U32;
}
long slotType = cpDescription & J9_CP_DESCRIPTION_MASK;
if ((slotType == J9CPTYPE_STRING) || (slotType == J9CPTYPE_ANNOTATION_UTF8)) {
if (returnObjectSlots) {
J9RAMStringRefPointer ref = J9RAMStringRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.stringObject();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.stringObjectEA()));
}
}
} else if (slotType == J9CPTYPE_METHOD_TYPE) {
if (returnObjectSlots) {
J9RAMMethodTypeRefPointer ref = J9RAMMethodTypeRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.type();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.typeEA()));
}
}
} else if (slotType == J9CPTYPE_METHODHANDLE) {
if (returnObjectSlots) {
J9RAMMethodHandleRefPointer ref = J9RAMMethodHandleRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.methodHandle();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.methodHandleEA()));
}
}
} else if (slotType == J9CPTYPE_CLASS) {
if (returnClassSlots) {
J9RAMClassRefPointer ref = J9RAMClassRefPointer.cast(cpEntry);
J9ClassPointer slot = ref.value();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.valueEA()));
}
}
}
cpEntry = cpEntry.addOffset(J9RAMConstantPoolItem.SIZEOF);
cpEntryCount -= 1;
cpDescription >>= J9_CP_BITS_PER_DESCRIPTION;
cpDescriptionIndex -= 1;
}
slotIterator = slots.iterator();
addressIterator = addresses.iterator();
}
use of com.ibm.j9ddr.vm29.pointer.PointerPointer in project openj9 by eclipse.
the class StackWalkerUtils method WALK_NAMED_INDIRECT_O_SLOT.
public static void WALK_NAMED_INDIRECT_O_SLOT(WalkState walkState, PointerPointer objectSlot, VoidPointer indirectSlot, String tag) throws CorruptDataException {
UDATA value;
value = UDATAPointer.cast(objectSlot).at(0);
if (indirectSlot.notNull()) {
swPrintf(walkState, 4, "\t\t{0}[{1} -> {2}] = {3}", (tag != null ? tag : "O-Slot"), indirectSlot.getHexAddress(), objectSlot.getHexAddress(), value.getHexValue());
} else {
swPrintf(walkState, 4, "\t\t{0}[{1}] = {2}", (tag != null ? tag : "O-Slot"), objectSlot.getHexAddress(), value.getHexValue());
}
walkState.callBacks.objectSlotWalkFunction(walkState.walkThread, walkState, objectSlot, VoidPointer.cast(objectSlot));
}
Aggregations