< prev index next >

src/hotspot/share/gc/g1/g1CardTable.cpp

Print this page




  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/g1CardTable.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/shared/memset_with_concurrent_readers.hpp"
  29 #include "logging/log.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/orderAccess.inline.hpp"
  32 
  33 bool G1CardTable::mark_card_deferred(size_t card_index) {
  34   jbyte val = _byte_map[card_index];
  35   // It's already processed
  36   if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) {
  37     return false;
  38   }
  39 
  40   // Cached bit can be installed either on a clean card or on a claimed card.
  41   jbyte new_val = val;
  42   if (val == clean_card_val()) {
  43     new_val = (jbyte)deferred_card_val();
  44   } else {
  45     if (val & claimed_card_val()) {
  46       new_val = val | (jbyte)deferred_card_val();
  47     }
  48   }
  49   if (new_val != val) {
  50     Atomic::cmpxchg(new_val, &_byte_map[card_index], val);
  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/g1/g1CardTable.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/shared/memset_with_concurrent_readers.hpp"
  29 #include "logging/log.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/orderAccess.hpp"
  32 
  33 bool G1CardTable::mark_card_deferred(size_t card_index) {
  34   jbyte val = _byte_map[card_index];
  35   // It's already processed
  36   if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) {
  37     return false;
  38   }
  39 
  40   // Cached bit can be installed either on a clean card or on a claimed card.
  41   jbyte new_val = val;
  42   if (val == clean_card_val()) {
  43     new_val = (jbyte)deferred_card_val();
  44   } else {
  45     if (val & claimed_card_val()) {
  46       new_val = val | (jbyte)deferred_card_val();
  47     }
  48   }
  49   if (new_val != val) {
  50     Atomic::cmpxchg(new_val, &_byte_map[card_index], val);
  51   }


< prev index next >