1 /*
2 * Copyright (c) 2001, 2012, 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 *
1192 uint max_regions() { return _hrs.max_length(); }
1193
1194 // The number of regions that are completely free.
1195 uint free_regions() { return _free_list.length(); }
1196
1197 // The number of regions that are not completely free.
1198 uint used_regions() { return n_regions() - free_regions(); }
1199
1200 // The number of regions available for "regular" expansion.
1201 uint expansion_regions() { return _expansion_regions; }
1202
1203 // Factory method for HeapRegion instances. It will return NULL if
1204 // the allocation fails.
1205 HeapRegion* new_heap_region(uint hrs_index, HeapWord* bottom);
1206
1207 void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1208 void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1209 void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
1210 void verify_dirty_young_regions() PRODUCT_RETURN;
1211
1212 // verify_region_sets() performs verification over the region
1213 // lists. It will be compiled in the product code to be used when
1214 // necessary (i.e., during heap verification).
1215 void verify_region_sets();
1216
1217 // verify_region_sets_optional() is planted in the code for
1218 // list verification in non-product builds (and it can be enabled in
1219 // product builds by definning HEAP_REGION_SET_FORCE_VERIFY to be 1).
1220 #if HEAP_REGION_SET_FORCE_VERIFY
1221 void verify_region_sets_optional() {
1222 verify_region_sets();
1223 }
1224 #else // HEAP_REGION_SET_FORCE_VERIFY
1225 void verify_region_sets_optional() { }
1226 #endif // HEAP_REGION_SET_FORCE_VERIFY
1227
1228 #ifdef ASSERT
1229 bool is_on_master_free_list(HeapRegion* hr) {
1230 return hr->containing_set() == &_free_list;
1231 }
|
1 /*
2 * Copyright (c) 2001, 2013, 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 *
1192 uint max_regions() { return _hrs.max_length(); }
1193
1194 // The number of regions that are completely free.
1195 uint free_regions() { return _free_list.length(); }
1196
1197 // The number of regions that are not completely free.
1198 uint used_regions() { return n_regions() - free_regions(); }
1199
1200 // The number of regions available for "regular" expansion.
1201 uint expansion_regions() { return _expansion_regions; }
1202
1203 // Factory method for HeapRegion instances. It will return NULL if
1204 // the allocation fails.
1205 HeapRegion* new_heap_region(uint hrs_index, HeapWord* bottom);
1206
1207 void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1208 void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1209 void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
1210 void verify_dirty_young_regions() PRODUCT_RETURN;
1211
1212 #ifndef PRODUCT
1213 // Make sure that the given bitmap has no marked objects in the
1214 // range [from,limit). If it does, print an error message and return
1215 // false. Otherwise, just return true. bitmap_name should be "prev"
1216 // or "next".
1217 bool verify_bitmap(const char* bitmap_name, CMBitMapRO* bitmap,
1218 HeapWord* from, HeapWord* limit);
1219
1220 // Verify that the prev / next bitmap range [tams,end) for the given
1221 // region has no marks. Return true if all is well, false if errors
1222 // are detected.
1223 bool verify_bitmaps(const char* caller, HeapRegion* hr);
1224 #endif // PRODUCT
1225
1226 // If G1VerifyBitmaps is set, verify that the marking bitmaps for
1227 // the given region do not have any spurious marks. If errors are
1228 // detected, print appropriate error messages and crash.
1229 void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
1230
1231 // If G1VerifyBitmaps is set, verify that the marking bitmaps do not
1232 // have any spurious marks. If errors are detected, print
1233 // appropriate error messages and crash.
1234 void check_bitmaps(const char* caller) PRODUCT_RETURN;
1235
1236 // verify_region_sets() performs verification over the region
1237 // lists. It will be compiled in the product code to be used when
1238 // necessary (i.e., during heap verification).
1239 void verify_region_sets();
1240
1241 // verify_region_sets_optional() is planted in the code for
1242 // list verification in non-product builds (and it can be enabled in
1243 // product builds by definning HEAP_REGION_SET_FORCE_VERIFY to be 1).
1244 #if HEAP_REGION_SET_FORCE_VERIFY
1245 void verify_region_sets_optional() {
1246 verify_region_sets();
1247 }
1248 #else // HEAP_REGION_SET_FORCE_VERIFY
1249 void verify_region_sets_optional() { }
1250 #endif // HEAP_REGION_SET_FORCE_VERIFY
1251
1252 #ifdef ASSERT
1253 bool is_on_master_free_list(HeapRegion* hr) {
1254 return hr->containing_set() == &_free_list;
1255 }
|