src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page




2202   // Reference processing in G1 currently works as follows:
2203   //
2204   // * There is only one reference processor instance that
2205   //   'spans' the entire heap. It is created by the code
2206   //   below.
2207   // * Reference discovery is not enabled during an incremental
2208   //   pause (see 6484982).
2209   // * Discoverered refs are not enqueued nor are they processed
2210   //   during an incremental pause (see 6484982).
2211   // * Reference discovery is enabled at initial marking.
2212   // * Reference discovery is disabled and the discovered
2213   //   references processed etc during remarking.
2214   // * Reference discovery is MT (see below).
2215   // * Reference discovery requires a barrier (see below).
2216   // * Reference processing is currently not MT (see 6608385).
2217   // * A full GC enables (non-MT) reference discovery and
2218   //   processes any discovered references.
2219 
2220   SharedHeap::ref_processing_init();
2221   MemRegion mr = reserved_region();
2222   _ref_processor = ReferenceProcessor::create_ref_processor(
2223                                          mr,    // span




2224                                          false, // Reference discovery is not atomic
2225                                          true,  // mt_discovery
2226                                          &_is_alive_closure, // is alive closure
2227                                                              // for efficiency
2228                                          ParallelGCThreads,
2229                                          ParallelRefProcEnabled,
2230                                          true); // Setting next fields of discovered
2231                                                 // lists requires a barrier.
2232 }
2233 
2234 size_t G1CollectedHeap::capacity() const {
2235   return _g1_committed.byte_size();
2236 }
2237 
2238 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl,
2239                                                  DirtyCardQueue* into_cset_dcq,
2240                                                  bool concurrent,
2241                                                  int worker_i) {
2242   // Clean cards in the hot card cache
2243   concurrent_g1_refine()->clean_up_cache(worker_i, g1_rem_set(), into_cset_dcq);
2244 
2245   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2246   int n_completed_buffers = 0;
2247   while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) {
2248     n_completed_buffers++;
2249   }




2202   // Reference processing in G1 currently works as follows:
2203   //
2204   // * There is only one reference processor instance that
2205   //   'spans' the entire heap. It is created by the code
2206   //   below.
2207   // * Reference discovery is not enabled during an incremental
2208   //   pause (see 6484982).
2209   // * Discoverered refs are not enqueued nor are they processed
2210   //   during an incremental pause (see 6484982).
2211   // * Reference discovery is enabled at initial marking.
2212   // * Reference discovery is disabled and the discovered
2213   //   references processed etc during remarking.
2214   // * Reference discovery is MT (see below).
2215   // * Reference discovery requires a barrier (see below).
2216   // * Reference processing is currently not MT (see 6608385).
2217   // * A full GC enables (non-MT) reference discovery and
2218   //   processes any discovered references.
2219 
2220   SharedHeap::ref_processing_init();
2221   MemRegion mr = reserved_region();
2222   _ref_processor =
2223     new ReferenceProcessor(mr,    // span
2224                            ParallelRefProcEnabled,    // mt processing
2225                            ParallelGCThreads,         // degree of mt processing
2226                            true,                      // mt discovery
2227                            ConcGCThreads,             // degree of mt discovery
2228                            false,                     // Reference discovery is not atomic
2229                            &_is_alive_closure,        // is alive closure for efficiency




2230                            true);                     // Setting next fields of discovered
2231                                                       // lists requires a barrier.
2232 }
2233 
2234 size_t G1CollectedHeap::capacity() const {
2235   return _g1_committed.byte_size();
2236 }
2237 
2238 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl,
2239                                                  DirtyCardQueue* into_cset_dcq,
2240                                                  bool concurrent,
2241                                                  int worker_i) {
2242   // Clean cards in the hot card cache
2243   concurrent_g1_refine()->clean_up_cache(worker_i, g1_rem_set(), into_cset_dcq);
2244 
2245   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2246   int n_completed_buffers = 0;
2247   while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) {
2248     n_completed_buffers++;
2249   }