8323005: Parallel: Refactor PSPromotionManager::claim_or_forward_depth

Reviewed-by: tschatzl, rrich
This commit is contained in:
Albert Mingkun Yang 2024-01-10 15:18:57 +00:00
parent 16170678a7
commit 2174f6646e
2 changed files with 9 additions and 10 deletions

View File

@ -272,9 +272,7 @@ template <class T> void PSPromotionManager::process_array_chunk_work(
T* p = base + start;
T* const chunk_end = base + end;
while (p < chunk_end) {
if (PSScavenge::should_scavenge(p)) {
claim_or_forward_depth(p);
}
claim_or_forward_depth(p);
++p;
}
}

View File

@ -56,11 +56,14 @@ inline void PSPromotionManager::push_depth(ScannerTask task) {
template <class T>
inline void PSPromotionManager::claim_or_forward_depth(T* p) {
assert(should_scavenge(p, true), "revisiting object?");
assert(ParallelScavengeHeap::heap()->is_in(p), "pointer outside heap");
oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
Prefetch::write(obj->mark_addr(), 0);
push_depth(ScannerTask(p));
T heap_oop = RawAccess<>::oop_load(p);
if (PSScavenge::is_obj_in_young(heap_oop)) {
oop obj = CompressedOops::decode_not_null(heap_oop);
assert(!PSScavenge::is_obj_in_to_space(obj), "revisiting object?");
Prefetch::write(obj->mark_addr(), 0);
push_depth(ScannerTask(p));
}
}
inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj,
@ -96,9 +99,7 @@ class PSPushContentsClosure: public BasicOopIterateClosure {
PSPushContentsClosure(PSPromotionManager* pm) : BasicOopIterateClosure(PSScavenge::reference_processor()), _pm(pm) {}
template <typename T> void do_oop_work(T* p) {
if (PSScavenge::should_scavenge(p)) {
_pm->claim_or_forward_depth(p);
}
_pm->claim_or_forward_depth(p);
}
virtual void do_oop(oop* p) { do_oop_work(p); }