src/share/vm/memory/genCollectedHeap.cpp

Print this page
rev 2691 : [mq]: g1-reference-processing


 582           // In the future this should be moved into the generation's
 583           // collect method so that ref discovery and enqueueing concerns
 584           // are local to a generation. The collect method could return
 585           // an appropriate indication in the case that notification on
 586           // the ref lock was needed. This will make the treatment of
 587           // weak refs more uniform (and indeed remove such concerns
 588           // from GCH). XXX
 589 
 590           HandleMark hm;  // Discard invalid handles created during gc
 591           save_marks();   // save marks for all gens
 592           // We want to discover references, but not process them yet.
 593           // This mode is disabled in process_discovered_references if the
 594           // generation does some collection work, or in
 595           // enqueue_discovered_references if the generation returns
 596           // without doing any work.
 597           ReferenceProcessor* rp = _gens[i]->ref_processor();
 598           // If the discovery of ("weak") refs in this generation is
 599           // atomic wrt other collectors in this configuration, we
 600           // are guaranteed to have empty discovered ref lists.
 601           if (rp->discovery_is_atomic()) {
 602             rp->verify_no_references_recorded();
 603             rp->enable_discovery();
 604             rp->setup_policy(do_clear_all_soft_refs);
 605           } else {
 606             // collect() below will enable discovery as appropriate
 607           }
 608           _gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab);
 609           if (!rp->enqueuing_is_done()) {
 610             rp->enqueue_discovered_references();
 611           } else {
 612             rp->set_enqueuing_is_done(false);
 613           }
 614           rp->verify_no_references_recorded();
 615         }
 616         max_level_collected = i;
 617 
 618         // Determine if allocation request was met.
 619         if (size > 0) {
 620           if (!is_tlab || _gens[i]->supports_tlab_allocation()) {
 621             if (size*HeapWordSize <= _gens[i]->unsafe_max_alloc_nogc()) {
 622               size = 0;
 623             }




 582           // In the future this should be moved into the generation's
 583           // collect method so that ref discovery and enqueueing concerns
 584           // are local to a generation. The collect method could return
 585           // an appropriate indication in the case that notification on
 586           // the ref lock was needed. This will make the treatment of
 587           // weak refs more uniform (and indeed remove such concerns
 588           // from GCH). XXX
 589 
 590           HandleMark hm;  // Discard invalid handles created during gc
 591           save_marks();   // save marks for all gens
 592           // We want to discover references, but not process them yet.
 593           // This mode is disabled in process_discovered_references if the
 594           // generation does some collection work, or in
 595           // enqueue_discovered_references if the generation returns
 596           // without doing any work.
 597           ReferenceProcessor* rp = _gens[i]->ref_processor();
 598           // If the discovery of ("weak") refs in this generation is
 599           // atomic wrt other collectors in this configuration, we
 600           // are guaranteed to have empty discovered ref lists.
 601           if (rp->discovery_is_atomic()) {
 602             rp->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);

 603             rp->setup_policy(do_clear_all_soft_refs);
 604           } else {
 605             // collect() below will enable discovery as appropriate
 606           }
 607           _gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab);
 608           if (!rp->enqueuing_is_done()) {
 609             rp->enqueue_discovered_references();
 610           } else {
 611             rp->set_enqueuing_is_done(false);
 612           }
 613           rp->verify_no_references_recorded();
 614         }
 615         max_level_collected = i;
 616 
 617         // Determine if allocation request was met.
 618         if (size > 0) {
 619           if (!is_tlab || _gens[i]->supports_tlab_allocation()) {
 620             if (size*HeapWordSize <= _gens[i]->unsafe_max_alloc_nogc()) {
 621               size = 0;
 622             }