diff -r 72bdaf11dd6a -r a30461a359f5 src/hotspot/share/classfile/classLoaderData.cpp --- a/src/hotspot/share/classfile/classLoaderData.cpp Mon Sep 10 13:07:42 2018 +0200 +++ b/src/hotspot/share/classfile/classLoaderData.cpp Mon Sep 10 13:07:42 2018 +0200 @@ -671,6 +671,15 @@ } } +// Let the GC read the holder without keeping it alive. +oop ClassLoaderData::holder_no_keepalive() const { + if (!_holder.is_null()) { // NULL class_loader + return _holder.peek(); + } else { + return NULL; + } +} + // Unloading support bool ClassLoaderData::is_alive() const { bool alive = keep_alive() // null class loader and incomplete unsafe anonymous klasses.