8266845: Shenandoah: Simplify SBS::load_reference_barrier implementation

Reviewed-by: shade
This commit is contained in:
Zhengyu Gu 2021-05-12 12:34:55 +00:00
parent 7433821910
commit 69daedfd23

@ -100,9 +100,12 @@ inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj) {
template <DecoratorSet decorators, class T>
inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj, T* load_addr) {
if (obj == NULL) {
return NULL;
}
// Prevent resurrection of unreachable phantom (i.e. weak-native) references.
if (HasDecorator<decorators, ON_PHANTOM_OOP_REF>::value && obj != NULL &&
if (HasDecorator<decorators, ON_PHANTOM_OOP_REF>::value &&
_heap->is_concurrent_weak_root_in_progress() &&
!_heap->marking_context()->is_marked(obj)) {
return NULL;
@ -110,14 +113,14 @@ inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj, T* load_addr) {
// Prevent resurrection of unreachable weak references.
if ((HasDecorator<decorators, ON_WEAK_OOP_REF>::value || HasDecorator<decorators, ON_UNKNOWN_OOP_REF>::value) &&
obj != NULL && _heap->is_concurrent_weak_root_in_progress() &&
_heap->is_concurrent_weak_root_in_progress() &&
!_heap->marking_context()->is_marked_strong(obj)) {
return NULL;
}
// Prevent resurrection of unreachable objects that are visited during
// concurrent class-unloading.
if (HasDecorator<decorators, AS_NO_KEEPALIVE>::value && obj != NULL &&
if (HasDecorator<decorators, AS_NO_KEEPALIVE>::value &&
_heap->is_evacuation_in_progress() &&
!_heap->marking_context()->is_marked(obj)) {
return obj;