< prev index next >

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

Print this page
rev 10310 : imported patch 8150629-test
   1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  *


 183                               oop const old, size_t word_sz, uint age,
 184                               HeapWord * const obj_ptr, const AllocationContext_t context) const;
 185  public:
 186 
 187   oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
 188 
 189   void trim_queue();
 190 
 191   inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
 192 
 193   // An attempt to evacuate "obj" has failed; take necessary steps.
 194   oop handle_evacuation_failure_par(oop obj, markOop m);
 195 };
 196 
 197 class G1ParScanThreadStateSet : public StackObj {
 198   G1CollectedHeap* _g1h;
 199   G1ParScanThreadState** _states;
 200   size_t* _surviving_young_words_total;
 201   size_t* _cards_scanned;
 202   size_t _total_cards_scanned;

 203   uint _n_workers;
 204   bool _flushed;
 205 
 206  public:
 207   G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) :
 208       _g1h(g1h),
 209       _states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
 210       _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
 211       _cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
 212       _total_cards_scanned(0),

 213       _n_workers(n_workers),
 214       _flushed(false) {
 215     for (uint i = 0; i < n_workers; ++i) {
 216       _states[i] = new_par_scan_state(i, young_cset_length);
 217     }
 218     memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
 219     memset(_cards_scanned, 0, n_workers * sizeof(size_t));
 220   }
 221 
 222   ~G1ParScanThreadStateSet() {
 223     assert(_flushed, "thread local state from the per thread states should have been flushed");
 224     FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
 225     FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total);
 226     FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
 227   }
 228 
 229   void flush();
 230 
 231   G1ParScanThreadState* state_for_worker(uint worker_id);
 232 
 233   void add_cards_scanned(uint worker_id, size_t cards_scanned);
 234   size_t total_cards_scanned() const;
 235   const size_t* surviving_young_words() const;
 236 
   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  *


 183                               oop const old, size_t word_sz, uint age,
 184                               HeapWord * const obj_ptr, const AllocationContext_t context) const;
 185  public:
 186 
 187   oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
 188 
 189   void trim_queue();
 190 
 191   inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
 192 
 193   // An attempt to evacuate "obj" has failed; take necessary steps.
 194   oop handle_evacuation_failure_par(oop obj, markOop m);
 195 };
 196 
 197 class G1ParScanThreadStateSet : public StackObj {
 198   G1CollectedHeap* _g1h;
 199   G1ParScanThreadState** _states;
 200   size_t* _surviving_young_words_total;
 201   size_t* _cards_scanned;
 202   size_t _total_cards_scanned;
 203   size_t _young_cset_length;
 204   uint _n_workers;
 205   bool _flushed;
 206 
 207  public:
 208   G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) :
 209       _g1h(g1h),
 210       _states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
 211       _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
 212       _cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
 213       _total_cards_scanned(0),
 214       _young_cset_length(young_cset_length),
 215       _n_workers(n_workers),
 216       _flushed(false) {
 217     for (uint i = 0; i < n_workers; ++i) {
 218       _states[i] = NULL;
 219     }
 220     memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
 221     memset(_cards_scanned, 0, n_workers * sizeof(size_t));
 222   }
 223 
 224   ~G1ParScanThreadStateSet() {
 225     assert(_flushed, "thread local state from the per thread states should have been flushed");
 226     FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
 227     FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total);
 228     FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
 229   }
 230 
 231   void flush();
 232 
 233   G1ParScanThreadState* state_for_worker(uint worker_id);
 234 
 235   void add_cards_scanned(uint worker_id, size_t cards_scanned);
 236   size_t total_cards_scanned() const;
 237   const size_t* surviving_young_words() const;
 238 
< prev index next >