8251359: Shenandoah: filter null oops before calling enqueue/SATB barrier

Reviewed-by: shade
This commit is contained in:
Zhengyu Gu 2020-08-11 14:41:52 -04:00
parent 5d2f6e737b
commit 7ca448b4fc
2 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,7 @@ inline oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, T* load
}
inline void ShenandoahBarrierSet::enqueue(oop obj) {
assert(obj != NULL, "checked by caller");
assert(_satb_mark_queue_set.is_active(), "only get here when SATB active");
// Filter marked objects before hitting the SATB queues. The same predicate would
@ -116,6 +117,7 @@ inline void ShenandoahBarrierSet::storeval_barrier(oop obj) {
inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oop value) {
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
assert(value != NULL, "checked by caller");
const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
const bool peek = (decorators & AS_NO_KEEPALIVE) != 0;
if (!peek && !on_strong_oop_ref) {
@ -125,6 +127,7 @@ inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oo
template <DecoratorSet decorators>
inline void ShenandoahBarrierSet::keep_alive_if_weak(oop value) {
assert(value != NULL, "checked by caller");
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value &&
!HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {

View File

@ -1325,7 +1325,7 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
// Keep alive an object that was loaded with AS_NO_KEEPALIVE.
void ShenandoahHeap::keep_alive(oop obj) {
if (is_concurrent_mark_in_progress()) {
if (is_concurrent_mark_in_progress() && (obj != NULL)) {
ShenandoahBarrierSet::barrier_set()->enqueue(obj);
}
}