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);
}
}
}
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()]);
}
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;
}
}
Aggregations