changeset 7229:008f91ddb031

8059924: com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java: assert(Universe::verify_in_progress() || !SafepointSynchronize::is_at_safepoint()) failed: invariant Summary: Revive the hashcode installation in Verifier Reviewed-by: kamg, lfoltan
author shade
date Thu, 09 Oct 2014 16:41:28 +0400
parents a008f00ee14c
children 1bbee5075b0e d1b65075a01c
files src/share/vm/classfile/verifier.cpp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/verifier.cpp	Thu Oct 09 16:56:27 2014 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Thu Oct 09 16:41:28 2014 +0400
@@ -98,6 +98,19 @@
   HandleMark hm;
   ResourceMark rm(THREAD);
 
+  // Eagerly allocate the identity hash code for a klass. This is a fallout
+  // from 6320749 and 8059924: hash code generator is not supposed to be called
+  // during the safepoint, but it allows to sneak the hashcode in during
+  // verification. Without this eager hashcode generation, we may end up
+  // installing the hashcode during some other operation, which may be at
+  // safepoint -- blowing up the checks. It was previously done as the side
+  // effect (sic!) for external_name(), but instead of doing that, we opt to
+  // explicitly push the hashcode in here. This is signify the following block
+  // is IMPORTANT:
+  if (klass->java_mirror() != NULL) {
+    klass->java_mirror()->identity_hash();
+  }
+
   if (!is_eligible_for_verification(klass, should_verify_class)) {
     return true;
   }