--- old/src/hotspot/share/gc/z/zThreadLocalData.hpp 2019-09-04 13:48:39.713212214 +0200 +++ new/src/hotspot/share/gc/z/zThreadLocalData.hpp 2019-09-04 13:48:39.416202162 +0200 @@ -63,22 +63,20 @@ } static void set_invisible_root(Thread* thread, oop* root) { - assert(!has_invisible_root(thread), "Already set"); + assert(data(thread)->_invisible_root == NULL, "Already set"); data(thread)->_invisible_root = root; } static void clear_invisible_root(Thread* thread) { - assert(has_invisible_root(thread), "Should be set"); + assert(data(thread)->_invisible_root != NULL, "Should be set"); data(thread)->_invisible_root = NULL; } - static bool has_invisible_root(Thread* thread) { - return data(thread)->_invisible_root != NULL; - } - - static oop* invisible_root(Thread* thread) { - assert(has_invisible_root(thread), "Should be set"); - return data(thread)->_invisible_root; + template + static void do_invisible_root(Thread* thread, T f) { + if (data(thread)->_invisible_root != NULL) { + f(data(thread)->_invisible_root); + } } static ByteSize address_bad_mask_offset() {