use of com.oracle.svm.core.image.ImageHeapObject in project graal by oracle.
the class AlignedChunkRememberedSet method enableRememberedSet.
@Platforms(Platform.HOSTED_ONLY.class)
public static void enableRememberedSet(HostedByteBufferPointer chunk, int chunkPosition, List<ImageHeapObject> objects) {
// Completely clean the card table and the first object table.
CardTable.cleanTable(getCardTableStart(chunk), getCardTableSize());
FirstObjectTable.initializeTable(getFirstObjectTableStart(chunk), getFirstObjectTableSize());
Pointer fotStart = getFirstObjectTableStart(chunk);
UnsignedWord objectsStartOffset = AlignedHeapChunk.getObjectsStartOffset();
for (ImageHeapObject obj : objects) {
long offsetWithinChunk = obj.getOffset() - chunkPosition;
assert offsetWithinChunk > 0 && WordFactory.unsigned(offsetWithinChunk).aboveOrEqual(objectsStartOffset);
UnsignedWord startOffset = WordFactory.unsigned(offsetWithinChunk).subtract(objectsStartOffset);
UnsignedWord endOffset = startOffset.add(WordFactory.unsigned(obj.getSize()));
FirstObjectTable.setTableForObject(fotStart, startOffset, endOffset);
// The remembered set bit in the header will be set by the code that writes the objects.
}
}
use of com.oracle.svm.core.image.ImageHeapObject in project graal by oracle.
the class ChunkedImageHeapPartition method dequeueBestFit.
private ImageHeapObject dequeueBestFit(NavigableMap<Long, Queue<ImageHeapObject>> objects, long nbytes) {
if (nbytes < minimumObjectSize) {
return null;
}
Map.Entry<Long, Queue<ImageHeapObject>> entry = objects.floorEntry(nbytes);
if (entry == null) {
return null;
}
Queue<ImageHeapObject> queue = entry.getValue();
ImageHeapObject info = queue.remove();
if (queue.isEmpty()) {
objects.remove(entry.getKey());
}
return info;
}
use of com.oracle.svm.core.image.ImageHeapObject in project graal by oracle.
the class ChunkedImageHeapPartition method createSortedObjectsMap.
private static NavigableMap<Long, Queue<ImageHeapObject>> createSortedObjectsMap(List<ImageHeapObject> objects) {
ImageHeapObject[] sorted = objects.toArray(new ImageHeapObject[0]);
Arrays.sort(sorted, new SizeComparator());
NavigableMap<Long, Queue<ImageHeapObject>> map = new TreeMap<>();
Queue<ImageHeapObject> currentQueue = null;
long currentObjectsSize = -1;
for (ImageHeapObject obj : sorted) {
long objSize = obj.getSize();
if (objSize != currentObjectsSize) {
assert objSize > currentObjectsSize && objSize >= ConfigurationValues.getObjectLayout().getMinimumObjectSize();
currentObjectsSize = objSize;
currentQueue = new ArrayDeque<>();
map.put(currentObjectsSize, currentQueue);
}
currentQueue.add(obj);
}
return map;
}
use of com.oracle.svm.core.image.ImageHeapObject in project graal by oracle.
the class ChunkedImageHeapPartition method layoutInUnalignedChunks.
private void layoutInUnalignedChunks(ChunkedImageHeapAllocator allocator) {
allocator.finishAlignedChunk();
allocator.alignBetweenChunks(getStartAlignment());
startOffset = allocator.getPosition();
for (ImageHeapObject info : getObjects()) {
// No need to sort by size
appendAllocatedObject(info, allocator.allocateUnalignedChunkForObject(info, isWritable()));
}
allocator.alignBetweenChunks(getEndAlignment());
endOffset = allocator.getPosition();
}
use of com.oracle.svm.core.image.ImageHeapObject in project graal by oracle.
the class LinearImageHeapPartition method allocateObjects.
void allocateObjects(LinearImageHeapAllocator allocator) {
allocator.align(getStartAlignment());
startOffset = allocator.getPosition();
for (ImageHeapObject info : getObjects()) {
allocate(info, allocator);
}
allocator.align(getEndAlignment());
endOffset = allocator.getPosition();
}
Aggregations