Skip to content

Commit 69daedf

Browse files
committed
8266845: Shenandoah: Simplify SBS::load_reference_barrier implementation
Reviewed-by: shade
1 parent 7433821 commit 69daedf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,27 @@ inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj) {
100100

101101
template <DecoratorSet decorators, class T>
102102
inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj, T* load_addr) {
103+
if (obj == NULL) {
104+
return NULL;
105+
}
103106

104107
// Prevent resurrection of unreachable phantom (i.e. weak-native) references.
105-
if (HasDecorator<decorators, ON_PHANTOM_OOP_REF>::value && obj != NULL &&
108+
if (HasDecorator<decorators, ON_PHANTOM_OOP_REF>::value &&
106109
_heap->is_concurrent_weak_root_in_progress() &&
107110
!_heap->marking_context()->is_marked(obj)) {
108111
return NULL;
109112
}
110113

111114
// Prevent resurrection of unreachable weak references.
112115
if ((HasDecorator<decorators, ON_WEAK_OOP_REF>::value || HasDecorator<decorators, ON_UNKNOWN_OOP_REF>::value) &&
113-
obj != NULL && _heap->is_concurrent_weak_root_in_progress() &&
116+
_heap->is_concurrent_weak_root_in_progress() &&
114117
!_heap->marking_context()->is_marked_strong(obj)) {
115118
return NULL;
116119
}
117120

118121
// Prevent resurrection of unreachable objects that are visited during
119122
// concurrent class-unloading.
120-
if (HasDecorator<decorators, AS_NO_KEEPALIVE>::value && obj != NULL &&
123+
if (HasDecorator<decorators, AS_NO_KEEPALIVE>::value &&
121124
_heap->is_evacuation_in_progress() &&
122125
!_heap->marking_context()->is_marked(obj)) {
123126
return obj;

0 commit comments

Comments
 (0)