6578152: fill_region_with_object has usability and safety issues

Reviewed-by: apetrusenko, ysr
This commit is contained in:
John Coomes 2008-12-11 12:05:08 -08:00
parent 26f6b1692a
commit 000b184507
25 changed files with 261 additions and 198 deletions

View file

@ -76,8 +76,8 @@ void MutableNUMASpace::ensure_parsability() {
MutableSpace *s = ls->space();
if (s->top() < top()) { // For all spaces preceeding the one containing top()
if (s->free_in_words() > 0) {
SharedHeap::fill_region_with_object(MemRegion(s->top(), s->end()));
size_t area_touched_words = pointer_delta(s->end(), s->top());
CollectedHeap::fill_with_object(s->top(), area_touched_words);
#ifndef ASSERT
if (!ZapUnusedHeapArea) {
area_touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
@ -686,11 +686,11 @@ void MutableNUMASpace::set_top(HeapWord* value) {
// a minimal object; assuming that's not the last chunk in which case we don't care.
if (i < lgrp_spaces()->length() - 1) {
size_t remainder = pointer_delta(s->end(), value);
const size_t minimal_object_size = oopDesc::header_size();
if (remainder < minimal_object_size && remainder > 0) {
// Add a filler object of a minimal size, it will cross the chunk boundary.
SharedHeap::fill_region_with_object(MemRegion(value, minimal_object_size));
value += minimal_object_size;
const size_t min_fill_size = CollectedHeap::min_fill_size();
if (remainder < min_fill_size && remainder > 0) {
// Add a minimum size filler object; it will cross the chunk boundary.
CollectedHeap::fill_with_object(value, min_fill_size);
value += min_fill_size;
assert(!s->contains(value), "Should be in the next chunk");
// Restart the loop from the same chunk, since the value has moved
// to the next one.