@@ -88,7 +88,12 @@ pub fn mmtk_init<VM: VMBinding>(builder: &MMTKBuilder) -> Box<MMTK<VM>> {
88
88
89
89
#[ cfg( feature = "vm_space" ) ]
90
90
pub fn lazy_init_vm_space < VM : VMBinding > ( mmtk : & ' static mut MMTK < VM > , start : Address , size : usize ) {
91
- mmtk. plan . base_mut ( ) . vm_space . lazy_initialize ( start, size) ;
91
+ unsafe {
92
+ mmtk. get_plan_mut ( )
93
+ . base_mut ( )
94
+ . vm_space
95
+ . lazy_initialize ( start, size) ;
96
+ }
92
97
}
93
98
94
99
/// Request MMTk to create a mutator for the given thread. The ownership
@@ -345,7 +350,7 @@ pub fn get_allocator_mapping<VM: VMBinding>(
345
350
mmtk : & MMTK < VM > ,
346
351
semantics : AllocationSemantics ,
347
352
) -> AllocatorSelector {
348
- mmtk. plan . get_allocator_mapping ( ) [ semantics]
353
+ mmtk. get_plan ( ) . get_allocator_mapping ( ) [ semantics]
349
354
}
350
355
351
356
/// The standard malloc. MMTk either uses its own allocator, or forward the call to a
@@ -467,11 +472,14 @@ pub fn start_worker<VM: VMBinding>(
467
472
/// Collection::spawn_gc_thread() so that the VM knows the context.
468
473
pub fn initialize_collection < VM : VMBinding > ( mmtk : & ' static MMTK < VM > , tls : VMThread ) {
469
474
assert ! (
470
- !mmtk. plan . is_initialized( ) ,
475
+ !mmtk. get_plan ( ) . is_initialized( ) ,
471
476
"MMTk collection has been initialized (was initialize_collection() already called before?)"
472
477
) ;
473
478
mmtk. scheduler . spawn_gc_threads ( mmtk, tls) ;
474
- mmtk. plan . base ( ) . initialized . store ( true , Ordering :: SeqCst ) ;
479
+ mmtk. get_plan ( )
480
+ . base ( )
481
+ . initialized
482
+ . store ( true , Ordering :: SeqCst ) ;
475
483
probe ! ( mmtk, collection_initialized) ;
476
484
}
477
485
@@ -483,10 +491,10 @@ pub fn initialize_collection<VM: VMBinding>(mmtk: &'static MMTK<VM>, tls: VMThre
483
491
/// * `mmtk`: A reference to an MMTk instance.
484
492
pub fn enable_collection < VM : VMBinding > ( mmtk : & ' static MMTK < VM > ) {
485
493
debug_assert ! (
486
- !mmtk. plan . should_trigger_gc_when_heap_is_full( ) ,
494
+ !mmtk. get_plan ( ) . should_trigger_gc_when_heap_is_full( ) ,
487
495
"enable_collection() is called when GC is already enabled."
488
496
) ;
489
- mmtk. plan
497
+ mmtk. get_plan ( )
490
498
. base ( )
491
499
. trigger_gc_when_heap_is_full
492
500
. store ( true , Ordering :: SeqCst ) ;
@@ -504,10 +512,10 @@ pub fn enable_collection<VM: VMBinding>(mmtk: &'static MMTK<VM>) {
504
512
/// * `mmtk`: A reference to an MMTk instance.
505
513
pub fn disable_collection < VM : VMBinding > ( mmtk : & ' static MMTK < VM > ) {
506
514
debug_assert ! (
507
- mmtk. plan . should_trigger_gc_when_heap_is_full( ) ,
515
+ mmtk. get_plan ( ) . should_trigger_gc_when_heap_is_full( ) ,
508
516
"disable_collection() is called when GC is not enabled."
509
517
) ;
510
- mmtk. plan
518
+ mmtk. get_plan ( )
511
519
. base ( )
512
520
. trigger_gc_when_heap_is_full
513
521
. store ( false , Ordering :: SeqCst ) ;
@@ -538,7 +546,7 @@ pub fn process_bulk(builder: &mut MMTKBuilder, options: &str) -> bool {
538
546
/// Arguments:
539
547
/// * `mmtk`: A reference to an MMTk instance.
540
548
pub fn used_bytes < VM : VMBinding > ( mmtk : & MMTK < VM > ) -> usize {
541
- mmtk. plan . get_used_pages ( ) << LOG_BYTES_IN_PAGE
549
+ mmtk. get_plan ( ) . get_used_pages ( ) << LOG_BYTES_IN_PAGE
542
550
}
543
551
544
552
/// Return free memory in bytes. MMTk accounts for memory in pages, thus this method always returns a value in
@@ -547,7 +555,7 @@ pub fn used_bytes<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
547
555
/// Arguments:
548
556
/// * `mmtk`: A reference to an MMTk instance.
549
557
pub fn free_bytes < VM : VMBinding > ( mmtk : & MMTK < VM > ) -> usize {
550
- mmtk. plan . get_free_pages ( ) << LOG_BYTES_IN_PAGE
558
+ mmtk. get_plan ( ) . get_free_pages ( ) << LOG_BYTES_IN_PAGE
551
559
}
552
560
553
561
/// Return the size of all the live objects in bytes in the last GC. MMTk usually accounts for memory in pages.
@@ -558,7 +566,7 @@ pub fn free_bytes<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
558
566
/// to call this method is at the end of a GC (e.g. when the runtime is about to resume threads).
559
567
#[ cfg( feature = "count_live_bytes_in_gc" ) ]
560
568
pub fn live_bytes_in_last_gc < VM : VMBinding > ( mmtk : & MMTK < VM > ) -> usize {
561
- mmtk. plan
569
+ mmtk. get_plan ( )
562
570
. base ( )
563
571
. live_bytes_in_last_gc
564
572
. load ( Ordering :: SeqCst )
@@ -581,7 +589,7 @@ pub fn last_heap_address() -> Address {
581
589
/// Arguments:
582
590
/// * `mmtk`: A reference to an MMTk instance.
583
591
pub fn total_bytes < VM : VMBinding > ( mmtk : & MMTK < VM > ) -> usize {
584
- mmtk. plan . get_total_pages ( ) << LOG_BYTES_IN_PAGE
592
+ mmtk. get_plan ( ) . get_total_pages ( ) << LOG_BYTES_IN_PAGE
585
593
}
586
594
587
595
/// Trigger a garbage collection as requested by the user.
@@ -590,7 +598,8 @@ pub fn total_bytes<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
590
598
/// * `mmtk`: A reference to an MMTk instance.
591
599
/// * `tls`: The thread that triggers this collection request.
592
600
pub fn handle_user_collection_request < VM : VMBinding > ( mmtk : & MMTK < VM > , tls : VMMutatorThread ) {
593
- mmtk. plan . handle_user_collection_request ( tls, false , false ) ;
601
+ mmtk. get_plan ( )
602
+ . handle_user_collection_request ( tls, false , false ) ;
594
603
}
595
604
596
605
/// Is the object alive?
@@ -709,7 +718,7 @@ pub fn is_mapped_address(address: Address) -> bool {
709
718
/// * `mmtk`: A reference to an MMTk instance.
710
719
/// * `object`: The object to check.
711
720
pub fn modify_check < VM : VMBinding > ( mmtk : & MMTK < VM > , object : ObjectReference ) {
712
- mmtk. plan . modify_check ( object) ;
721
+ mmtk. get_plan ( ) . modify_check ( object) ;
713
722
}
714
723
715
724
/// Add a reference to the list of weak references. A binding may
0 commit comments