8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject
authorrschatz
Fri, 24 Jun 2016 15:45:47 +0000
changeset 40024 364abc22b287
parent 40022 3eb9922d1a5b
child 40025 aa3e10e809fb
8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject Reviewed-by: kvn
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Wed Jun 22 17:05:40 2016 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Fri Jun 24 15:45:47 2016 +0000
@@ -109,13 +109,7 @@
         }
     }
 
-    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 @@
             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;
     }