use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method visitWatchersBefore.
@SuppressWarnings("try")
private void visitWatchersBefore() {
final Log trace = Log.noopLog().string("[GCImpl.visitWatchersBefore:").newline();
trace.string(" Watchers before: ");
try (Timer wbt = watchersBeforeTimer.open()) {
for (CollectionWatcher watcher = collectionWatcherList.getFirst(); watcher != null; watcher = watcher.getNextElement()) {
try {
watcher.beforeCollection();
} catch (Throwable t) {
trace.string("[GCImpl.visitWatchersBefore: Caught: ").string(t.getClass().getName()).string("]").newline();
}
}
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method scavenge.
/**
* Scavenge, either just from dirty roots or from all roots.
*
* Process discovered references while scavenging.
*/
@SuppressWarnings("try")
private void scavenge(boolean fromDirtyRoots) {
final Log trace = Log.noopLog().string("[GCImpl.scavenge:").string(" fromDirtyRoots: ").bool(fromDirtyRoots).newline();
/* Empty the list of DiscoveredReferences before walking the heap. */
DiscoverableReferenceProcessing.clearDiscoveredReferences();
try (Timer rst = rootScanTimer.open()) {
trace.string(" Cheney scan: ");
if (fromDirtyRoots) {
cheneyScanFromDirtyRoots();
} else {
cheneyScanFromRoots();
}
}
trace.string(" Discovered references: ");
/* Process the list of DiscoveredReferences after walking the heap. */
try (Timer drt = discoverableReferenceTimer.open()) {
DiscoverableReferenceProcessing.processDiscoveredReferences();
}
trace.string(" Release spaces: ");
/* Release any memory in the young and from Spaces. */
try (Timer rst = releaseSpacesTimer.open()) {
releaseSpaces();
}
trace.string(" Swap spaces: ");
/* Exchange the from and to Spaces. */
swapSpaces();
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method releaseSpaces.
private void releaseSpaces() {
final Log trace = Log.noopLog().string("[GCImpl.releaseSpaces:");
final HeapImpl heap = HeapImpl.getHeapImpl();
heap.getYoungGeneration().releaseSpaces();
if (completeCollection) {
heap.getOldGeneration().releaseSpaces();
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method walkRegisteredObjectReferences.
@SuppressWarnings("try")
private void walkRegisteredObjectReferences() {
final Log trace = Log.noopLog().string("[walkRegisteredObjectReferences").string(":").newline();
try (Timer wrm = walkRegisteredMemoryTimer.open()) {
/*
* ObjectReferenceWalkers should be pinned, otherwise they might already be forwarded.
* Walk the list as Object so there is no type checking until I know it is safe.
*/
Object element = objectReferenceWalkerList.getFirstObject();
while (element != null) {
if (!HeapImpl.getHeapImpl().isPinned(element)) {
throw unpinnedObjectReferenceWalkerException;
}
element = ((AllocationFreeList.Element<?>) element).getNextObject();
}
/* Visit each walker. */
for (ObjectReferenceWalker walker = objectReferenceWalkerList.getFirst(); walker != null; walker = walker.getNextElement()) {
trace.string("[").string(walker.getWalkerName()).string(":");
trace.newline();
walker.walk(greyToBlackObjRefVisitor);
trace.string("]").newline();
}
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method collectImpl.
@SuppressWarnings("try")
private void collectImpl(String cause) {
final Log trace = Log.noopLog().string("[GCImpl.collectImpl:").newline().string(" epoch: ").unsigned(getCollectionEpoch()).string(" cause: ").string(cause).newline();
VMOperation.guaranteeInProgress("Collection should be a VMOperation.");
final HeapImpl heap = HeapImpl.getHeapImpl();
precondition();
/*
* Disable young generation allocations *inside* the collector, and detect any that slip in.
*/
trace.string(" Begin collection: ");
try (NoAllocationVerifier nav = noAllocationVerifier.open()) {
trace.string(" Verify before: ");
try (Timer vbt = verifyBeforeTimer.open()) {
HeapImpl.getHeapImpl().verifyBeforeGC(cause, getCollectionEpoch());
}
getAccounting().beforeCollection();
try (Timer ct = collectionTimer.open()) {
/*
* Always scavenge the young generation, then maybe scavenge the old generation.
* Scavenging the young generation will free up the chunks from the young
* generation, so that when the scavenge of the old generation needs chunks it will
* find them on the free list.
*
*/
if (getPolicy().collectIncrementally()) {
scavenge(true);
}
completeCollection = getPolicy().collectCompletely();
if (completeCollection) {
scavenge(false);
}
}
/* Distribute any discovered references to their queues. */
DiscoverableReferenceProcessing.Scatterer.distributeReferences();
}
getAccounting().afterCollection(completeCollection, collectionTimer);
trace.string(" Verify after: ");
try (Timer vat = verifyAfterTimer.open()) {
heap.verifyAfterGC(cause, getCollectionEpoch());
}
postcondition();
trace.string("]").newline();
}
Aggregations