< prev index next >
src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -58,15 +58,33 @@
const size_t _max_gen_size;
// Used when initializing the _name field.
static inline const char* select_name();
+#ifdef ASSERT
+ void assert_block_in_covered_region(MemRegion new_memregion) {
+ // Explictly capture current covered_region in a local
+ MemRegion covered_region = this->start_array()->covered_region();
+ assert(covered_region.contains(new_memregion),
+ err_msg("new region is not in covered_region [ "PTR_FORMAT", "PTR_FORMAT" ], "
+ "new region [ "PTR_FORMAT", "PTR_FORMAT" ], "
+ "object space [ "PTR_FORMAT", "PTR_FORMAT" ]",
+ p2i(covered_region.start()),
+ p2i(covered_region.end()),
+ p2i(new_memregion.start()),
+ p2i(new_memregion.end()),
+ p2i(this->object_space()->used_region().start()),
+ p2i(this->object_space()->used_region().end())));
+ }
+#endif
+
HeapWord* allocate_noexpand(size_t word_size) {
// We assume the heap lock is held here.
assert_locked_or_safepoint(Heap_lock);
HeapWord* res = object_space()->allocate(word_size);
if (res != NULL) {
+ DEBUG_ONLY(assert_block_in_covered_region(MemRegion(res, word_size)));
_start_array.allocate_block(res);
}
return res;
}
@@ -75,10 +93,11 @@
// safe for use at the same time as allocate_noexpand()!
HeapWord* cas_allocate_noexpand(size_t word_size) {
assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint");
HeapWord* res = object_space()->cas_allocate(word_size);
if (res != NULL) {
+ DEBUG_ONLY(assert_block_in_covered_region(MemRegion(res, word_size)));
_start_array.allocate_block(res);
}
return res;
}
< prev index next >