From 12c889177053ebdbc7dd2fc7f48de2c1219c7958 Mon Sep 17 00:00:00 2001 From: coleenp Date: Fri, 20 Jun 2014 10:48:36 -0400 Subject: [PATCH] 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 --- src/share/vm/classfile/classFileParser.cpp | 5 +++++ src/share/vm/classfile/systemDictionary.cpp | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp index 87eca8ea6..3eee41d55 100644 --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -4022,6 +4022,11 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, 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, diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp index b2754ed35..3b0cf3cc4 100644 --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -997,7 +997,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name, if (host_klass.not_null() && k.not_null()) { assert(EnableInvokeDynamic, ""); - k->set_host_klass(host_klass()); // If it's anonymous, initialize it now, since nobody else will. { -- GitLab