diff src/share/vm/compiler/compileBroker.cpp @ 7212:291ffc492eb6

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Fri, 14 Dec 2012 14:35:13 +0100
parents 5d0bb7d52783 90273fc0a981
children 989155e2d07a
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Fri Dec 14 10:20:54 2012 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Fri Dec 14 14:35:13 2012 +0100
@@ -275,10 +275,12 @@
                              const char* comment,
                              bool is_blocking) {
   assert(!_lock->is_locked(), "bad locking");
+  InstanceKlass* holder = method->method_holder();
 
   _compile_id = compile_id;
   _method = method();
-  _method_loader = JNIHandles::make_global(_method->method_holder()->class_loader());
+  _method_holder = JNIHandles::make_global(
+        holder->is_anonymous() ? holder->java_mirror(): holder->class_loader());
   _osr_bci = osr_bci;
   _is_blocking = is_blocking;
   _comp_level = comp_level;
@@ -289,7 +291,7 @@
   _code_handle = NULL;
 
   _hot_method = NULL;
-  _hot_method_loader = NULL;
+  _hot_method_holder = NULL;
   _hot_count = hot_count;
   _time_queued = 0;  // tidy
   _comment = comment;
@@ -301,8 +303,12 @@
         _hot_method = _method;
       } else {
         _hot_method = hot_method();
+        // only add loader or mirror if different from _method_holder
+        InstanceKlass* hot_holder = hot_method->method_holder();
+        _hot_method_holder = JNIHandles::make_global(
+               hot_holder->is_anonymous() ? hot_holder->java_mirror() :
+                                            hot_holder->class_loader());
       }
-      _hot_method_loader = JNIHandles::make_global(_hot_method->method_holder()->class_loader());
     }
   }
 
@@ -327,8 +333,8 @@
 void CompileTask::free() {
   set_code(NULL);
   assert(!_lock->is_locked(), "Should not be locked when freed");
-  JNIHandles::destroy_global(_method_loader);
-  JNIHandles::destroy_global(_hot_method_loader);
+  JNIHandles::destroy_global(_method_holder);
+  JNIHandles::destroy_global(_hot_method_holder);
 }