8283097: Parallel: Move filler object logic inside PSPromotionLAB::unallocate_object
Reviewed-by: tschatzl, iwalulya
This commit is contained in:
parent
19d34bdf99
commit
f4f87284cb
@ -85,18 +85,19 @@ void PSPromotionLAB::flush() {
|
|||||||
_state = flushed;
|
_state = flushed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
|
void PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
|
||||||
assert(ParallelScavengeHeap::heap()->is_in(obj), "Object outside heap");
|
assert(ParallelScavengeHeap::heap()->is_in(obj), "Object outside heap");
|
||||||
|
|
||||||
|
// If the object is inside this LAB, we just bump-down the `top` pointer.
|
||||||
|
// Otherwise, we overwrite it with a filler object.
|
||||||
if (contains(obj)) {
|
if (contains(obj)) {
|
||||||
HeapWord* object_end = obj + obj_size;
|
HeapWord* object_end = obj + obj_size;
|
||||||
assert(object_end == top(), "Not matching last allocation");
|
assert(object_end == top(), "Not matching last allocation");
|
||||||
|
|
||||||
set_top(obj);
|
set_top(obj);
|
||||||
return true;
|
} else {
|
||||||
|
CollectedHeap::fill_with_object(obj, obj_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill all remaining lab space with an unreachable object.
|
// Fill all remaining lab space with an unreachable object.
|
||||||
|
@ -72,7 +72,7 @@ class PSPromotionLAB : public CHeapObj<mtGC> {
|
|||||||
|
|
||||||
bool is_flushed() { return _state == flushed; }
|
bool is_flushed() { return _state == flushed; }
|
||||||
|
|
||||||
bool unallocate_object(HeapWord* obj, size_t obj_size);
|
void unallocate_object(HeapWord* obj, size_t obj_size);
|
||||||
|
|
||||||
// Returns a subregion containing all objects in this space.
|
// Returns a subregion containing all objects in this space.
|
||||||
MemRegion used_region() { return MemRegion(bottom(), top()); }
|
MemRegion used_region() { return MemRegion(bottom(), top()); }
|
||||||
|
@ -290,15 +290,10 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o,
|
|||||||
assert(o->is_forwarded(), "Object must be forwarded if the cas failed.");
|
assert(o->is_forwarded(), "Object must be forwarded if the cas failed.");
|
||||||
assert(o->forwardee() == forwardee, "invariant");
|
assert(o->forwardee() == forwardee, "invariant");
|
||||||
|
|
||||||
// Try to deallocate the space. If it was directly allocated we cannot
|
|
||||||
// deallocate it, so we have to test. If the deallocation fails,
|
|
||||||
// overwrite with a filler object.
|
|
||||||
if (new_obj_is_tenured) {
|
if (new_obj_is_tenured) {
|
||||||
if (!_old_lab.unallocate_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size)) {
|
_old_lab.unallocate_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size);
|
||||||
CollectedHeap::fill_with_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size);
|
} else {
|
||||||
}
|
_young_lab.unallocate_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size);
|
||||||
} else if (!_young_lab.unallocate_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size)) {
|
|
||||||
CollectedHeap::fill_with_object(cast_from_oop<HeapWord*>(new_obj), new_obj_size);
|
|
||||||
}
|
}
|
||||||
return forwardee;
|
return forwardee;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user