Search in sources :

Example 1 with J9JITExceptionTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer in project openj9 by eclipse.

the class JITLook method hash_jit_artifact_search.

public static J9JITExceptionTablePointer hash_jit_artifact_search(J9JITHashTablePointer table, UDATA searchValue) throws CorruptDataException {
    PointerPointer bucket;
    J9JITExceptionTablePointer entry;
    if (searchValue.gte(table.start()) && searchValue.lt(table.end())) {
        /* The search value is in this hash table */
        bucket = DETERMINE_BUCKET(searchValue, table.start(), table.buckets());
        if (bucket.at(0).notNull()) {
            /* The bucket for this search value is not empty */
            if (bucket.at(0).allBitsIn(1)) {
                // LOW_BIT_SET
                /* The bucket consists of a single low-tagged J9JITExceptionTable pointer */
                entry = J9JITExceptionTablePointer.cast(bucket.at(0));
            } else {
                /* The bucket consists of an array of J9JITExceptionTable pointers,
					 * the last of which is low-tagged */
                /* Search all but the last entry in the array */
                bucket = PointerPointer.cast(bucket.at(0));
                for (; ; bucket = bucket.add(1)) {
                    entry = J9JITExceptionTablePointer.cast(bucket.at(0));
                    if (entry.allBitsIn(1)) {
                        break;
                    }
                    if (searchValue.gte(entry.startPC()) && searchValue.lt(entry.endWarmPC()))
                        return entry;
                    if ((entry.startColdPC().longValue() != 0) && searchValue.gte(entry.startColdPC()) && searchValue.lt(entry.endPC()))
                        return entry;
                }
            }
            /* Search the last (or only) entry in the bucket, which is low-tagged */
            entry = J9JITExceptionTablePointer.cast(UDATA.cast(entry).bitAnd(new UDATA(1).bitNot()));
            if (searchValue.gte(entry.startPC()) && searchValue.lt(entry.endWarmPC()))
                return entry;
            if ((entry.startColdPC().longValue() != 0) && searchValue.gte(entry.startColdPC()) && searchValue.lt(entry.endPC()))
                return entry;
        }
    }
    return J9JITExceptionTablePointer.NULL;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9JITExceptionTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)

Example 2 with J9JITExceptionTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer in project openj9 by eclipse.

the class JITLook method jit_artifact_search.

public static J9JITExceptionTablePointer jit_artifact_search(J9AVLTreePointer tree, UDATA searchValue) throws CorruptDataException {
    /* find the right hash table to look in */
    AVLTree localTree = AVLTree.fromJ9AVLTreePointer(tree, new JITArtifactSearchCompare());
    J9JITHashTablePointer table = J9JITHashTablePointer.cast(localTree.search(searchValue));
    if (table.notNull()) {
        /* return the result of looking in the correct hash table */
        return hash_jit_artifact_search(table, searchValue);
    }
    return J9JITExceptionTablePointer.NULL;
}
Also used : J9JITHashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITHashTablePointer)

Example 3 with J9JITExceptionTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer in project openj9 by eclipse.

the class JitMetadataFromPcCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        UDATA searchValue = new UDATA(Long.decode(args[0]));
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9JITExceptionTablePointer metaData = JITLook.jit_artifact_search(vm.jitConfig().translationArtifacts(), searchValue);
        if (!metaData.isNull()) {
            dbgext_j9jitexceptiontable(out, metaData);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9JITExceptionTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 4 with J9JITExceptionTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer in project openj9 by eclipse.

the class DTFJContext method cacheJITMethodAddresses.

private static void cacheJITMethodAddresses() {
    jitMethodCache = new HashMap<J9MethodPointer, List<J9JITExceptionTablePointer>>();
    try {
        J9MemorySegmentListPointer dataCacheList = getVm().jitConfig().dataCacheList();
        J9MemorySegmentPointer dataCache = dataCacheList.nextSegment();
        while (dataCache.notNull()) {
            UDATA current = UDATA.cast(dataCache.heapBase());
            UDATA end = UDATA.cast(dataCache.heapAlloc());
            while (current.lt(end)) {
                J9JITDataCacheHeaderPointer hdr = J9JITDataCacheHeaderPointer.cast(current);
                if (hdr.type().longValue() == J9DataTypeExceptionInfo) {
                    J9JITExceptionTablePointer metaData = J9JITExceptionTablePointer.cast(current.add(J9JITDataCacheHeader.SIZEOF));
                    addMetaData(metaData);
                }
                current = current.add(hdr.size());
            }
            dataCache = dataCache.nextSegment();
        }
    } catch (CorruptDataException e) {
        return;
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9JITDataCacheHeaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITDataCacheHeaderPointer) J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9MemorySegmentListPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentListPointer) J9JITExceptionTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer) ArrayList(java.util.ArrayList) List(java.util.List) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 5 with J9JITExceptionTablePointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer 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

J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)4 UDATA (com.ibm.j9ddr.vm29.types.UDATA)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 CorruptData (com.ibm.dtfj.image.CorruptData)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 J9DDRImageSection (com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)1 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)1 J9JITDataCacheHeaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITDataCacheHeaderPointer)1 J9JITHashTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITHashTablePointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9MemorySegmentListPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentListPointer)1 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)1 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1