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

Print this page
rev 6588 : imported patch 8047820.includefixes


  82       // Do better than this for Merlin
  83       vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion");
  84     }
  85     assert(_vs.high() == high + delta, "invalid expansion");
  86     // Initialization of the contents is left to the
  87     // G1BlockOffsetArray that uses it.
  88   } else {
  89     delta = ReservedSpace::page_align_size_down(old_size - new_size);
  90     if (delta == 0) return;
  91     _vs.shrink_by(delta);
  92     assert(_vs.high() == high - delta, "invalid expansion");
  93   }
  94 }
  95 
  96 bool G1BlockOffsetSharedArray::is_card_boundary(HeapWord* p) const {
  97   assert(p >= _reserved.start(), "just checking");
  98   size_t delta = pointer_delta(p, _reserved.start());
  99   return (delta & right_n_bits(LogN_words)) == (size_t)NoBits;
 100 }
 101 














 102 
 103 //////////////////////////////////////////////////////////////////////
 104 // G1BlockOffsetArray
 105 //////////////////////////////////////////////////////////////////////
 106 
 107 G1BlockOffsetArray::G1BlockOffsetArray(G1BlockOffsetSharedArray* array,
 108                                        MemRegion mr, bool init_to_zero) :
 109   G1BlockOffsetTable(mr.start(), mr.end()),
 110   _unallocated_block(_bottom),
 111   _array(array), _gsp(NULL),
 112   _init_to_zero(init_to_zero) {
 113   assert(_bottom <= _end, "arguments out of order");
 114   if (!_init_to_zero) {
 115     // initialize cards to point back to mr.start()
 116     set_remainder_to_point_to_start(mr.start() + N_words, mr.end());
 117     _array->set_offset_array(0, 0);  // set first card to 0
 118   }
 119 }
 120 
 121 void G1BlockOffsetArray::set_space(G1OffsetTableContigSpace* sp) {




  82       // Do better than this for Merlin
  83       vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion");
  84     }
  85     assert(_vs.high() == high + delta, "invalid expansion");
  86     // Initialization of the contents is left to the
  87     // G1BlockOffsetArray that uses it.
  88   } else {
  89     delta = ReservedSpace::page_align_size_down(old_size - new_size);
  90     if (delta == 0) return;
  91     _vs.shrink_by(delta);
  92     assert(_vs.high() == high - delta, "invalid expansion");
  93   }
  94 }
  95 
  96 bool G1BlockOffsetSharedArray::is_card_boundary(HeapWord* p) const {
  97   assert(p >= _reserved.start(), "just checking");
  98   size_t delta = pointer_delta(p, _reserved.start());
  99   return (delta & right_n_bits(LogN_words)) == (size_t)NoBits;
 100 }
 101 
 102 void G1BlockOffsetSharedArray::set_offset_array(HeapWord* left, HeapWord* right, u_char offset) {
 103   check_index(index_for(right - 1), "right address out of range");
 104   assert(left  < right, "Heap addresses out of order");
 105   size_t num_cards = pointer_delta(right, left) >> LogN_words;
 106   if (UseMemSetInBOT) {
 107     memset(&_offset_array[index_for(left)], offset, num_cards);
 108   } else {
 109     size_t i = index_for(left);
 110     const size_t end = i + num_cards;
 111     for (; i < end; i++) {
 112       _offset_array[i] = offset;
 113     }
 114   }
 115 }
 116 
 117 //////////////////////////////////////////////////////////////////////
 118 // G1BlockOffsetArray
 119 //////////////////////////////////////////////////////////////////////
 120 
 121 G1BlockOffsetArray::G1BlockOffsetArray(G1BlockOffsetSharedArray* array,
 122                                        MemRegion mr, bool init_to_zero) :
 123   G1BlockOffsetTable(mr.start(), mr.end()),
 124   _unallocated_block(_bottom),
 125   _array(array), _gsp(NULL),
 126   _init_to_zero(init_to_zero) {
 127   assert(_bottom <= _end, "arguments out of order");
 128   if (!_init_to_zero) {
 129     // initialize cards to point back to mr.start()
 130     set_remainder_to_point_to_start(mr.start() + N_words, mr.end());
 131     _array->set_offset_array(0, 0);  // set first card to 0
 132   }
 133 }
 134 
 135 void G1BlockOffsetArray::set_space(G1OffsetTableContigSpace* sp) {