use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection in project openj9 by eclipse.
the class DTFJJavaHeap method getSections.
@SuppressWarnings({ "rawtypes", "unchecked" })
public Iterator getSections() {
try {
if (null == sections) {
List sectionList = new ArrayList<ImageSection>();
Iterator<GCHeapRegionDescriptor> it = regions.iterator();
while (it.hasNext()) {
try {
GCHeapRegionDescriptor region = it.next();
long base = region.getLowAddress().getAddress();
long size = region.getHighAddress().getAddress() - base;
String name = String.format("Heap extent at 0x%x (0x%x bytes)", base, size);
sectionList.add(new J9DDRImageSection(MM_HeapRegionDescriptorPointer.getProcess(), base, size, name));
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
sectionList.add(cd);
}
}
sections = sectionList;
}
return sections.iterator();
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
return corruptIterator(cd);
}
}
use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection in project openj9 by eclipse.
the class DTFJJavaMethod method getBytecodeSections.
@SuppressWarnings("rawtypes")
public Iterator getBytecodeSections() {
if (byteCodeSections == null) {
byteCodeSections = new ArrayList<Object>();
try {
J9ROMMethodPointer originalRomMethod = ROMHelp.getOriginalROMMethod(j9ramMethod);
if (!originalRomMethod.modifiers().anyBitsIn(J9JavaAccessFlags.J9AccNative)) {
U8Pointer bcStart = ROMHelp.J9_BYTECODE_START_FROM_ROM_METHOD(originalRomMethod);
UDATA bcSize = ROMHelp.J9_BYTECODE_SIZE_FROM_ROM_METHOD(originalRomMethod);
J9DDRImageSection is = DTFJContext.getImageSection(bcStart.getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
if (!j9romMethod.equals(originalRomMethod)) {
is = DTFJContext.getImageSection(j9ramMethod.bytecodes().getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
byteCodeSections.add(cd);
}
}
return byteCodeSections.iterator();
}
use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection in project openj9 by eclipse.
the class DTFJJavaRuntime method mergeSections.
/*
* Merge all the sections of the heap together to simplify range checks for
* getObjectAtAddress. (This is very important with balanced heaps where there
* are thousands of heap sections but they are actually contiguous. See PR 103197)
*/
private synchronized void mergeSections() {
// Get the list of all the heap sections.
if (mergedHeapSections != null) {
return;
}
Iterator heaps = getHeaps();
List<ImageSection> heapSections = new LinkedList<ImageSection>();
// If there are no heap sections this can't be valid.
if (!heaps.hasNext()) {
return;
}
while (heaps.hasNext()) {
DTFJJavaHeap heap = (DTFJJavaHeap) heaps.next();
Iterator sections = heap.getSections();
while (sections.hasNext()) {
heapSections.add((ImageSection) sections.next());
}
}
// Sort them.
Collections.sort(heapSections, new Comparator<ImageSection>() {
public int compare(ImageSection arg0, ImageSection arg1) {
U64 ptr0 = new U64(arg0.getBaseAddress().getAddress());
U64 ptr1 = new U64(arg1.getBaseAddress().getAddress());
// not a java long comparison.
if (ptr0.lt(ptr1)) {
return -1;
} else if (ptr0.gt(ptr1)) {
return 1;
} else {
return 0;
}
}
});
mergedHeapSections = new LinkedList<ImageSection>();
Iterator<ImageSection> itr = heapSections.iterator();
// We know we have at least one section.
ImageSection currentSection = itr.next();
while (itr.hasNext()) {
ImageSection nextSection = itr.next();
// If the sections are contiguous, merge them.
if (currentSection.getBaseAddress().getAddress() + currentSection.getSize() == nextSection.getBaseAddress().getAddress()) {
currentSection = new J9DDRImageSection(DTFJContext.getProcess(), currentSection.getBaseAddress().getAddress(), currentSection.getSize() + nextSection.getSize(), null);
} else {
mergedHeapSections.add(currentSection);
currentSection = nextSection;
}
}
mergedHeapSections.add(currentSection);
}
use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection in project openj9 by eclipse.
the class DTFJJavaObject method getSections.
public Iterator getSections() {
try {
fetchDeferredData();
LinkedList<ImageSection> sections = new LinkedList<ImageSection>();
long mainSectionSize = ObjectModel.getConsumedSizeInBytesWithHeader(object).longValue();
String name = getSectionName(mainSectionSize);
J9DDRImageSection section = DTFJContext.getImageSection(object.getAddress(), name);
section.setSize(mainSectionSize);
sections.add(section);
return sections.iterator();
} catch (CorruptDataException e) {
return corruptIterator(e.getCorruptData());
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
return corruptIterator(cd);
}
}
use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection in project openj9 by eclipse.
the class DTFJJavaMethod method getCompiledSections.
@SuppressWarnings("rawtypes")
public Iterator getCompiledSections() {
if (compiledSections == null) {
compiledSections = new ArrayList<Object>();
List<J9JITExceptionTablePointer> metaDatas = DTFJContext.getJITMetaData(j9ramMethod);
if (metaDatas != null) {
for (J9JITExceptionTablePointer metaData : metaDatas) {
// There is always a warm region
try {
long start = metaData.startPC().longValue();
long size = metaData.endWarmPC().longValue() - start;
String name = String.format("jit section (%s) at %s", metaData.getAddress(), start);
J9DDRImageSection is = DTFJContext.getImageSection(start, name);
is.setSize(size);
compiledSections.add(is);
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
compiledSections.add(cd);
}
// JEXTRACT never considered the cold region. Leading to results where JEXTRACT could report 1 section and DTFJ will report 2.
try {
long start = metaData.startColdPC().longValue();
if (start != 0) {
long size = metaData.endPC().longValue() - start;
String name = String.format("cold jit section (%s) at %s", metaData.getAddress(), start);
J9DDRImageSection is = DTFJContext.getImageSection(start, name);
is.setSize(size);
compiledSections.add(is);
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
compiledSections.add(cd);
}
}
}
}
return compiledSections.iterator();
}
Aggregations