Search in sources :

Example 1 with J9DDRImageSection

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);
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 2 with J9DDRImageSection

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();
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 3 with J9DDRImageSection

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);
}
Also used : U64(com.ibm.j9ddr.vm29.types.U64) GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) MemoryCategoryIterator(com.ibm.j9ddr.vm29.j9.walkers.MemoryCategoryIterator) J9DDRDTFJUtils.corruptIterator(com.ibm.j9ddr.view.dtfj.J9DDRDTFJUtils.corruptIterator) J9MemTagIterator(com.ibm.j9ddr.vm29.j9.walkers.J9MemTagIterator) Iterator(java.util.Iterator) DTFJMonitorIterator(com.ibm.j9ddr.vm29.view.dtfj.java.j9.DTFJMonitorIterator) ImageSection(com.ibm.dtfj.image.ImageSection) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection) LinkedList(java.util.LinkedList) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 4 with J9DDRImageSection

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);
    }
}
Also used : J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection) ImageSection(com.ibm.dtfj.image.ImageSection) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) LinkedList(java.util.LinkedList) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 5 with J9DDRImageSection

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();
}
Also used : J9JITExceptionTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Aggregations

J9DDRImageSection (com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)6 CorruptData (com.ibm.dtfj.image.CorruptData)5 ImageSection (com.ibm.dtfj.image.ImageSection)2 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)2 LinkedList (java.util.LinkedList)2 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)1 JavaObject (com.ibm.dtfj.java.JavaObject)1 J9DDRDTFJUtils.corruptIterator (com.ibm.j9ddr.view.dtfj.J9DDRDTFJUtils.corruptIterator)1 J9JavaStackIterator (com.ibm.j9ddr.vm29.j9.J9JavaStackIterator)1 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)1 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)1 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)1 J9MemTagIterator (com.ibm.j9ddr.vm29.j9.walkers.J9MemTagIterator)1 MemoryCategoryIterator (com.ibm.j9ddr.vm29.j9.walkers.MemoryCategoryIterator)1 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1 J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)1 J9JavaStackPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaStackPointer)1 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)1 U64 (com.ibm.j9ddr.vm29.types.U64)1 UDATA (com.ibm.j9ddr.vm29.types.UDATA)1