Commit 0ab414a 1 parent 73be50d commit 0ab414a Copy full SHA for 0ab414a
File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -566,13 +566,13 @@ pub fn total_bytes<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
566
566
mmtk. get_plan ( ) . get_total_pages ( ) << LOG_BYTES_IN_PAGE
567
567
}
568
568
569
- /// Trigger a garbage collection as requested by the user.
569
+ /// Trigger a garbage collection as requested by the user. Returns whether a GC was ran or not.
570
570
///
571
571
/// Arguments:
572
572
/// * `mmtk`: A reference to an MMTk instance.
573
573
/// * `tls`: The thread that triggers this collection request.
574
- pub fn handle_user_collection_request < VM : VMBinding > ( mmtk : & MMTK < VM > , tls : VMMutatorThread ) {
575
- mmtk. handle_user_collection_request ( tls, false , false ) ;
574
+ pub fn handle_user_collection_request < VM : VMBinding > ( mmtk : & MMTK < VM > , tls : VMMutatorThread ) -> bool {
575
+ mmtk. handle_user_collection_request ( tls, false , false )
576
576
}
577
577
578
578
/// Is the object alive?
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ impl<VM: VMBinding> MMTK<VM> {
401
401
}
402
402
403
403
/// The application code has requested a collection. This is just a GC hint, and
404
- /// we may ignore it.
404
+ /// we may ignore it. Returns whether a GC was ran or not.
405
405
///
406
406
/// # Arguments
407
407
/// * `tls`: The mutator thread that requests the GC
@@ -412,11 +412,11 @@ impl<VM: VMBinding> MMTK<VM> {
412
412
tls : VMMutatorThread ,
413
413
force : bool ,
414
414
exhaustive : bool ,
415
- ) {
415
+ ) -> bool {
416
416
use crate :: vm:: Collection ;
417
417
if !self . get_plan ( ) . constraints ( ) . collects_garbage {
418
418
warn ! ( "User attempted a collection request, but the plan can not do GC. The request is ignored." ) ;
419
- return ;
419
+ return false ;
420
420
}
421
421
422
422
if force || !* self . options . ignore_system_gc && VM :: VMCollection :: is_collection_enabled ( ) {
@@ -432,7 +432,10 @@ impl<VM: VMBinding> MMTK<VM> {
432
432
. store ( true , Ordering :: Relaxed ) ;
433
433
self . gc_requester . request ( ) ;
434
434
VM :: VMCollection :: block_for_gc ( tls) ;
435
+ return true ;
435
436
}
437
+
438
+ false
436
439
}
437
440
438
441
/// MMTK has requested stop-the-world activity (e.g., stw within a concurrent gc).
You can’t perform that action at this time.
0 commit comments