--- old/src/hotspot/share/oops/instanceRefKlass.inline.hpp 2018-06-06 00:37:31.729415065 +0200 +++ new/src/hotspot/share/oops/instanceRefKlass.inline.hpp 2018-06-06 00:37:31.469403869 +0200 @@ -53,16 +53,19 @@ } } +static inline oop load_referent(oop obj, ReferenceType type) { + if (type == REF_PHANTOM) { + return HeapAccess::oop_load(java_lang_ref_Reference::referent_addr_raw(obj)); + } else { + return HeapAccess::oop_load(java_lang_ref_Reference::referent_addr_raw(obj)); + } +} + template bool InstanceRefKlass::try_discover(oop obj, ReferenceType type, OopClosureType* closure) { ReferenceDiscoverer* rd = closure->ref_discoverer(); if (rd != NULL) { - oop referent; - if (type == REF_PHANTOM) { - referent = HeapAccess::oop_load(java_lang_ref_Reference::referent_addr_raw(obj)); - } else { - referent = HeapAccess::oop_load(java_lang_ref_Reference::referent_addr_raw(obj)); - } + oop referent = load_referent(obj, type); if (referent != NULL) { if (!referent->is_gc_marked()) { // Only try to discover if not yet marked.