8039150: host_klass invariant fails when verifying newly loaded JSR-292 anonymous classes
authorcoleenp
Wed, 18 Jun 2014 13:58:13 -0400
changeset 25066 57d8cb758cf8
parent 25065 fbb17c582d13
child 25068 de4b1c96dca3
8039150: host_klass invariant fails when verifying newly loaded JSR-292 anonymous classes Summary: Initialize host_klass while parsing the class with the other initializations. Reviewed-by: sspitsyn, stefank
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/classfile/systemDictionary.cpp
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Jun 17 11:18:10 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jun 18 13:58:13 2014 -0400
@@ -4070,6 +4070,11 @@
     this_klass->set_major_version(major_version);
     this_klass->set_has_default_methods(has_default_methods);
 
+    if (!host_klass.is_null()) {
+      assert (this_klass->is_anonymous(), "should be the same");
+      this_klass->set_host_klass(host_klass());
+    }
+
     // Set up Method*::intrinsic_id as soon as we know the names of methods.
     // (We used to do this lazily, but now we query it in Rewriter,
     // which is eagerly done for every method, so we might as well do it now,
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue Jun 17 11:18:10 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jun 18 13:58:13 2014 -0400
@@ -997,7 +997,6 @@
 
 
   if (host_klass.not_null() && k.not_null()) {
-    k->set_host_klass(host_klass());
     // If it's anonymous, initialize it now, since nobody else will.
 
     {