use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method scanGreyObjects.
@SuppressWarnings("try")
private void scanGreyObjects() {
final Log trace = Log.noopLog().string("[GCImpl.scanGreyObjects").newline();
final HeapImpl heap = HeapImpl.getHeapImpl();
final OldGeneration oldGen = heap.getOldGeneration();
try (Timer sgot = scanGreyObjectsTimer.open()) {
oldGen.scanGreyObjects();
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method cheneyScanFromDirtyRoots.
@SuppressWarnings("try")
private void cheneyScanFromDirtyRoots() {
final Log trace = Log.noopLog().string("[GCImpl.cheneyScanFromDirtyRoots:").newline();
final HeapImpl heap = HeapImpl.getHeapImpl();
final OldGeneration oldGen = heap.getOldGeneration();
/*
* Move all the chunks in fromSpace to toSpace. That does not make those chunks grey, so I
* have to use the dirty cards marks to blacken them, but that's what card marks are for.
*/
try (Timer csfdrt = cheneyScanFromDirtyRootsTimer.open()) {
oldGen.emptyFromSpaceIntoToSpace();
/* Prepare to use the GreyToBlack visitors. */
final boolean objectVisitorPrologue = greyToBlackObjectVisitor.prologue();
assert objectVisitorPrologue : "greyToBlackObjectVisitor prologue fails";
final boolean objRefVisitorPrologue = greyToBlackObjRefVisitor.prologue();
assert objRefVisitorPrologue : "greyToBlackObjRefVisitor prologue fails";
/* Take a snapshot of the heap so that I can visit all the promoted Objects. */
/*
* Debugging tip: I could move the taking of the snapshot and the scanning of grey
* Objects into each of the blackening methods, or even put them around individual
* Object reference visits.
*/
prepareForPromotion();
/*
* Make sure all chunks with pinned Objects are in pinned toSpace, and any released
* objects are in toSpace (because this is an incremental collection). I do this before
* blackening any roots to make sure the Objects in pinned chunks are moved as chunks,
* not promoted by roots as individual objects. This makes the objects in those chunks
* grey.
*/
promoteAllPinnedObjects();
/*
* Blacken Objects that are dirty roots. There are dirty cards in ToSpace and
* PinnedToSpace. Do this early so I don't have to walk the cards of individually
* promoted objects, which will be visited by the grey object scanner.
*/
blackenDirtyCardRoots();
/*
* Stack references are grey at the beginning of a collection, so I need to blacken
* them.
*/
blackenStackRoots();
/* Custom memory regions which contain object references. */
walkRegisteredObjectReferences();
/*
* Native image Objects are grey at the beginning of a collection, so I need to blacken
* them.
*/
blackenBootImageRoots();
/* Visit all the Objects promoted since the snapshot, transitively. */
scanGreyObjects();
/* Reset the GreyToBlackVisitors. */
final boolean objRefVisitorEpilogue = greyToBlackObjRefVisitor.epilogue();
assert objRefVisitorEpilogue : "greyToBlackObjRefVisitor epilogue fails";
final boolean objectVisitorEpilogue = greyToBlackObjectVisitor.epilogue();
assert objectVisitorEpilogue : "greyToBlackObjectVisitor epilogue fails";
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method cheneyScanFromRoots.
@SuppressWarnings("try")
private void cheneyScanFromRoots() {
final Log trace = Log.noopLog().string("[GCImpl.cheneyScanFromRoots:").newline();
try (Timer csfrt = cheneyScanFromRootsTimer.open()) {
/* Prepare to use the GreyToBlack visitors. */
final boolean objectVisitorPrologue = greyToBlackObjectVisitor.prologue();
assert objectVisitorPrologue : "greyToBlackObjectVisitor prologue fails";
final boolean objRefVisitorPrologue = greyToBlackObjRefVisitor.prologue();
assert objRefVisitorPrologue : "greyToBlackObjRefVisitor prologue fails";
/* Take a snapshot of the heap so that I can visit all the promoted Objects. */
/*
* Debugging tip: I could move the taking of the snapshot and the scanning of grey
* Objects into each of the blackening methods, or even put them around individual
* Object reference visits.
*/
prepareForPromotion();
/*
* Make sure all chunks with pinned objects are in toSpace, and any formerly pinned
* objects are in fromSpace.
*/
promoteAllPinnedObjects();
/*
* Stack references are grey at the beginning of a collection, so I need to blacken
* them.
*/
blackenStackRoots();
/* Custom memory regions which contain object references. */
walkRegisteredObjectReferences();
/*
* Native image Objects are grey at the beginning of a collection, so I need to blacken
* them.
*/
blackenBootImageRoots();
/* Visit all the Objects promoted since the snapshot. */
scanGreyObjects();
/* Reset the GreyToBlackVisitors. */
final boolean objRefVisitorEpilogue = greyToBlackObjRefVisitor.epilogue();
assert objRefVisitorEpilogue : "greyToBlackObjRefVisitor epilogue fails";
final boolean objectVisitorEpilogue = greyToBlackObjectVisitor.epilogue();
assert objectVisitorEpilogue : "greyToBlackObjectVisitor epilogue fails";
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method blackenDirtyCardRoots.
@SuppressWarnings("try")
private void blackenDirtyCardRoots() {
final Log trace = Log.noopLog().string("[GCImpl.blackenDirtyCardRoots:").newline();
try (Timer bdcrt = blackenDirtyCardRootsTimer.open()) {
/*
* Walk To-Space looking for dirty cards, and within those for old-to-young pointers.
* Promote any referenced young objects.
*/
final HeapImpl heap = HeapImpl.getHeapImpl();
final OldGeneration oldGen = heap.getOldGeneration();
oldGen.walkDirtyObjects(greyToBlackObjectVisitor, true);
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method blackenStackRoots.
@SuppressWarnings("try")
private void blackenStackRoots() {
final Log trace = Log.noopLog().string("[GCImpl.blackenStackRoots:").newline();
try (Timer bsr = blackenStackRootsTimer.open()) {
Pointer sp = readCallerStackPointer();
trace.string("[blackenStackRoots:").string(" sp: ").hex(sp);
CodePointer ip = readReturnAddress();
trace.string(" ip: ").hex(ip).newline();
JavaStackWalker.walkCurrentThread(sp, ip, frameWalker);
if (SubstrateOptions.MultiThreaded.getValue()) {
/*
* Scan the stacks of all the threads. Other threads will be blocked at a safepoint
* (or in native code) so they will each have a JavaFrameAnchor in their VMThread.
*/
for (IsolateThread vmThread = VMThreads.firstThread(); VMThreads.isNonNullThread(vmThread); vmThread = VMThreads.nextThread(vmThread)) {
if (vmThread == CEntryPointContext.getCurrentIsolateThread()) {
/*
* The current thread is already scanned by code above, so we do not have to
* do anything for it here. It might have a JavaFrameAnchor from earlier
* Java-to-C transitions, but certainly not at the top of the stack since it
* is running this code, so just this scan would be incomplete.
*/
continue;
}
JavaStackWalker.walkThread(vmThread, frameWalker);
trace.newline();
}
}
trace.string("]").newline();
}
trace.string("]").newline();
}
Aggregations