src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
changeset 59062 6530de931b8e
parent 59061 df6f2350edfa
child 59198 92c98aa0f801
equal deleted inserted replaced
59061:df6f2350edfa 59062:6530de931b8e
    55     _last_enqueued_card(SIZE_MAX),
    55     _last_enqueued_card(SIZE_MAX),
    56     _stack_trim_upper_threshold(GCDrainStackTargetSize * 2 + 1),
    56     _stack_trim_upper_threshold(GCDrainStackTargetSize * 2 + 1),
    57     _stack_trim_lower_threshold(GCDrainStackTargetSize),
    57     _stack_trim_lower_threshold(GCDrainStackTargetSize),
    58     _trim_ticks(),
    58     _trim_ticks(),
    59     _old_gen_is_full(false),
    59     _old_gen_is_full(false),
    60     _num_optional_regions(optional_cset_length)
    60     _num_optional_regions(optional_cset_length),
       
    61     _numa(g1h->numa()),
       
    62     _obj_alloc_stat(NULL)
    61 {
    63 {
    62   // We allocate number of young gen regions in the collection set plus one
    64   // We allocate number of young gen regions in the collection set plus one
    63   // entries, since entry 0 keeps track of surviving bytes for non-young regions.
    65   // entries, since entry 0 keeps track of surviving bytes for non-young regions.
    64   // We also add a few elements at the beginning and at the end in
    66   // We also add a few elements at the beginning and at the end in
    65   // an attempt to eliminate cache contention
    67   // an attempt to eliminate cache contention
    77   _dest[G1HeapRegionAttr::Old]   = G1HeapRegionAttr::Old;
    79   _dest[G1HeapRegionAttr::Old]   = G1HeapRegionAttr::Old;
    78 
    80 
    79   _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
    81   _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
    80 
    82 
    81   _oops_into_optional_regions = new G1OopStarChunkedList[_num_optional_regions];
    83   _oops_into_optional_regions = new G1OopStarChunkedList[_num_optional_regions];
       
    84 
       
    85   initialize_numa_stats();
    82 }
    86 }
    83 
    87 
    84 // Pass locally gathered statistics to global state.
    88 // Pass locally gathered statistics to global state.
    85 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
    89 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
    86   _rdcq.flush();
    90   _rdcq.flush();
    90 
    94 
    91   uint length = _g1h->collection_set()->young_region_length() + 1;
    95   uint length = _g1h->collection_set()->young_region_length() + 1;
    92   for (uint i = 0; i < length; i++) {
    96   for (uint i = 0; i < length; i++) {
    93     surviving_young_words[i] += _surviving_young_words[i];
    97     surviving_young_words[i] += _surviving_young_words[i];
    94   }
    98   }
       
    99   flush_numa_stats();
    95 }
   100 }
    96 
   101 
    97 G1ParScanThreadState::~G1ParScanThreadState() {
   102 G1ParScanThreadState::~G1ParScanThreadState() {
    98   delete _plab_allocator;
   103   delete _plab_allocator;
    99   delete _closures;
   104   delete _closures;
   100   FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
   105   FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
   101   delete[] _oops_into_optional_regions;
   106   delete[] _oops_into_optional_regions;
       
   107   FREE_C_HEAP_ARRAY(size_t, _obj_alloc_stat);
   102 }
   108 }
   103 
   109 
   104 size_t G1ParScanThreadState::lab_waste_words() const {
   110 size_t G1ParScanThreadState::lab_waste_words() const {
   105   return _plab_allocator->waste();
   111   return _plab_allocator->waste();
   106 }
   112 }
   246         // This will either forward-to-self, or detect that someone else has
   252         // This will either forward-to-self, or detect that someone else has
   247         // installed a forwarding pointer.
   253         // installed a forwarding pointer.
   248         return handle_evacuation_failure_par(old, old_mark);
   254         return handle_evacuation_failure_par(old, old_mark);
   249       }
   255       }
   250     }
   256     }
       
   257     update_numa_stats(node_index);
       
   258 
   251     if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
   259     if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
   252       // The events are checked individually as part of the actual commit
   260       // The events are checked individually as part of the actual commit
   253       report_promotion_event(dest_attr, old, word_sz, age, obj_ptr, node_index);
   261       report_promotion_event(dest_attr, old, word_sz, age, obj_ptr, node_index);
   254     }
   262     }
   255   }
   263   }