< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp

Print this page
rev 59476 : 8245880: Shenandoah: check class unloading flag early in concurrent code root scan


 373 #if COMPILER2_OR_JVMCI
 374   DerivedPointerTable::update_pointers();
 375 #endif
 376 }
 377 
 378 void ShenandoahConcurrentMark::initialize(uint workers) {
 379   _heap = ShenandoahHeap::heap();
 380 
 381   uint num_queues = MAX2(workers, 1U);
 382 
 383   _task_queues = new ShenandoahObjToScanQueueSet((int) num_queues);
 384 
 385   for (uint i = 0; i < num_queues; ++i) {
 386     ShenandoahObjToScanQueue* task_queue = new ShenandoahObjToScanQueue();
 387     task_queue->initialize();
 388     _task_queues->register_queue(i, task_queue);
 389   }
 390 }
 391 
 392 void ShenandoahConcurrentMark::concurrent_scan_code_roots(uint worker_id, ReferenceProcessor* rp) {




 393   if (claim_codecache()) {
 394     ShenandoahObjToScanQueue* q = task_queues()->queue(worker_id);
 395     if (!_heap->unload_classes()) {
 396       MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 397       // TODO: We can not honor StringDeduplication here, due to lock ranking
 398       // inversion. So, we may miss some deduplication candidates.
 399       if (_heap->has_forwarded_objects()) {
 400         ShenandoahMarkResolveRefsClosure cl(q, rp);
 401         CodeBlobToOopClosure blobs(&cl, !CodeBlobToOopClosure::FixRelocations);
 402         CodeCache::blobs_do(&blobs);
 403       } else {
 404         ShenandoahMarkRefsClosure cl(q, rp);
 405         CodeBlobToOopClosure blobs(&cl, !CodeBlobToOopClosure::FixRelocations);
 406         CodeCache::blobs_do(&blobs);
 407       }
 408     }
 409   }
 410 }
 411 
 412 void ShenandoahConcurrentMark::mark_from_roots() {
 413   WorkGang* workers = _heap->workers();
 414   uint nworkers = workers->active_workers();
 415 
 416   if (_heap->process_references()) {
 417     ReferenceProcessor* rp = _heap->ref_processor();
 418     rp->set_active_mt_degree(nworkers);
 419 
 420     // enable ("weak") refs discovery
 421     rp->enable_discovery(true /*verify_no_refs*/);
 422     rp->setup_policy(_heap->soft_ref_policy()->should_clear_all_soft_refs());
 423   }
 424 
 425   shenandoah_assert_rp_isalive_not_installed();
 426   ShenandoahIsAliveSelector is_alive;
 427   ReferenceProcessorIsAliveMutator fix_isalive(_heap->ref_processor(), is_alive.is_alive_closure());




 373 #if COMPILER2_OR_JVMCI
 374   DerivedPointerTable::update_pointers();
 375 #endif
 376 }
 377 
 378 void ShenandoahConcurrentMark::initialize(uint workers) {
 379   _heap = ShenandoahHeap::heap();
 380 
 381   uint num_queues = MAX2(workers, 1U);
 382 
 383   _task_queues = new ShenandoahObjToScanQueueSet((int) num_queues);
 384 
 385   for (uint i = 0; i < num_queues; ++i) {
 386     ShenandoahObjToScanQueue* task_queue = new ShenandoahObjToScanQueue();
 387     task_queue->initialize();
 388     _task_queues->register_queue(i, task_queue);
 389   }
 390 }
 391 
 392 void ShenandoahConcurrentMark::concurrent_scan_code_roots(uint worker_id, ReferenceProcessor* rp) {
 393   if (_heap->unload_classes()) {
 394     return;
 395   }
 396 
 397   if (claim_codecache()) {
 398     ShenandoahObjToScanQueue* q = task_queues()->queue(worker_id);

 399     MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 400     // TODO: We can not honor StringDeduplication here, due to lock ranking
 401     // inversion. So, we may miss some deduplication candidates.
 402     if (_heap->has_forwarded_objects()) {
 403       ShenandoahMarkResolveRefsClosure cl(q, rp);
 404       CodeBlobToOopClosure blobs(&cl, !CodeBlobToOopClosure::FixRelocations);
 405       CodeCache::blobs_do(&blobs);
 406     } else {
 407       ShenandoahMarkRefsClosure cl(q, rp);
 408       CodeBlobToOopClosure blobs(&cl, !CodeBlobToOopClosure::FixRelocations);
 409       CodeCache::blobs_do(&blobs);

 410     }
 411   }
 412 }
 413 
 414 void ShenandoahConcurrentMark::mark_from_roots() {
 415   WorkGang* workers = _heap->workers();
 416   uint nworkers = workers->active_workers();
 417 
 418   if (_heap->process_references()) {
 419     ReferenceProcessor* rp = _heap->ref_processor();
 420     rp->set_active_mt_degree(nworkers);
 421 
 422     // enable ("weak") refs discovery
 423     rp->enable_discovery(true /*verify_no_refs*/);
 424     rp->setup_policy(_heap->soft_ref_policy()->should_clear_all_soft_refs());
 425   }
 426 
 427   shenandoah_assert_rp_isalive_not_installed();
 428   ShenandoahIsAliveSelector is_alive;
 429   ReferenceProcessorIsAliveMutator fix_isalive(_heap->ref_processor(), is_alive.is_alive_closure());


< prev index next >