use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class MarkMapCommand method fromBits.
protected void fromBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
UDATAPointer markSlot = UDATAPointer.cast(address);
UDATAPointer base = markMap.getHeapMapBits();
UDATA maxOffset = markMap.getSlotIndexAndMask(J9ObjectPointer.cast(markMap.getHeapTop().subOffset(markMap.getObjectGrain())))[0];
maxOffset = maxOffset.add(1);
UDATAPointer top = base.add(maxOffset);
if (markSlot.gte(base) && markSlot.lte(top)) {
IDATA delta = markSlot.sub(base);
int pageSize = markMap.getPageSize(null);
// obviously not right for metronome
delta = delta.mult(pageSize);
J9ObjectPointer rangeBase = J9ObjectPointer.cast(markMap.getHeapBase().addOffset(delta));
J9ObjectPointer rangeTop = rangeBase.addOffset(pageSize);
out.format("Mark bits at %s corresponds to heap range %s -> %s\n", markSlot.getHexAddress(), rangeBase.getHexAddress(), rangeTop.getHexAddress());
} else {
out.format("Address %s is not in the mark map\n", markSlot.getHexAddress());
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class MarkMapCommand method markBits.
protected void markBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
J9ObjectPointer object = J9ObjectPointer.cast(address);
J9ObjectPointer base = J9ObjectPointer.cast(address).untag(markMap.getPageSize(object) - 1);
J9ObjectPointer top = base.addOffset(markMap.getPageSize(object));
MarkedObject[] result = markMap.queryRange(base, top);
if (result.length > 0) {
if (result[0].wasRelocated()) {
out.format("Mark bits for the compacted range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
} else {
out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
}
} else {
/* Either outside the heap, or just nothing there */
try {
UDATA[] indexAndMask = markMap.getSlotIndexAndMask(base);
UDATAPointer markBitsSlot = markMap.getHeapMapBits().add(indexAndMask[0]);
out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), markBitsSlot.getHexAddress());
} catch (IllegalArgumentException ex) {
out.format("Object %s is not in the heap\n", object.getHexAddress());
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class WalkInternTableCommand method printSharedTableStructure.
/**
* typedef struct J9SharedInvariantInternTable {
* UDATA (*performNodeAction)(struct J9SharedInvariantInternTable *sharedInvariantInternTable, struct J9SharedInternSRPHashTableEntry *node, UDATA action, void* userData);
* UDATA flags;
* omrthread_monitor_t *tableInternFxMutex;
* struct J9SRPHashTable* sharedInvariantSRPHashtable;
* struct J9SharedInternSRPHashTableEntry* headNode;
* struct J9SharedInternSRPHashTableEntry* tailNode;
* J9SRP* sharedTailNodePtr;
* J9SRP* sharedHeadNodePtr;
* U_32* totalSharedNodesPtr;
* U_32* totalSharedWeightPtr;
* struct J9ClassLoader* systemClassLoader;
*} J9SharedInvariantInternTable;
*
* typedef struct J9SRPHashTable {
* const char* tableName;
* struct J9SRPHashTableInternal* srpHashtableInternal;
* UDATA (*hashFn)(void *key, void *userData);
* UDATA (*hashEqualFn)(void *existingEntry,void *key, void *userData);
* void (*printFn)(J9PortLibrary *portLibrary, void *key, void *userData);
* struct J9PortLibrary* portLibrary;
* void* functionUserData;
* UDATA flags;
* } J9SRPHashTable;
*
* typedef struct J9SRPHashTableInternal {
* U_32 tableSize;
* U_32 numberOfNodes;
* U_32 entrySize;
* U_32 nodeSize;
* U_32 flags;
* J9SRP nodes;
* J9SRP nodePool;
* } J9SRPHashTableInternal;
*
* Prints the info for three VM structures that are shown above and used for shared intern table.
* 1. J9SharedInvariantInternTable
* 2. J9SRPHashTable
* 3. J9SRPHashTableInternal
*
* @param out PrintStream
* @throws CorruptDataException
* @return void
*/
private void printSharedTableStructure(PrintStream out) throws CorruptDataException {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9SharedInvariantInternTablePointer sharedInternTable;
sharedInternTable = vm.sharedInvariantInternTable();
if (!sharedInternTable.isNull()) {
out.println(sharedInternTable.formatFullInteractive());
}
out.append("Total Shared Weight : " + sharedInternTable.totalSharedWeightPtr().at(0).longValue() + nl);
J9SRPHashTablePointer srphashtable = sharedInternTable.sharedInvariantSRPHashtable();
if (!srphashtable.isNull()) {
out.println(srphashtable.formatFullInteractive());
}
J9SRPHashTableInternalPointer srpHashTableInternal = srphashtable.srpHashtableInternal();
if (!srpHashTableInternal.isNull()) {
out.println(srpHashTableInternal.formatFullInteractive());
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class VmCheckCommand method verifyJ9ClassSubclassHierarchy.
private boolean verifyJ9ClassSubclassHierarchy(J9JavaVMPointer javaVM, PrintStream out, J9ClassPointer classPointer) throws CorruptDataException {
int index = 0;
UDATA rootDepth = J9ClassHelper.classDepth(classPointer);
J9ClassPointer currentClass = classPointer;
boolean done = false;
while (!done) {
J9ClassPointer nextSubclass = currentClass.subclassTraversalLink();
if (nextSubclass.isNull()) {
reportError(out, "class=0x%s had NULL entry in subclassTraversalLink list at index=%d following class=0x%s", Long.toHexString(classPointer.getAddress()), index, Long.toHexString(currentClass.getAddress()));
return false;
}
/* Sanity check the nextSubclass. */
if (!verifyJ9ClassHeader(javaVM, out, nextSubclass)) {
return false;
}
if (J9ClassHelper.classDepth(nextSubclass).lte(rootDepth)) {
done = true;
} else {
currentClass = nextSubclass;
index++;
}
}
return true;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class CheckEngine method checkJ9LinkedFreeHeader.
/**
* Verify the integrity of an GCHeapLinkedFreeHeader (hole) on the heap.
* Checks various aspects of hole integrity.
*
* @param hole Pointer to the hole
* @param segment The segment containing the pointer
* @param checkFlags Type/level of verification
*
* @return @ref GCCheckWalkStageErrorCodes
* @throws CorruptDataException
*
* @see @ref checkFlags
*/
private int checkJ9LinkedFreeHeader(GCHeapLinkedFreeHeader hole, GCHeapRegionDescriptor regionDesc, int checkFlags) throws CorruptDataException {
J9ObjectPointer object = hole.getObject();
if (ObjectModel.isSingleSlotDeadObject(object)) {
/* TODO: we can add warning here if header of single slot hole is not standard (0s or fs) */
return J9MODRON_GCCHK_RC_OK;
}
UDATA holeSize = hole.getSize();
/* Hole size can not be 0 */
if (holeSize.eq(0)) {
return J9MODRON_GCCHK_RC_DEAD_OBJECT_SIZE;
}
/* Hole size must be aligned */
if (holeSize.anyBitsIn(J9MODRON_GCCHK_J9OBJECT_ALIGNMENT_MASK)) {
return J9MODRON_GCCHK_RC_DEAD_OBJECT_SIZE_NOT_ALIGNED;
}
UDATA regionStart = UDATA.cast(regionDesc.getLowAddress());
UDATA regionEnd = regionStart.add(regionDesc.getSize());
UDATA delta = regionEnd.sub(UDATA.cast(object));
/* Hole does not fit region */
if (delta.lt(holeSize)) {
return J9MODRON_GCCHK_RC_INVALID_RANGE;
}
GCHeapLinkedFreeHeader nextHole = hole.getNext();
J9ObjectPointer nextObject = nextHole.getObject();
if (!nextObject.isNull()) {
/* Next must be a hole */
if (!ObjectModel.isDeadObject(nextObject)) {
return J9MODRON_GCCHK_RC_DEAD_OBJECT_NEXT_IS_NOT_HOLE;
}
/* Next should point to the same region */
if (regionStart.gt(UDATA.cast(nextObject)) || regionEnd.lte(UDATA.cast(nextObject))) {
return J9MODRON_GCCHK_RC_DEAD_OBJECT_NEXT_IS_NOT_IN_REGION;
}
/* next should not point to inside the hole */
if (holeSize.add(UDATA.cast(object)).gt(UDATA.cast(nextObject)) && object.lt(nextObject)) {
return J9MODRON_GCCHK_RC_DEAD_OBJECT_NEXT_IS_POINTED_INSIDE;
}
}
return J9MODRON_GCCHK_RC_OK;
}
Aggregations