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

@ -409,19 +409,9 @@ bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words,
HeapWord* q, size_t deadlength) {
if (allowed_deadspace_words >= deadlength) {
allowed_deadspace_words -= deadlength;
oop(q)->set_mark(markOopDesc::prototype()->set_marked());
const size_t min_int_array_size = typeArrayOopDesc::header_size(T_INT);
if (deadlength >= min_int_array_size) {
oop(q)->set_klass(Universe::intArrayKlassObj());
typeArrayOop(q)->set_length((int)((deadlength - min_int_array_size)
* (HeapWordSize/sizeof(jint))));
} else {
assert((int) deadlength == instanceOopDesc::header_size(),
"size for smallest fake dead object doesn't match");
oop(q)->set_klass(SystemDictionary::object_klass());
}
assert((int) deadlength == oop(q)->size(),
"make sure size for fake dead object match");
CollectedHeap::fill_with_object(q, deadlength);
oop(q)->set_mark(oop(q)->mark()->set_marked());
assert((int) deadlength == oop(q)->size(), "bad filler object size");
// Recall that we required "q == compaction_top".
return true;
} else {