--- old/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp 2018-06-08 19:45:18.101026571 +0200 +++ new/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp 2018-06-08 19:45:17.826014639 +0200 @@ -44,6 +44,9 @@ #ifdef COMPILER2 #include "opto/runtime.hpp" #endif +#if INCLUDE_ZGC +#include "gc/z/zThreadLocalData.hpp" +#endif // Declaration and definition of StubGenerator (no .hpp file). // For a more detailed description of the stub routine structure @@ -1026,6 +1029,15 @@ // make sure object is 'reasonable' __ testptr(rax, rax); __ jcc(Assembler::zero, exit); // if obj is NULL it is OK + +#if INCLUDE_ZGC + if (UseZGC) { + // Check if metadata bits indicate a bad oop + __ testptr(rax, Address(r15_thread, ZThreadLocalData::address_bad_mask_offset())); + __ jcc(Assembler::notZero, error); + } +#endif + // Check if the oop is in the right area of memory __ movptr(c_rarg2, rax); __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask());