< prev index next >

src/share/vm/gc/shared/cardGeneration.cpp

Print this page
rev 8393 : 8077842: Remove the level parameter passed around in GenCollectedHeap
Reviewed-by:


  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 
  27 #include "gc/shared/blockOffsetTable.inline.hpp"
  28 #include "gc/shared/cardGeneration.inline.hpp"
  29 #include "gc/shared/gcLocker.hpp"
  30 #include "gc/shared/genOopClosures.inline.hpp"
  31 #include "gc/shared/genRemSet.hpp"
  32 #include "gc/shared/generationSpec.hpp"
  33 #include "gc/shared/space.inline.hpp"
  34 #include "memory/iterator.hpp"
  35 #include "memory/memRegion.hpp"
  36 #include "runtime/java.hpp"
  37 
  38 CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size,
  39                                int level,
  40                                GenRemSet* remset) :
  41   Generation(rs, initial_byte_size, level), _rs(remset),
  42   _shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(),
  43   _used_at_prologue()
  44 {
  45   HeapWord* start = (HeapWord*)rs.base();
  46   size_t reserved_byte_size = rs.size();
  47   assert((uintptr_t(start) & 3) == 0, "bad alignment");
  48   assert((reserved_byte_size & 3) == 0, "bad alignment");
  49   MemRegion reserved_mr(start, heap_word_size(reserved_byte_size));
  50   _bts = new BlockOffsetSharedArray(reserved_mr,
  51                                     heap_word_size(initial_byte_size));
  52   MemRegion committed_mr(start, heap_word_size(initial_byte_size));
  53   _rs->resize_covered_region(committed_mr);
  54   if (_bts == NULL) {
  55     vm_exit_during_initialization("Could not allocate a BlockOffsetArray");
  56   }
  57 
  58   // Verify that the start and end of this generation is the start of a card.
  59   // If this wasn't true, a single card could span more than on generation,
  60   // which would cause problems when we commit/uncommit memory, and when we
  61   // clear and dirty cards.




  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 
  27 #include "gc/shared/blockOffsetTable.inline.hpp"
  28 #include "gc/shared/cardGeneration.inline.hpp"
  29 #include "gc/shared/gcLocker.hpp"
  30 #include "gc/shared/genOopClosures.inline.hpp"
  31 #include "gc/shared/genRemSet.hpp"
  32 #include "gc/shared/generationSpec.hpp"
  33 #include "gc/shared/space.inline.hpp"
  34 #include "memory/iterator.hpp"
  35 #include "memory/memRegion.hpp"
  36 #include "runtime/java.hpp"
  37 
  38 CardGeneration::CardGeneration(ReservedSpace rs,
  39                                size_t initial_byte_size,
  40                                GenRemSet* remset) :
  41   Generation(rs, initial_byte_size), _rs(remset),
  42   _shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(),
  43   _used_at_prologue()
  44 {
  45   HeapWord* start = (HeapWord*)rs.base();
  46   size_t reserved_byte_size = rs.size();
  47   assert((uintptr_t(start) & 3) == 0, "bad alignment");
  48   assert((reserved_byte_size & 3) == 0, "bad alignment");
  49   MemRegion reserved_mr(start, heap_word_size(reserved_byte_size));
  50   _bts = new BlockOffsetSharedArray(reserved_mr,
  51                                     heap_word_size(initial_byte_size));
  52   MemRegion committed_mr(start, heap_word_size(initial_byte_size));
  53   _rs->resize_covered_region(committed_mr);
  54   if (_bts == NULL) {
  55     vm_exit_during_initialization("Could not allocate a BlockOffsetArray");
  56   }
  57 
  58   // Verify that the start and end of this generation is the start of a card.
  59   // If this wasn't true, a single card could span more than on generation,
  60   // which would cause problems when we commit/uncommit memory, and when we
  61   // clear and dirty cards.


< prev index next >