--- old/src/hotspot/share/classfile/javaClasses.hpp 2018-10-15 16:24:20.880535144 +0200 +++ new/src/hotspot/share/classfile/javaClasses.hpp 2018-10-15 16:24:20.607523307 +0200 @@ -912,6 +912,7 @@ static inline oop queue(oop ref); static inline void set_queue(oop ref, oop value); static bool is_referent_field(oop obj, ptrdiff_t offset); + static inline bool is_final(oop ref); static inline bool is_phantom(oop ref); }; --- old/src/hotspot/share/classfile/javaClasses.inline.hpp 2018-10-15 16:24:21.258551534 +0200 +++ new/src/hotspot/share/classfile/javaClasses.inline.hpp 2018-10-15 16:24:20.985539697 +0200 @@ -127,6 +127,9 @@ HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) { return ref->obj_field_addr_raw(discovered_offset); } +bool java_lang_ref_Reference::is_final(oop ref) { + return InstanceKlass::cast(ref->klass())->reference_type() == REF_FINAL; +} bool java_lang_ref_Reference::is_phantom(oop ref) { return InstanceKlass::cast(ref->klass())->reference_type() == REF_PHANTOM; } --- old/src/hotspot/share/gc/shared/accessBarrierSupport.cpp 2018-10-15 16:24:21.678569745 +0200 +++ new/src/hotspot/share/gc/shared/accessBarrierSupport.cpp 2018-10-15 16:24:21.361556000 +0200 @@ -29,7 +29,8 @@ DecoratorSet AccessBarrierSupport::resolve_unknown_oop_ref_strength(DecoratorSet decorators, oop base, ptrdiff_t offset) { DecoratorSet ds = decorators & ~ON_UNKNOWN_OOP_REF; - if (!java_lang_ref_Reference::is_referent_field(base, offset)) { + if (!java_lang_ref_Reference::is_referent_field(base, offset) || + java_lang_ref_Reference::is_final(base)) { ds |= ON_STRONG_OOP_REF; } else if (java_lang_ref_Reference::is_phantom(base)) { ds |= ON_PHANTOM_OOP_REF;