< prev index next >

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

Print this page
rev 8203 : [mq]: 8073632-cleanup-translation-factor-usage
   1 /*
   2  * Copyright (c) 2001, 2014, 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  *


 162     _offset_array[index] = offset;
 163   }
 164 
 165   inline void set_offset_array(size_t index, u_char offset);
 166 
 167   inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low);
 168 
 169   inline void set_offset_array(size_t left, size_t right, u_char offset);
 170 
 171   bool is_card_boundary(HeapWord* p) const;
 172 
 173 public:
 174 
 175   // Return the number of slots needed for an offset array
 176   // that covers mem_region_words words.
 177   static size_t compute_size(size_t mem_region_words) {
 178     size_t number_of_slots = (mem_region_words / N_words);
 179     return ReservedSpace::allocation_align_size_up(number_of_slots);
 180   }
 181 





 182   enum SomePublicConstants {
 183     LogN = 9,
 184     LogN_words = LogN - LogHeapWordSize,
 185     N_bytes = 1 << LogN,
 186     N_words = 1 << LogN_words
 187   };
 188 
 189   // Initialize the table to cover from "base" to (at least)
 190   // "base + init_word_size".  In the future, the table may be expanded
 191   // (see "resize" below) up to the size of "_reserved" (which must be at
 192   // least "init_word_size".) The contents of the initial table are
 193   // undefined; it is the responsibility of the constituent
 194   // G1BlockOffsetTable(s) to initialize cards.
 195   G1BlockOffsetSharedArray(MemRegion heap, G1RegionToSpaceMapper* storage);
 196 
 197   // Return the appropriate index into "_offset_array" for "p".
 198   inline size_t index_for(const void* p) const;
 199   inline size_t index_for_raw(const void* p) const;
 200 
 201   // Return the address indicating the start of the region corresponding to


   1 /*
   2  * Copyright (c) 2001, 2015, 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  *


 162     _offset_array[index] = offset;
 163   }
 164 
 165   inline void set_offset_array(size_t index, u_char offset);
 166 
 167   inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low);
 168 
 169   inline void set_offset_array(size_t left, size_t right, u_char offset);
 170 
 171   bool is_card_boundary(HeapWord* p) const;
 172 
 173 public:
 174 
 175   // Return the number of slots needed for an offset array
 176   // that covers mem_region_words words.
 177   static size_t compute_size(size_t mem_region_words) {
 178     size_t number_of_slots = (mem_region_words / N_words);
 179     return ReservedSpace::allocation_align_size_up(number_of_slots);
 180   }
 181 
 182   // Returns how many bytes of the heap a single byte of the BOT corresponds to.
 183   static size_t heap_map_factor() {
 184     return N_bytes;
 185   }
 186   
 187   enum SomePublicConstants {
 188     LogN = 9,
 189     LogN_words = LogN - LogHeapWordSize,
 190     N_bytes = 1 << LogN,
 191     N_words = 1 << LogN_words
 192   };
 193 
 194   // Initialize the table to cover from "base" to (at least)
 195   // "base + init_word_size".  In the future, the table may be expanded
 196   // (see "resize" below) up to the size of "_reserved" (which must be at
 197   // least "init_word_size".) The contents of the initial table are
 198   // undefined; it is the responsibility of the constituent
 199   // G1BlockOffsetTable(s) to initialize cards.
 200   G1BlockOffsetSharedArray(MemRegion heap, G1RegionToSpaceMapper* storage);
 201 
 202   // Return the appropriate index into "_offset_array" for "p".
 203   inline size_t index_for(const void* p) const;
 204   inline size_t index_for_raw(const void* p) const;
 205 
 206   // Return the address indicating the start of the region corresponding to


< prev index next >