1 /*
2 * Copyright (c) 2001, 2018, 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 *
52 }
53 }
54 bool is_correct_type(HeapRegion* hr) { return hr->is_free(); }
55 const char* get_description() { return "Free Regions"; }
56 };
57
58 HeapRegionManager::HeapRegionManager() :
59 _bot_mapper(NULL),
60 _cardtable_mapper(NULL),
61 _card_counts_mapper(NULL),
62 _available_map(mtGC),
63 _num_committed(0),
64 _allocated_heapregions_length(0),
65 _regions(), _heap_mapper(NULL),
66 _prev_bitmap_mapper(NULL),
67 _next_bitmap_mapper(NULL),
68 _free_list("Free list", new MasterFreeRegionListChecker())
69 { }
70
71 HeapRegionManager* HeapRegionManager::create_manager(G1CollectedHeap* heap, G1CollectorPolicy* policy) {
72 if (policy->is_hetero_heap()) {
73 return new HeterogeneousHeapRegionManager((uint)(policy->max_heap_byte_size() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
74 }
75 return new HeapRegionManager();
76 }
77
78 void HeapRegionManager::initialize(G1RegionToSpaceMapper* heap_storage,
79 G1RegionToSpaceMapper* prev_bitmap,
80 G1RegionToSpaceMapper* next_bitmap,
81 G1RegionToSpaceMapper* bot,
82 G1RegionToSpaceMapper* cardtable,
83 G1RegionToSpaceMapper* card_counts) {
84 _allocated_heapregions_length = 0;
85
86 _heap_mapper = heap_storage;
87
88 _prev_bitmap_mapper = prev_bitmap;
89 _next_bitmap_mapper = next_bitmap;
90
91 _bot_mapper = bot;
92 _cardtable_mapper = cardtable;
|
1 /*
2 * Copyright (c) 2001, 2019, 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 *
52 }
53 }
54 bool is_correct_type(HeapRegion* hr) { return hr->is_free(); }
55 const char* get_description() { return "Free Regions"; }
56 };
57
58 HeapRegionManager::HeapRegionManager() :
59 _bot_mapper(NULL),
60 _cardtable_mapper(NULL),
61 _card_counts_mapper(NULL),
62 _available_map(mtGC),
63 _num_committed(0),
64 _allocated_heapregions_length(0),
65 _regions(), _heap_mapper(NULL),
66 _prev_bitmap_mapper(NULL),
67 _next_bitmap_mapper(NULL),
68 _free_list("Free list", new MasterFreeRegionListChecker())
69 { }
70
71 HeapRegionManager* HeapRegionManager::create_manager(G1CollectedHeap* heap, G1CollectorPolicy* policy) {
72 if (policy->is_heap_heterogeneous()) {
73 return new HeterogeneousHeapRegionManager((uint)(policy->max_heap_byte_size() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
74 }
75 return new HeapRegionManager();
76 }
77
78 void HeapRegionManager::initialize(G1RegionToSpaceMapper* heap_storage,
79 G1RegionToSpaceMapper* prev_bitmap,
80 G1RegionToSpaceMapper* next_bitmap,
81 G1RegionToSpaceMapper* bot,
82 G1RegionToSpaceMapper* cardtable,
83 G1RegionToSpaceMapper* card_counts) {
84 _allocated_heapregions_length = 0;
85
86 _heap_mapper = heap_storage;
87
88 _prev_bitmap_mapper = prev_bitmap;
89 _next_bitmap_mapper = next_bitmap;
90
91 _bot_mapper = bot;
92 _cardtable_mapper = cardtable;
|