8163973: VM Anonymous classes should not call Class File Load Hooks

Ensures CFLH's are not called for VM anonymous classes

Reviewed-by: lfoltan, dholmes, coleenp, vlivanov, acorn
This commit is contained in:
Rachel Protacio 2016-08-22 11:06:18 -04:00
parent 11852cb5fa
commit fca8d5b7b1

View File

@ -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 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream,
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 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream,
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,