From 1ecfe15d17cd680cf78a389eda2aa3be828d33c9 Mon Sep 17 00:00:00 2001 From: Roland Schatz Date: Fri, 24 Jun 2016 15:45:47 +0000 Subject: [PATCH] 8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject Reviewed-by: kvn --- .../vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java index 6bdf2ee4598..be8e3a32067 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @@ -109,13 +109,7 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { } } - private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) { - if (compressed == runtime.getConfig().useCompressedOops) { - Object obj = asObject(base); - if (obj != null) { - assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; - } - } + private boolean verifyReadRawObject(Object expected, Constant base, long displacement) { if (base instanceof HotSpotMetaspaceConstant) { MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) { @@ -136,11 +130,11 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { assert !compressed; displacement += asRawPointer(baseConstant); ret = UNSAFE.getUncompressedObject(displacement); + assert verifyReadRawObject(ret, baseConstant, initialDisplacement); } else { assert runtime.getConfig().useCompressedOops == compressed; ret = UNSAFE.getObject(base, displacement); } - assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed); return ret; }