335 // Process Soft/Weak/Final/PhantomReferences 336 _reference_processor.process_references(); 337 338 // Process concurrent weak roots 339 _weak_roots_processor.process_concurrent_weak_roots(); 340 341 // Unlink stale metadata and nmethods 342 _unload.unlink(); 343 344 // Perform a handshake. This is needed 1) to make sure that stale 345 // metadata and nmethods are no longer observable. And 2), to 346 // prevent the race where a mutator first loads an oop, which is 347 // logically null but not yet cleared. Then this oop gets cleared 348 // by the reference processor and resurrection is unblocked. At 349 // this point the mutator could see the unblocked state and pass 350 // this invalid oop through the normal barrier path, which would 351 // incorrectly try to mark the oop. 352 ZRendezvousClosure cl; 353 Handshake::execute(&cl); 354 355 // Purge stale metadata and nmethods that were unlinked 356 _unload.purge(); 357 358 // Unblock resurrection of weak/phantom references 359 ZResurrection::unblock(); 360 361 // Enqueue Soft/Weak/Final/PhantomReferences. Note that this 362 // must be done after unblocking resurrection. Otherwise the 363 // Finalizer thread could call Reference.get() on the Finalizers 364 // that were just enqueued, which would incorrectly return null 365 // during the resurrection block window, since such referents 366 // are only Finalizable marked. 367 _reference_processor.enqueue_references(); 368 } 369 370 void ZHeap::select_relocation_set() { 371 // Do not allow pages to be deleted 372 _page_allocator.enable_deferred_delete(); 373 374 // Register relocatable pages with selector 375 ZRelocationSetSelector selector; 376 ZPageTableIterator pt_iter(&_page_table); 377 for (ZPage* page; pt_iter.next(&page);) { 378 if (!page->is_relocatable()) { 379 // Not relocatable, don't register | 335 // Process Soft/Weak/Final/PhantomReferences 336 _reference_processor.process_references(); 337 338 // Process concurrent weak roots 339 _weak_roots_processor.process_concurrent_weak_roots(); 340 341 // Unlink stale metadata and nmethods 342 _unload.unlink(); 343 344 // Perform a handshake. This is needed 1) to make sure that stale 345 // metadata and nmethods are no longer observable. And 2), to 346 // prevent the race where a mutator first loads an oop, which is 347 // logically null but not yet cleared. Then this oop gets cleared 348 // by the reference processor and resurrection is unblocked. At 349 // this point the mutator could see the unblocked state and pass 350 // this invalid oop through the normal barrier path, which would 351 // incorrectly try to mark the oop. 352 ZRendezvousClosure cl; 353 Handshake::execute(&cl); 354 355 // Unblock resurrection of weak/phantom references 356 ZResurrection::unblock(); 357 358 // Purge stale metadata and nmethods that were unlinked 359 _unload.purge(); 360 361 // Enqueue Soft/Weak/Final/PhantomReferences. Note that this 362 // must be done after unblocking resurrection. Otherwise the 363 // Finalizer thread could call Reference.get() on the Finalizers 364 // that were just enqueued, which would incorrectly return null 365 // during the resurrection block window, since such referents 366 // are only Finalizable marked. 367 _reference_processor.enqueue_references(); 368 } 369 370 void ZHeap::select_relocation_set() { 371 // Do not allow pages to be deleted 372 _page_allocator.enable_deferred_delete(); 373 374 // Register relocatable pages with selector 375 ZRelocationSetSelector selector; 376 ZPageTableIterator pt_iter(&_page_table); 377 for (ZPage* page; pt_iter.next(&page);) { 378 if (!page->is_relocatable()) { 379 // Not relocatable, don't register |