< prev index next >

src/share/vm/gc/g1/g1ParScanThreadState.cpp

Print this page
rev 10311 : 8151178 Move the collection set out of the G1 collector policy
Reviewed-by:
rev 10312 : imported patch remove-cset-from-name


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1Allocator.inline.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"

  28 #include "gc/g1/g1OopClosures.inline.hpp"
  29 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  30 #include "gc/g1/g1RootClosures.hpp"
  31 #include "gc/g1/g1StringDedup.hpp"
  32 #include "gc/shared/taskqueue.inline.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "runtime/prefetch.inline.hpp"
  35 
  36 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length)
  37   : _g1h(g1h),
  38     _refs(g1h->task_queue(worker_id)),
  39     _dcq(&g1h->dirty_card_queue_set()),
  40     _ct_bs(g1h->g1_barrier_set()),
  41     _closures(NULL),
  42     _hash_seed(17),
  43     _worker_id(worker_id),
  44     _tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
  45     _age_table(false),
  46     _scanner(g1h, this),
  47     _old_gen_is_full(false)


  63   memset(_surviving_young_words, 0, real_length * sizeof(size_t));
  64 
  65   _plab_allocator = G1PLABAllocator::create_allocator(_g1h->allocator());
  66 
  67   _dest[InCSetState::NotInCSet]    = InCSetState::NotInCSet;
  68   // The dest for Young is used when the objects are aged enough to
  69   // need to be moved to the next space.
  70   _dest[InCSetState::Young]        = InCSetState::Old;
  71   _dest[InCSetState::Old]          = InCSetState::Old;
  72 
  73   _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
  74 }
  75 
  76 // Pass locally gathered statistics to global state.
  77 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
  78   _dcq.flush();
  79   // Update allocation statistics.
  80   _plab_allocator->flush_and_retire_stats();
  81   _g1h->g1_policy()->record_age_table(&_age_table);
  82 
  83   uint length = _g1h->g1_policy()->young_cset_region_length();
  84   for (uint region_index = 0; region_index < length; region_index++) {
  85     surviving_young_words[region_index] += _surviving_young_words[region_index];
  86   }
  87 }
  88 
  89 G1ParScanThreadState::~G1ParScanThreadState() {
  90   delete _plab_allocator;
  91   delete _closures;
  92   FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
  93 }
  94 
  95 void G1ParScanThreadState::waste(size_t& wasted, size_t& undo_wasted) {
  96   _plab_allocator->waste(wasted, undo_wasted);
  97 }
  98 
  99 #ifdef ASSERT
 100 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
 101   assert(ref != NULL, "invariant");
 102   assert(UseCompressedOops, "sanity");
 103   assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref));




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1Allocator.inline.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/g1CollectionSet.hpp"
  29 #include "gc/g1/g1OopClosures.inline.hpp"
  30 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  31 #include "gc/g1/g1RootClosures.hpp"
  32 #include "gc/g1/g1StringDedup.hpp"
  33 #include "gc/shared/taskqueue.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "runtime/prefetch.inline.hpp"
  36 
  37 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length)
  38   : _g1h(g1h),
  39     _refs(g1h->task_queue(worker_id)),
  40     _dcq(&g1h->dirty_card_queue_set()),
  41     _ct_bs(g1h->g1_barrier_set()),
  42     _closures(NULL),
  43     _hash_seed(17),
  44     _worker_id(worker_id),
  45     _tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
  46     _age_table(false),
  47     _scanner(g1h, this),
  48     _old_gen_is_full(false)


  64   memset(_surviving_young_words, 0, real_length * sizeof(size_t));
  65 
  66   _plab_allocator = G1PLABAllocator::create_allocator(_g1h->allocator());
  67 
  68   _dest[InCSetState::NotInCSet]    = InCSetState::NotInCSet;
  69   // The dest for Young is used when the objects are aged enough to
  70   // need to be moved to the next space.
  71   _dest[InCSetState::Young]        = InCSetState::Old;
  72   _dest[InCSetState::Old]          = InCSetState::Old;
  73 
  74   _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
  75 }
  76 
  77 // Pass locally gathered statistics to global state.
  78 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
  79   _dcq.flush();
  80   // Update allocation statistics.
  81   _plab_allocator->flush_and_retire_stats();
  82   _g1h->g1_policy()->record_age_table(&_age_table);
  83 
  84   uint length = _g1h->collection_set()->young_region_length();
  85   for (uint region_index = 0; region_index < length; region_index++) {
  86     surviving_young_words[region_index] += _surviving_young_words[region_index];
  87   }
  88 }
  89 
  90 G1ParScanThreadState::~G1ParScanThreadState() {
  91   delete _plab_allocator;
  92   delete _closures;
  93   FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
  94 }
  95 
  96 void G1ParScanThreadState::waste(size_t& wasted, size_t& undo_wasted) {
  97   _plab_allocator->waste(wasted, undo_wasted);
  98 }
  99 
 100 #ifdef ASSERT
 101 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
 102   assert(ref != NULL, "invariant");
 103   assert(UseCompressedOops, "sanity");
 104   assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref));


< prev index next >