use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class MM_HeapRegionDescriptorHelper method getHighAddress.
public static VoidPointer getHighAddress(MM_HeapRegionDescriptorPointer region) throws CorruptDataException {
VoidPointer result = VoidPointer.NULL;
long regionsInSpan = region._regionsInSpan().longValue();
if (regionsInSpan == 0) {
result = region._highAddress();
} else {
UDATA low = UDATA.cast(region._lowAddress());
UDATA high = UDATA.cast(region._highAddress());
UDATA delta = high.sub(low);
UDATA spanningSize = delta.mult((int) regionsInSpan);
result = VoidPointer.cast(low.add(spanningSize));
}
return result;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class RamClassWalker method allSlotsInRAMStaticsDo.
private void allSlotsInRAMStaticsDo() throws CorruptDataException {
if (ramClass.ramStatics().isNull()) {
return;
}
Iterator<?> ofoIterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(ramClass, J9ClassHelper.superclass(ramClass), new U32(J9ROMFieldOffsetWalkState.J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC));
J9ObjectFieldOffset fields = null;
while (ofoIterator.hasNext()) {
fields = (J9ObjectFieldOffset) ofoIterator.next();
J9ROMFieldShapePointer field = fields.getField();
String info = fields.getName();
U32 modifiers = field.modifiers();
UDATAPointer fieldAddress = ramClass.ramStatics().addOffset(fields.getOffsetOrAddress());
String additionalInfo = modifiers.anyBitsIn(J9FieldFlagObject) ? "!j9object" : "";
if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(fieldAddress), info, additionalInfo);
} else {
classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, fieldAddress, info, additionalInfo);
}
}
U32 staticSlotCount = ramClass.romClass().objectStaticCount().add(ramClass.romClass().singleScalarStaticCount());
if (J9BuildFlags.env_data64) {
staticSlotCount = staticSlotCount.add(ramClass.romClass().doubleScalarStaticCount());
} else {
staticSlotCount = staticSlotCount.add(1).bitAnd(~1L).add(ramClass.romClass().doubleScalarStaticCount().mult(2));
}
UDATA size = Scalar.convertSlotsToBytes(new UDATA(staticSlotCount));
classWalkerCallback.addSection(clazz, ramClass.ramStatics(), size.longValue(), "Ram static", false);
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class ClassloadersSummaryCommand method getStat.
public Collection<ClassloadersSummaryNode> getStat() throws CorruptDataException {
Map<J9ClassLoaderPointer, Counter> classloadersCount = new HashMap<J9ClassLoaderPointer, Counter>();
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
GCClassLoaderIterator iterator = GCClassLoaderIterator.from();
while (iterator.hasNext()) {
J9ClassLoaderPointer classLoader = iterator.next();
classloadersCount.put(classLoader, new Counter(0));
}
/* Iterate through all classes and count how many were loaded by each classLoader */
ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
Counter counter = classloadersCount.get(classPointer.classLoader());
if (counter != null) {
counter.addOne();
} else {
classloadersCount.put(classPointer.classLoader(), new Counter(1));
}
}
J9ObjectPointer sys = vm.systemClassLoader().classLoaderObject();
final UDATA valueROM = new UDATA(J9MemorySegment.MEMORY_TYPE_ROM_CLASS);
final UDATA valueRAM = new UDATA(J9MemorySegment.MEMORY_TYPE_RAM_CLASS);
Map<String, ClassloadersSummaryNode> classloaders = new LinkedHashMap<String, ClassloadersSummaryNode>();
for (Map.Entry<J9ClassLoaderPointer, Counter> entry : classloadersCount.entrySet()) {
J9ObjectPointer classLoaderObject = entry.getKey().classLoaderObject();
boolean isSystem = classLoaderObject.equals(sys);
String loader = isSystem ? "*System*" : J9ObjectHelper.getClassName(classLoaderObject);
/* For each classloader, iterate through each associated memory segment and identify whether it is
* a ROM or a RAM type memory segment */
long romSegmentCount = 0;
long ramSegmentCount = 0;
long romSegmentAllocatedMem = 0;
long ramSegmentAllocatedMem = 0;
J9MemorySegmentPointer segment = entry.getKey().classSegments();
while (segment.notNull()) {
if ((segment.type().bitAnd(valueROM)).equals(valueROM)) {
romSegmentCount += 1;
romSegmentAllocatedMem += segment.size().longValue();
} else if ((segment.type().bitAnd(valueRAM)).equals(valueRAM)) {
ramSegmentCount += 1;
ramSegmentAllocatedMem += segment.size().longValue();
}
segment = segment.nextSegmentInClassLoader();
}
ClassloadersSummaryNode cpentry = classloaders.get(loader);
if (cpentry == null) {
// If the classLoader is not in the list, add it with "# Classloaders = 1" and "# Loaded Classes = classesLoaded"
classloaders.put(loader, new ClassloadersSummaryNode(loader, 1L, entry.getValue().getCount(), ramSegmentCount, romSegmentCount, romSegmentAllocatedMem, ramSegmentAllocatedMem));
} else {
// If the classLoader is in the list, increment "# Classloaders" by 1 and increment "# Loaded Classes" by classesLoaded
cpentry.numClassloaders += 1;
cpentry.numLoadedClasses += entry.getValue().getCount();
cpentry.ramSegmentCounter += ramSegmentCount;
cpentry.romSegmentCounter += romSegmentCount;
cpentry.totalROMSegmentAllocatedMemory += romSegmentAllocatedMem;
cpentry.totalRAMSegmentAllocatedMemory += ramSegmentAllocatedMem;
}
}
return classloaders.values();
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class WhatIsCommand method checkPointer.
private boolean checkPointer(SearchStack searchStack, AbstractPointer ptr) {
UDATA cmpValue = UDATA.cast(ptr);
if (searchValue.eq(cmpValue)) {
if (++foundCount > skipCount) {
out.print("Found " + searchValue.getHexValue() + " as " + ptr.formatShortInteractive() + ": ");
searchStack.dump(out);
out.println();
return true;
}
} else {
updateClosest(searchStack, cmpValue);
}
return false;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class WhatIsCommand method checkScalar.
private boolean checkScalar(SearchStack searchStack, Scalar s) {
UDATA cmpValue = new UDATA(s);
if (searchValue.eq(s)) {
if (++foundCount > skipCount) {
out.print("Found " + searchValue.getHexValue() + " as " + s + ": ");
searchStack.dump(out);
out.println();
return true;
}
} else {
updateClosest(searchStack, cmpValue);
}
return false;
}
Aggregations