8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded

During start up anonymous classes must be kept alive until after their mirror's module field is patched with java.base

Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Reviewed-by: coleenp, hseigel
This commit is contained in:
Per Liden 2016-04-21 09:23:04 -04:00 committed by Lois Foltan
parent 4adb7c0788
commit 48892f6f68
6 changed files with 31 additions and 6 deletions

View file

@ -934,7 +934,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass0(JNIEnv *env, jobject unsafe, j
// this point. The mirror and any instances of this class have to keep
// it alive afterwards.
if (anon_klass() != NULL) {
anon_klass->class_loader_data()->set_keep_alive(false);
anon_klass->class_loader_data()->dec_keep_alive();
}
// let caller initialize it as needed...