--- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZBarrier.java 2018-01-13 12:14:31.376604521 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZBarrier.java 2018-01-13 12:14:31.109603798 +0900 @@ -26,8 +26,23 @@ import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.types.TypeDataBase; +import sun.jvm.hotspot.types.WrongTypeException; class ZBarrier { + + private static int ZGlobalPhase; + private static int ZPhaseRelocate; + + static { + VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase())); + } + + private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { + ZGlobalPhase = db.lookupIntConstant("ZGlobalPhase").intValue(); + ZPhaseRelocate = db.lookupIntConstant("ZPhaseRelocate").intValue(); + } + private static boolean is_weak_good_or_null_fast_path(Address addr) { return ZAddress.is_weak_good_or_null(addr); } @@ -37,7 +52,7 @@ } private static boolean during_relocate() { - return ZGlobals.ZGlobalPhase() == ZGlobals.ZPhaseRelocate; + return ZGlobalPhase == ZPhaseRelocate; } private static Address relocate(Address addr) {