< prev index next >

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

Print this page
rev 13453 : imported patch Atomic_add
   1 /*
   2  * Copyright (c) 2013, 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  *


  50 // first is_dirty check in the write barrier, skipping the remainder
  51 // of the write barrier.
  52 //
  53 // This can significantly reduce the overhead of the write barrier
  54 // code, increasing throughput.
  55 
  56 class G1HotCardCache: public CHeapObj<mtGC> {
  57 
  58   G1CollectedHeap*  _g1h;
  59 
  60   bool              _use_cache;
  61 
  62   G1CardCounts      _card_counts;
  63 
  64 
  65   // The card cache table
  66   jbyte**           _hot_cache;
  67 
  68   size_t            _hot_cache_size;
  69 
  70   int               _hot_cache_par_chunk_size;
  71 
  72   // Avoids false sharing when concurrently updating _hot_cache_idx or
  73   // _hot_cache_par_claimed_idx. These are never updated at the same time
  74   // thus it's not necessary to separate them as well
  75   char _pad_before[DEFAULT_CACHE_LINE_SIZE];
  76 
  77   volatile size_t _hot_cache_idx;
  78 
  79   volatile size_t _hot_cache_par_claimed_idx;
  80 
  81   char _pad_after[DEFAULT_CACHE_LINE_SIZE];
  82 
  83   // The number of cached cards a thread claims when flushing the cache
  84   static const int ClaimChunkSize = 32;
  85 
  86  public:
  87   static bool default_use_cache() {
  88     return (G1ConcRSLogCacheSize > 0);
  89   }
  90 


   1 /*
   2  * Copyright (c) 2013, 2017, 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  *


  50 // first is_dirty check in the write barrier, skipping the remainder
  51 // of the write barrier.
  52 //
  53 // This can significantly reduce the overhead of the write barrier
  54 // code, increasing throughput.
  55 
  56 class G1HotCardCache: public CHeapObj<mtGC> {
  57 
  58   G1CollectedHeap*  _g1h;
  59 
  60   bool              _use_cache;
  61 
  62   G1CardCounts      _card_counts;
  63 
  64 
  65   // The card cache table
  66   jbyte**           _hot_cache;
  67 
  68   size_t            _hot_cache_size;
  69 
  70   size_t            _hot_cache_par_chunk_size;
  71 
  72   // Avoids false sharing when concurrently updating _hot_cache_idx or
  73   // _hot_cache_par_claimed_idx. These are never updated at the same time
  74   // thus it's not necessary to separate them as well
  75   char _pad_before[DEFAULT_CACHE_LINE_SIZE];
  76 
  77   volatile size_t _hot_cache_idx;
  78 
  79   volatile size_t _hot_cache_par_claimed_idx;
  80 
  81   char _pad_after[DEFAULT_CACHE_LINE_SIZE];
  82 
  83   // The number of cached cards a thread claims when flushing the cache
  84   static const int ClaimChunkSize = 32;
  85 
  86  public:
  87   static bool default_use_cache() {
  88     return (G1ConcRSLogCacheSize > 0);
  89   }
  90 


< prev index next >