# HG changeset patch # User rprotacio # Date 1471878378 14400 # Node ID 50dd5daad1e636065d60a88bac6adc4e7869b6bd # Parent d4964c292b78a8088e593d4a3973d441fc064a40 8163973: VM Anonymous classes should not call Class File Load Hooks Summary: Ensures CFLH's are not called for VM anonymous classes Reviewed-by: lfoltan, dholmes, coleenp, vlivanov, acorn diff -r d4964c292b78 -r 50dd5daad1e6 hotspot/src/share/vm/classfile/klassFactory.cpp --- a/hotspot/src/share/vm/classfile/klassFactory.cpp Thu Jul 14 09:52:03 2016 +0200 +++ b/hotspot/src/share/vm/classfile/klassFactory.cpp Mon Aug 22 11:06:18 2016 -0400 @@ -31,12 +31,12 @@ #include "prims/jvmtiEnvBase.hpp" #include "trace/traceMacros.hpp" -static ClassFileStream* prologue(ClassFileStream* stream, - Symbol* name, - ClassLoaderData* loader_data, - Handle protection_domain, - JvmtiCachedClassFileData** cached_class_file, - TRAPS) { +static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream, + Symbol* name, + ClassLoaderData* loader_data, + Handle protection_domain, + JvmtiCachedClassFileData** cached_class_file, + TRAPS) { assert(stream != NULL, "invariant"); @@ -102,8 +102,6 @@ assert(loader_data != NULL, "invariant"); assert(THREAD->is_Java_thread(), "must be a JavaThread"); - bool changed_by_loadhook = false; - ResourceMark rm; HandleMark hm; @@ -111,12 +109,15 @@ ClassFileStream* old_stream = stream; - stream = prologue(stream, - name, - loader_data, - protection_domain, - &cached_class_file, - CHECK_NULL); + // Skip this processing for VM anonymous classes + if (host_klass == NULL) { + stream = check_class_file_load_hook(stream, + name, + loader_data, + protection_domain, + &cached_class_file, + CHECK_NULL); + } ClassFileParser parser(stream, name,