use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.
the class RootScanner method scanNonCollectableObjectsInternal.
private void scanNonCollectableObjectsInternal(long memoryType) throws CorruptDataException {
GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
while (regionIterator.hasNext()) {
GCHeapRegionDescriptor region = regionIterator.next();
if (new UDATA(region.getTypeFlags()).allBitsIn(memoryType)) {
GCObjectHeapIterator objectIterator = GCObjectHeapIterator.fromHeapRegionDescriptor(region, true, false);
while (objectIterator.hasNext()) {
J9ObjectPointer object = objectIterator.next();
doClassSlot(J9ObjectHelper.clazz(object));
GCObjectIterator fieldIterator = GCObjectIterator.fromJ9Object(object, true);
GCObjectIterator fieldAddressIterator = GCObjectIterator.fromJ9Object(object, true);
while (fieldIterator.hasNext()) {
doNonCollectableObjectSlot(fieldIterator.next(), fieldAddressIterator.nextAddress());
}
}
}
}
}
use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.
the class GCHeapRegionIterator method from.
public static GCHeapRegionIterator from() throws CorruptDataException {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
MM_GCExtensionsPointer gcext = GCExtensions.getGCExtensionsPointer();
MM_HeapRegionManagerPointer hrm = gcext.heapRegionManager();
return fromMMHeapRegionManager(hrm, true, true);
}
use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.
the class ACCommand method dumpOwnedRegions.
private void dumpOwnedRegions(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
if (GCExtensions.isVLHGC()) {
Table table = new Table("Regions Owned by AC " + allocationContext.getHexAddress());
table.row("Region", "containsObjects");
GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
while (regionIterator.hasNext()) {
GCHeapRegionDescriptor region = regionIterator.next();
MM_HeapRegionDescriptorVLHGCPointer vlhgcRegion = MM_HeapRegionDescriptorVLHGCPointer.cast(region.getHeapRegionDescriptorPointer());
MM_AllocationContextTarokPointer currentAllocationContextTarok = vlhgcRegion._allocateData()._owningContext();
if (currentAllocationContextTarok.eq(allocationContext)) {
table.row("!mm_heapregiondescriptorvlhgc " + vlhgcRegion.getHexAddress(), Boolean.toString(region.containsObjects()));
}
}
table.render(out);
}
}
use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.
the class DumpAllRegionsCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
boolean statsRequested = false;
boolean skipReport = false;
if (0 != args.length) {
String argument = args[0];
if (argument.equalsIgnoreCase("help")) {
help(out);
return;
}
statsRequested = argument.equalsIgnoreCase("stats");
skipReport = statsRequested;
}
try {
GCHeapRegionIterator gcHeapRegionIterator = GCHeapRegionIterator.from();
int[] stats = new int[regionTypesString.length];
int total = 0;
String header1, header2, header3;
String footer;
String formatString;
String regionType;
initializeStats(stats);
if (J9BuildFlags.env_data64) {
header1 = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
header2 = "| region | start | end | subspace | flags | size | region type \n";
header3 = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
formatString = " %016x %016x %016x %016x %08x %16x %s\n";
footer = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
} else {
header1 = "+--------+--------+--------+--------+--------+--------+----------------------\n";
header2 = "| region | start | end |subspace| flags | size | region type \n";
header3 = "+--------+--------+--------+--------+--------+--------+----------------------\n";
formatString = " %08x %08x %08x %08x %08x %8x %s\n";
footer = "+--------+--------+--------+--------+--------+--------+----------------------\n";
}
if (!skipReport) {
out.append(header1);
out.append(header2);
out.append(header3);
}
while (gcHeapRegionIterator.hasNext()) {
GCHeapRegionDescriptor heapRegionDescriptor = gcHeapRegionIterator.next();
int index = (int) heapRegionDescriptor.getRegionType();
total += 1;
if (index < regionTypesString.length) {
regionType = regionTypesString[index];
stats[index] += 1;
} else {
regionType = "Unknown";
}
if (!skipReport) {
out.append(String.format(formatString, heapRegionDescriptor.getHeapRegionDescriptorPointer().getAddress(), heapRegionDescriptor.getLowAddress().getAddress(), heapRegionDescriptor.getHighAddress().getAddress(), heapRegionDescriptor.getSubSpace().getAddress(), heapRegionDescriptor.getTypeFlags().longValue(), heapRegionDescriptor.getSize().longValue(), regionType));
}
}
if (!skipReport) {
out.append(footer);
}
if (statsRequested) {
String formatStringStats = " \t%s: %d\n";
for (int i = 0; i < regionTypesString.length; i++) {
if (0 != stats[i]) {
out.append(String.format(formatStringStats, regionTypesString[i], stats[i]));
}
}
out.append(String.format(formatStringStats, "++++ TOTAL", total));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.
the class ObjectSizeInfo method scanHeap.
private void scanHeap() {
try {
GCHeapRegionIterator regions = GCHeapRegionIterator.from();
while (regions.hasNext()) {
GCHeapRegionDescriptor region = regions.next();
scanObjects(region);
}
} catch (CorruptDataException e) {
e.printStackTrace();
}
}
Aggregations