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

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, 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  *
  23  */
  24 
  25 #include "incls/_precompiled.incl"
  26 #include "incls/_sparsePRT.cpp.incl"






  27 
  28 #define SPARSE_PRT_VERBOSE 0
  29 
  30 #define UNROLL_CARD_LOOPS  1
  31 
  32 void SparsePRT::init_iterator(SparsePRTIter* sprt_iter) {
  33     sprt_iter->init(this);
  34 }
  35 
  36 void SparsePRTEntry::init(RegionIdx_t region_ind) {
  37   _region_ind = region_ind;
  38   _next_index = NullEntry;
  39 
  40 #if UNROLL_CARD_LOOPS
  41   assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry");
  42   for (int i = 0; i < cards_num(); i += UnrollFactor) {
  43     _cards[i] = NullEntry;
  44     _cards[i + 1] = NullEntry;
  45     _cards[i + 2] = NullEntry;
  46     _cards[i + 3] = NullEntry;


   1 /*
   2  * Copyright (c) 2001, 2010, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/g1/heapRegion.hpp"
  27 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  28 #include "gc_implementation/g1/sparsePRT.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/cardTableModRefBS.hpp"
  31 #include "memory/space.inline.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 
  34 #define SPARSE_PRT_VERBOSE 0
  35 
  36 #define UNROLL_CARD_LOOPS  1
  37 
  38 void SparsePRT::init_iterator(SparsePRTIter* sprt_iter) {
  39     sprt_iter->init(this);
  40 }
  41 
  42 void SparsePRTEntry::init(RegionIdx_t region_ind) {
  43   _region_ind = region_ind;
  44   _next_index = NullEntry;
  45 
  46 #if UNROLL_CARD_LOOPS
  47   assert((cards_num() & (UnrollFactor - 1)) == 0, "Invalid number of cards in the entry");
  48   for (int i = 0; i < cards_num(); i += UnrollFactor) {
  49     _cards[i] = NullEntry;
  50     _cards[i + 1] = NullEntry;
  51     _cards[i + 2] = NullEntry;
  52     _cards[i + 3] = NullEntry;