8214784: Adjust Dictionary and JNIHandle verification
authorpliden
Wed, 05 Dec 2018 17:11:19 +0100
changeset 52851 f0c62b8f73c0
parent 52850 f527b24990d7
child 52852 eb95a38b2964
8214784: Adjust Dictionary and JNIHandle verification Reviewed-by: coleenp, eosterlund
src/hotspot/share/classfile/dictionary.hpp
src/hotspot/share/runtime/jniHandles.cpp
--- a/src/hotspot/share/classfile/dictionary.hpp	Wed Dec 05 16:40:12 2018 +0100
+++ b/src/hotspot/share/classfile/dictionary.hpp	Wed Dec 05 17:11:19 2018 +0100
@@ -173,7 +173,7 @@
     for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
                                 current != NULL;
                                 current = current->_next) {
-      oopDesc::verify(current->_pd_cache->object_no_keepalive());
+      guarantee(oopDesc::is_oop(current->_pd_cache->object_no_keepalive()), "Invalid oop");
     }
   }
 
--- a/src/hotspot/share/runtime/jniHandles.cpp	Wed Dec 05 16:40:12 2018 +0100
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Wed Dec 05 17:11:19 2018 +0100
@@ -318,7 +318,7 @@
 class VerifyJNIHandles: public OopClosure {
 public:
   virtual void do_oop(oop* root) {
-    oopDesc::verify(*root);
+    guarantee(oopDesc::is_oop(RawAccess<>::oop_load(root)), "Invalid oop");
   }
   virtual void do_oop(narrowOop* root) { ShouldNotReachHere(); }
 };
@@ -327,11 +327,7 @@
   VerifyJNIHandles verify_handle;
 
   oops_do(&verify_handle);
-
-  // JNI weaks are handled concurrently in ZGC, so they can't be verified here
-  if (!UseZGC) {
-    weak_oops_do(&verify_handle);
-  }
+  weak_oops_do(&verify_handle);
 }
 
 // This method is implemented here to avoid circular includes between