< prev index next >

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

Print this page
rev 12504 : 8173764: G1 BOT wrongly assumes that objects must always begin at the start of G1BlockOffsetTablePart
Reviewed-by:
rev 12505 : [mq]: 8173764-rev-tschatzl
   1 /*
   2  * Copyright (c) 2001, 2016, 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  *


 100   inline size_t index_for(const void* p) const;
 101   inline size_t index_for_raw(const void* p) const;
 102 
 103   // Return the address indicating the start of the region corresponding to
 104   // "index" in "_offset_array".
 105   inline HeapWord* address_for_index(size_t index) const;
 106   // Variant of address_for_index that does not check the index for validity.
 107   inline HeapWord* address_for_index_raw(size_t index) const {
 108     return _reserved.start() + (index << BOTConstants::LogN_words);
 109   }
 110 };
 111 
 112 class G1BlockOffsetTablePart VALUE_OBJ_CLASS_SPEC {
 113   friend class G1BlockOffsetTable;
 114   friend class VMStructs;
 115 private:
 116   // allocation boundary at which offset array must be updated
 117   HeapWord* _next_offset_threshold;
 118   size_t    _next_offset_index;      // index corresponding to that boundary
 119 



 120   // This is the global BlockOffsetTable.
 121   G1BlockOffsetTable* _bot;
 122 
 123   // The space that owns this subregion.
 124   G1ContiguousSpace* _space;
 125 
 126   // Sets the entries
 127   // corresponding to the cards starting at "start" and ending at "end"
 128   // to point back to the card before "start": the interval [start, end)
 129   // is right-open.
 130   void set_remainder_to_point_to_start(HeapWord* start, HeapWord* end);
 131   // Same as above, except that the args here are a card _index_ interval
 132   // that is closed: [start_index, end_index]
 133   void set_remainder_to_point_to_start_incl(size_t start, size_t end);
 134 
 135   // Zero out the entry for _bottom (offset will be zero). Does not check for availability of the
 136   // memory first.
 137   void zero_bottom_entry_raw();
 138   // Variant of initialize_threshold that does not check for availability of the
 139   // memory first.


 207   }
 208 
 209   // Return the next threshold, the point at which the table should be
 210   // updated.
 211   HeapWord* threshold() const { return _next_offset_threshold; }
 212 
 213   // These must be guaranteed to work properly (i.e., do nothing)
 214   // when "blk_start" ("blk" for second version) is "NULL".  In this
 215   // implementation, that's true because NULL is represented as 0, and thus
 216   // never exceeds the "_next_offset_threshold".
 217   void alloc_block(HeapWord* blk_start, HeapWord* blk_end) {
 218     if (blk_end > _next_offset_threshold) {
 219       alloc_block_work(&_next_offset_threshold, &_next_offset_index, blk_start, blk_end);
 220     }
 221   }
 222   void alloc_block(HeapWord* blk, size_t size) {
 223     alloc_block(blk, blk+size);
 224   }
 225 
 226   void set_for_starts_humongous(HeapWord* obj_top, size_t fill_size);

 227 
 228   void print_on(outputStream* out) PRODUCT_RETURN;
 229 };
 230 
 231 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_HPP
   1 /*
   2  * Copyright (c) 2001, 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  *


 100   inline size_t index_for(const void* p) const;
 101   inline size_t index_for_raw(const void* p) const;
 102 
 103   // Return the address indicating the start of the region corresponding to
 104   // "index" in "_offset_array".
 105   inline HeapWord* address_for_index(size_t index) const;
 106   // Variant of address_for_index that does not check the index for validity.
 107   inline HeapWord* address_for_index_raw(size_t index) const {
 108     return _reserved.start() + (index << BOTConstants::LogN_words);
 109   }
 110 };
 111 
 112 class G1BlockOffsetTablePart VALUE_OBJ_CLASS_SPEC {
 113   friend class G1BlockOffsetTable;
 114   friend class VMStructs;
 115 private:
 116   // allocation boundary at which offset array must be updated
 117   HeapWord* _next_offset_threshold;
 118   size_t    _next_offset_index;      // index corresponding to that boundary
 119 
 120   // Indicates if an object can span into this G1BlockOffsetTablePart.
 121   debug_only(bool _object_can_span;)
 122 
 123   // This is the global BlockOffsetTable.
 124   G1BlockOffsetTable* _bot;
 125 
 126   // The space that owns this subregion.
 127   G1ContiguousSpace* _space;
 128 
 129   // Sets the entries
 130   // corresponding to the cards starting at "start" and ending at "end"
 131   // to point back to the card before "start": the interval [start, end)
 132   // is right-open.
 133   void set_remainder_to_point_to_start(HeapWord* start, HeapWord* end);
 134   // Same as above, except that the args here are a card _index_ interval
 135   // that is closed: [start_index, end_index]
 136   void set_remainder_to_point_to_start_incl(size_t start, size_t end);
 137 
 138   // Zero out the entry for _bottom (offset will be zero). Does not check for availability of the
 139   // memory first.
 140   void zero_bottom_entry_raw();
 141   // Variant of initialize_threshold that does not check for availability of the
 142   // memory first.


 210   }
 211 
 212   // Return the next threshold, the point at which the table should be
 213   // updated.
 214   HeapWord* threshold() const { return _next_offset_threshold; }
 215 
 216   // These must be guaranteed to work properly (i.e., do nothing)
 217   // when "blk_start" ("blk" for second version) is "NULL".  In this
 218   // implementation, that's true because NULL is represented as 0, and thus
 219   // never exceeds the "_next_offset_threshold".
 220   void alloc_block(HeapWord* blk_start, HeapWord* blk_end) {
 221     if (blk_end > _next_offset_threshold) {
 222       alloc_block_work(&_next_offset_threshold, &_next_offset_index, blk_start, blk_end);
 223     }
 224   }
 225   void alloc_block(HeapWord* blk, size_t size) {
 226     alloc_block(blk, blk+size);
 227   }
 228 
 229   void set_for_starts_humongous(HeapWord* obj_top, size_t fill_size);
 230   void set_object_can_span(bool can_span) PRODUCT_RETURN;
 231 
 232   void print_on(outputStream* out) PRODUCT_RETURN;
 233 };
 234 
 235 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_HPP
< prev index next >