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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_HPP
27
28 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/virtualspace.hpp"
31 #include "utilities/globalDefinitions.hpp"
32
33 // The CollectedHeap type requires subtypes to implement a method
34 // "block_start". For some subtypes, notably generational
35 // systems using card-table-based write barriers, the efficiency of this
36 // operation may be important. Implementations of the "BlockOffsetArray"
37 // class may be useful in providing such efficient implementations.
38 //
39 // While generally mirroring the structure of the BOT for GenCollectedHeap,
40 // the following types are tailored more towards G1's uses; these should,
41 // however, be merged back into a common BOT to avoid code duplication
42 // and reduce maintenance overhead.
43 //
44 // G1BlockOffsetTable (abstract)
45 // -- G1BlockOffsetArray (uses G1BlockOffsetSharedArray)
46 // -- G1BlockOffsetArrayContigSpace
47 //
48 // A main impediment to the consolidation of this code might be the
360 // These must be guaranteed to work properly (i.e., do nothing)
361 // when "blk_start" ("blk" for second version) is "NULL". In this
362 // implementation, that's true because NULL is represented as 0, and thus
363 // never exceeds the "_next_offset_threshold".
364 void alloc_block(HeapWord* blk_start, HeapWord* blk_end) {
365 if (blk_end > _next_offset_threshold)
366 alloc_block_work1(blk_start, blk_end);
367 }
368 void alloc_block(HeapWord* blk, size_t size) {
369 alloc_block(blk, blk+size);
370 }
371
372 HeapWord* block_start_unsafe(const void* addr);
373 HeapWord* block_start_unsafe_const(const void* addr) const;
374
375 void set_for_starts_humongous(HeapWord* new_top);
376
377 virtual void print_on(outputStream* out) PRODUCT_RETURN;
378 };
379
380 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_HPP
|
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 #ifndef SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_HPP
26 #define SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_HPP
27
28 #include "gc/g1/g1RegionToSpaceMapper.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/virtualspace.hpp"
31 #include "utilities/globalDefinitions.hpp"
32
33 // The CollectedHeap type requires subtypes to implement a method
34 // "block_start". For some subtypes, notably generational
35 // systems using card-table-based write barriers, the efficiency of this
36 // operation may be important. Implementations of the "BlockOffsetArray"
37 // class may be useful in providing such efficient implementations.
38 //
39 // While generally mirroring the structure of the BOT for GenCollectedHeap,
40 // the following types are tailored more towards G1's uses; these should,
41 // however, be merged back into a common BOT to avoid code duplication
42 // and reduce maintenance overhead.
43 //
44 // G1BlockOffsetTable (abstract)
45 // -- G1BlockOffsetArray (uses G1BlockOffsetSharedArray)
46 // -- G1BlockOffsetArrayContigSpace
47 //
48 // A main impediment to the consolidation of this code might be the
360 // These must be guaranteed to work properly (i.e., do nothing)
361 // when "blk_start" ("blk" for second version) is "NULL". In this
362 // implementation, that's true because NULL is represented as 0, and thus
363 // never exceeds the "_next_offset_threshold".
364 void alloc_block(HeapWord* blk_start, HeapWord* blk_end) {
365 if (blk_end > _next_offset_threshold)
366 alloc_block_work1(blk_start, blk_end);
367 }
368 void alloc_block(HeapWord* blk, size_t size) {
369 alloc_block(blk, blk+size);
370 }
371
372 HeapWord* block_start_unsafe(const void* addr);
373 HeapWord* block_start_unsafe_const(const void* addr) const;
374
375 void set_for_starts_humongous(HeapWord* new_top);
376
377 virtual void print_on(outputStream* out) PRODUCT_RETURN;
378 };
379
380 #endif // SHARE_VM_GC_G1_G1BLOCKOFFSETTABLE_HPP
|