--- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java 2018-01-10 17:33:38.109567017 +0100 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java 2018-01-10 17:33:37.805556996 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.io.PrintStream; import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.debugger.OopHandle; import sun.jvm.hotspot.gc.shared.CollectedHeap; import sun.jvm.hotspot.gc.shared.CollectedHeapName; import sun.jvm.hotspot.runtime.VM; @@ -68,4 +69,27 @@ public ZCollectedHeap(Address addr) { super(addr); } + + public OopHandle oop_load_at(OopHandle handle, long offset) { + assert(!VM.getVM().isCompressedOopsEnabled()); + + Address oopAddress = handle.getAddressAt(offset); + + oopAddress = ZBarrier.weak_barrier(oopAddress); + if (oopAddress == null) { + return null; + } + + return oopAddress.addOffsetToAsOopHandle(0); + } + + public String oopAddressDescription(OopHandle handle) { + Address origOop = ZOop.to_address(handle); + Address loadBarrieredOop = ZBarrier.weak_barrier(origOop); + if (!origOop.equals(loadBarrieredOop)) { + return origOop + " (" + loadBarrieredOop.toString() + ")"; + } else { + return handle.toString(); + } + } }