use of com.ibm.j9ddr.vm29.pointer.Pointer 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.Pointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getDataSizeInBytes.
/**
* Returns the size of data in an indexable object, in bytes, including leaves, excluding the header.
* @param arrayPtr Pointer to the indexable object whose size is required
* @return Size of object in bytes excluding the header
*/
public UDATA getDataSizeInBytes(J9IndexableObjectPointer array) throws CorruptDataException {
J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
U32 arrayShape = J9ROMArrayClassPointer.cast(clazz.romClass()).arrayShape();
UDATA numberOfElements = getSizeInElements(array);
UDATA size = numberOfElements.leftShift(arrayShape.bitAnd(0x0000FFFF).intValue());
return UDATA.roundToSizeofUDATA(size);
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getArrayLayout.
/**
* Get the layout for the given indexable object
* @param objPtr Pointer to a array object
* @return the ArrayLayout for objectPtr
*/
protected long getArrayLayout(J9IndexableObjectPointer array) throws CorruptDataException {
if (J9BuildFlags.gc_hybridArraylets) {
/* Trivial check for InlineContiguous. */
if (!J9IndexableObjectContiguousPointer.cast(array).size().eq(0)) {
return GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous;
}
}
/* Check if the objPtr is in the allowed arraylet range. */
if ((array.gte(arrayletRangeBase)) && (array.lt(arrayletRangeTop))) {
UDATA dataSizeInBytes = getDataSizeInBytes(array);
long layout = getArrayLayout(J9IndexableObjectHelper.clazz(array), dataSizeInBytes);
return layout;
}
return GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous;
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getSpineSize.
/**
* Get the spine size for the given indexable object
* @param objPtr Pointer to an array object
* @return The total size in bytes of objPtr's array spine;
* includes header, arraylet ptrs, and (if present) padding & inline data
*/
protected UDATA getSpineSize(J9IndexableObjectPointer array) throws CorruptDataException {
long layout = getArrayLayout(array);
boolean alignData = shouldAlignSpineDataSection(J9IndexableObjectHelper.clazz(array));
UDATA dataSize = getDataSizeInBytes(array);
UDATA numberArraylets = numArraylets(dataSize);
return getSpineSize(layout, numberArraylets, dataSize, alignData);
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method numExternalArraylets.
/**
* Return the total number of arraylets for an indexable object, not including the arraylet in the spine.
* Note that discontiugous arrays always have an empty leaf contained in the spine.
* @param array pointer to array
* @return the number of leaf arraylets
*/
protected UDATA numExternalArraylets(J9IndexableObjectPointer array) throws CorruptDataException {
UDATA numberOfArraylets = new UDATA(0);
if ((getArrayLayout(array) != GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous)) {
numberOfArraylets = numArraylets(getDataSizeInBytes(array));
numberOfArraylets = numberOfArraylets.sub(1);
}
return numberOfArraylets;
}
Aggregations