@@ -20,6 +20,7 @@ use crate::scheduler::{GCWork, GCWorker};
20
20
use crate :: util:: alloc:: allocators:: AllocatorSelector ;
21
21
use crate :: util:: constants:: { LOG_BYTES_IN_PAGE , MIN_OBJECT_SIZE } ;
22
22
use crate :: util:: heap:: layout:: vm_layout:: vm_layout;
23
+ use crate :: util:: log;
23
24
use crate :: util:: opaque_pointer:: * ;
24
25
use crate :: util:: { Address , ObjectReference } ;
25
26
use crate :: vm:: slot:: MemorySlice ;
@@ -52,8 +53,8 @@ use crate::vm::VMBinding;
52
53
/// * `builder`: The reference to a MMTk builder.
53
54
pub fn mmtk_init < VM : VMBinding > ( builder : & MMTKBuilder ) -> Box < MMTK < VM > > {
54
55
match crate :: util:: logger:: try_init ( ) {
55
- Ok ( _) => debug ! ( "MMTk initialized the logger." ) ,
56
- Err ( _) => debug ! (
56
+ Ok ( _) => log :: debug!( "MMTk initialized the logger." ) ,
57
+ Err ( _) => log :: debug!(
57
58
"MMTk failed to initialize the logger. Possibly a logger has been initialized by user."
58
59
) ,
59
60
}
@@ -69,19 +70,20 @@ pub fn mmtk_init<VM: VMBinding>(builder: &MMTKBuilder) -> Box<MMTK<VM>> {
69
70
if split[ 0 ] == "Threads:" {
70
71
let threads = split[ 1 ] . parse :: < i32 > ( ) . unwrap ( ) ;
71
72
if threads != 1 {
72
- warn ! ( "Current process has {} threads, process-wide perf event measurement will only include child threads spawned from this thread" , threads) ;
73
+ log :: warn!( "Current process has {} threads, process-wide perf event measurement will only include child threads spawned from this thread" , threads) ;
73
74
}
74
75
}
75
76
}
76
77
}
77
78
let mmtk = builder. build ( ) ;
78
79
79
- info ! (
80
+ log :: info!(
80
81
"Initialized MMTk with {:?} ({:?})" ,
81
- * mmtk. options. plan, * mmtk. options. gc_trigger
82
+ * mmtk. options. plan,
83
+ * mmtk. options. gc_trigger
82
84
) ;
83
85
#[ cfg( feature = "extreme_assertions" ) ]
84
- warn ! ( "The feature 'extreme_assertions' is enabled. MMTk will run expensive run-time checks. Slow performance should be expected." ) ;
86
+ log :: warn!( "The feature 'extreme_assertions' is enabled. MMTk will run expensive run-time checks. Slow performance should be expected." ) ;
85
87
Box :: new ( mmtk)
86
88
}
87
89
@@ -115,7 +117,7 @@ pub fn bind_mutator<VM: VMBinding>(
115
117
116
118
const LOG_ALLOCATOR_MAPPING : bool = false ;
117
119
if LOG_ALLOCATOR_MAPPING {
118
- info ! ( "{:?}" , mutator. config) ;
120
+ log :: info!( "{:?}" , mutator. config) ;
119
121
}
120
122
mutator
121
123
}
@@ -477,7 +479,7 @@ pub fn gc_poll<VM: VMBinding>(mmtk: &MMTK<VM>, tls: VMMutatorThread) {
477
479
) ;
478
480
479
481
if VM :: VMCollection :: is_collection_enabled ( ) && mmtk. gc_trigger . poll ( false , None ) {
480
- debug ! ( "Collection required" ) ;
482
+ log :: debug!( "Collection required" ) ;
481
483
assert ! ( mmtk. state. is_initialized( ) , "GC is not allowed here: collection is not initialized (did you call initialize_collection()?)." ) ;
482
484
VM :: VMCollection :: block_for_gc ( tls) ;
483
485
}
@@ -764,7 +766,7 @@ pub fn add_finalizer<VM: VMBinding>(
764
766
object : <VM :: VMReferenceGlue as ReferenceGlue < VM > >:: FinalizableType ,
765
767
) {
766
768
if * mmtk. options . no_finalizer {
767
- warn ! ( "add_finalizer() is called when no_finalizer = true" ) ;
769
+ log :: warn!( "add_finalizer() is called when no_finalizer = true" ) ;
768
770
}
769
771
770
772
mmtk. finalizable_processor . lock ( ) . unwrap ( ) . add ( object) ;
@@ -823,7 +825,7 @@ pub fn get_finalized_object<VM: VMBinding>(
823
825
mmtk : & ' static MMTK < VM > ,
824
826
) -> Option < <VM :: VMReferenceGlue as ReferenceGlue < VM > >:: FinalizableType > {
825
827
if * mmtk. options . no_finalizer {
826
- warn ! ( "get_finalized_object() is called when no_finalizer = true" ) ;
828
+ log :: warn!( "get_finalized_object() is called when no_finalizer = true" ) ;
827
829
}
828
830
829
831
mmtk. finalizable_processor
@@ -843,7 +845,7 @@ pub fn get_all_finalizers<VM: VMBinding>(
843
845
mmtk : & ' static MMTK < VM > ,
844
846
) -> Vec < <VM :: VMReferenceGlue as ReferenceGlue < VM > >:: FinalizableType > {
845
847
if * mmtk. options . no_finalizer {
846
- warn ! ( "get_all_finalizers() is called when no_finalizer = true" ) ;
848
+ log :: warn!( "get_all_finalizers() is called when no_finalizer = true" ) ;
847
849
}
848
850
849
851
mmtk. finalizable_processor
@@ -863,7 +865,7 @@ pub fn get_finalizers_for<VM: VMBinding>(
863
865
object : ObjectReference ,
864
866
) -> Vec < <VM :: VMReferenceGlue as ReferenceGlue < VM > >:: FinalizableType > {
865
867
if * mmtk. options . no_finalizer {
866
- warn ! ( "get_finalizers() is called when no_finalizer = true" ) ;
868
+ log :: warn!( "get_finalizers() is called when no_finalizer = true" ) ;
867
869
}
868
870
869
871
mmtk. finalizable_processor
0 commit comments