8163973: VM Anonymous classes should not call Class File Load Hooks
authorrprotacio
Mon, 22 Aug 2016 11:06:18 -0400
changeset 40658 50dd5daad1e6
parent 40656 d4964c292b78
child 40659 a2b2936240b9
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
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,