File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -490,19 +490,22 @@ pub extern "C" fn get_finalized_object() -> NullableObjectReference {
490490}
491491
492492thread_local ! {
493- /// Cache all the pointers reported by the current thread.
493+ /// Cache reference slots of an nmethod while the current thread is executing
494+ /// `MMTkRegisterNMethodOopClosure`.
494495 static NMETHOD_SLOTS : RefCell <Vec <Address >> = const { RefCell :: new( vec![ ] ) } ;
495496}
496497
497- /// Report a list of pointers in nmethod to mmtk .
498+ /// Report one reference slot in an nmethod to MMTk .
498499#[ no_mangle]
499500pub extern "C" fn mmtk_add_nmethod_oop ( addr : Address ) {
500501 NMETHOD_SLOTS . with_borrow_mut ( |x| x. push ( addr) )
501502}
502503
503- /// Register a nmethod.
504- /// The c++ part of the binding should scan the nmethod and report all the pointers to mmtk first, before calling this function.
505- /// This function will transfer all the locally cached pointers of this nmethod to the global storage.
504+ /// Register an nmethod.
505+ ///
506+ /// The C++ part of the binding should have scanned the nmethod and reported all the reference slots
507+ /// using `mmtk_add_nmethod_oop` before calling this function. This function will transfer all the
508+ /// locally cached slots of this nmethod to the global storage.
506509#[ no_mangle]
507510pub extern "C" fn mmtk_register_nmethod ( nm : Address ) {
508511 NMETHOD_SLOTS . with_borrow_mut ( |slots| {
@@ -513,7 +516,7 @@ pub extern "C" fn mmtk_register_nmethod(nm: Address) {
513516 } ) ;
514517}
515518
516- /// Unregister a nmethod.
519+ /// Unregister an nmethod.
517520#[ no_mangle]
518521pub extern "C" fn mmtk_unregister_nmethod ( nm : Address ) {
519522 {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ impl<const COMPRESSED: bool, F: RootsWorkFactory<OpenJDKSlot<COMPRESSED>>>
7676 . generational ( )
7777 . is_some_and ( |gen| gen. is_current_gc_nursery ( ) ) ;
7878
79- let mut slots = Vec :: with_capacity ( scanning:: WORK_PACKET_CAPACITY ) ;
79+ let mut slots = Vec :: with_capacity ( scanning:: WORK_PACKET_CAPACITY ) ;
8080
8181 let mut nursery_slots = 0 ;
8282 let mut mature_slots = 0 ;
Original file line number Diff line number Diff line change @@ -203,9 +203,9 @@ pub static MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES: usize =
203203 mmtk:: util:: alloc:: MarkCompactAllocator :: < OpenJDK < false > > :: HEADER_RESERVED_IN_BYTES ;
204204
205205lazy_static ! {
206- /// A global storage for all the cached CodeCache root pointers added since the last GC.
206+ /// A global storage for all the cached CodeCache roots added since the last GC.
207207 static ref NURSERY_CODE_CACHE_ROOTS : Mutex <HashMap <Address , Vec <Address >>> = Mutex :: new( HashMap :: new( ) ) ;
208- /// A global storage for all the cached CodeCache root pointers added before the last GC.
208+ /// A global storage for all the cached CodeCache roots added before the last GC.
209209 static ref MATURE_CODE_CACHE_ROOTS : Mutex <HashMap <Address , Vec <Address >>> = Mutex :: new( HashMap :: new( ) ) ;
210210}
211211
You can’t perform that action at this time.
0 commit comments