Search in sources :

Example 21 with J9MemorySegmentPointer

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

the class SegmentTree method findSegment.

private J9MemorySegmentPointer findSegment(int start, int end, AbstractPointer key) throws CorruptDataException {
    if ((end - start) < 4) {
        // Linear search small ranges
        return linearSearch(start, end, key);
    } else {
        // Binary search
        int mid = (start + end) / 2;
        J9MemorySegmentPointer segment = cache[mid];
        if (key.gte(segment.heapBase())) {
            if (key.lt(segment.heapAlloc())) {
                return segment;
            } else {
                return findSegment(mid, end, key);
            }
        } else {
            return findSegment(start, mid, key);
        }
    }
}
Also used : J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)

Example 22 with J9MemorySegmentPointer

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

the class SegmentTree method setSegmentList.

protected void setSegmentList(J9MemorySegmentListPointer segmentList) {
    ArrayList<J9MemorySegmentPointer> segments = new ArrayList<J9MemorySegmentPointer>();
    try {
        // Batch up the entries
        GCSegmentIterator iterator = GCSegmentIterator.fromJ9MemorySegmentList(segmentList, 0);
        while (iterator.hasNext()) {
            segments.add(iterator.next());
        }
    } catch (CorruptDataException e) {
        EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
        cache = new J9MemorySegmentPointer[0];
    }
    // And sort them
    Collections.sort(segments, new Comparator<J9MemorySegmentPointer>() {

        public int compare(J9MemorySegmentPointer seg1, J9MemorySegmentPointer seg2) {
            try {
                return seg1.eq(seg2) ? 0 : seg1.heapBase().lt(seg2.heapBase()) ? -1 : 1;
            } catch (CorruptDataException e) {
                EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
                return -1;
            }
        }
    });
    cache = segments.toArray(new J9MemorySegmentPointer[segments.size()]);
}
Also used : ArrayList(java.util.ArrayList) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) GCSegmentIterator(com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)

Example 23 with J9MemorySegmentPointer

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

Aggregations

J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)17 CorruptDataException (com.ibm.j9ddr.CorruptDataException)7 GCSegmentIterator (com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)7 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)7 GCClassHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator)6 MemorySegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.MemorySegmentIterator)4 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)4 UDATA (com.ibm.j9ddr.vm29.types.UDATA)4 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)2 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)2 ArrayList (java.util.ArrayList)2 NoSuchElementException (java.util.NoSuchElementException)2 GCClassIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassIterator)1 GCClassIteratorClassSlots (com.ibm.j9ddr.vm29.j9.gc.GCClassIteratorClassSlots)1 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)1 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)1 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)1 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)1 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1 J9JITDataCacheHeaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITDataCacheHeaderPointer)1