src/share/vm/gc_interface/collectedHeap.cpp
Print this page
rev 3216 : 7103665: HeapWord*ParallelScavengeHeap::failed_mem_allocate(unsigned long,bool)+0x97
Summary: Make sure that MutableNUMASpace::ensure_parsability() only calls CollectedHeap::fill_with_object() with valid sizes and make sure CollectedHeap::filler_array_max_size() returns a value that can be converted to an int without overflow
Reviewed-by: duke
@@ -83,11 +83,11 @@
{
const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
const size_t elements_per_word = HeapWordSize / sizeof(jint);
_filler_array_max_size = align_object_size(filler_array_hdr_size() +
- max_len * elements_per_word);
+ max_len / elements_per_word);
_barrier_set = NULL;
_is_gc_active = false;
_total_collections = _total_full_collections = 0;
_gc_cause = _gc_lastcause = GCCause::_no_gc;
@@ -301,14 +301,10 @@
size_t CollectedHeap::filler_array_min_size() {
return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment
}
-size_t CollectedHeap::filler_array_max_size() {
- return _filler_array_max_size;
-}
-
#ifdef ASSERT
void CollectedHeap::fill_args_check(HeapWord* start, size_t words)
{
assert(words >= min_fill_size(), "too small to fill");
assert(words % MinObjAlignment == 0, "unaligned size");
@@ -331,10 +327,11 @@
assert(words >= filler_array_min_size(), "too small for an array");
assert(words <= filler_array_max_size(), "too big for a single object");
const size_t payload_size = words - filler_array_hdr_size();
const size_t len = payload_size * HeapWordSize / sizeof(jint);
+ assert((int)len >= 0, err_msg("size too large " SIZE_FORMAT " becomes %d", words, (int)len));
// Set the length first for concurrent GC.
((arrayOop)start)->set_length((int)len);
post_allocation_setup_common(Universe::intArrayKlassObj(), start, words);
DEBUG_ONLY(zap_filler_array(start, words, zap);)