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

Print this page
rev 6676 : 8044775: Improve usage of umbrella header atomic.inline.hpp.
Reviewed-by: stefank, kvn


  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_implementation/g1/dirtyCardQueue.hpp"
  27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc_implementation/g1/g1HotCardCache.hpp"
  29 #include "gc_implementation/g1/g1RemSet.hpp"
  30 #include "gc_implementation/g1/heapRegion.hpp"
  31 #include "runtime/atomic.hpp"
  32 
  33 G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h):
  34   _g1h(g1h), _hot_cache(NULL), _use_cache(false), _card_counts(g1h) {}
  35 
  36 void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
  37   if (default_use_cache()) {
  38     _use_cache = true;
  39 
  40     _hot_cache_size = (1 << G1ConcRSLogCacheSize);
  41     _hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC);
  42 
  43     _n_hot = 0;
  44     _hot_cache_idx = 0;
  45 
  46     // For refining the cards in the hot cache in parallel
  47     uint n_workers = (ParallelGCThreads > 0 ?
  48                         _g1h->workers()->total_workers() : 1);
  49     _hot_cache_par_chunk_size = MAX2(1, _hot_cache_size / (int)n_workers);
  50     _hot_cache_par_claimed_idx = 0;
  51 




  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_implementation/g1/dirtyCardQueue.hpp"
  27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc_implementation/g1/g1HotCardCache.hpp"
  29 #include "gc_implementation/g1/g1RemSet.hpp"
  30 #include "gc_implementation/g1/heapRegion.hpp"
  31 #include "runtime/atomic.inline.hpp"
  32 
  33 G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h):
  34   _g1h(g1h), _hot_cache(NULL), _use_cache(false), _card_counts(g1h) {}
  35 
  36 void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
  37   if (default_use_cache()) {
  38     _use_cache = true;
  39 
  40     _hot_cache_size = (1 << G1ConcRSLogCacheSize);
  41     _hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC);
  42 
  43     _n_hot = 0;
  44     _hot_cache_idx = 0;
  45 
  46     // For refining the cards in the hot cache in parallel
  47     uint n_workers = (ParallelGCThreads > 0 ?
  48                         _g1h->workers()->total_workers() : 1);
  49     _hot_cache_par_chunk_size = MAX2(1, _hot_cache_size / (int)n_workers);
  50     _hot_cache_par_claimed_idx = 0;
  51