diff src/share/vm/oops/instanceKlass.hpp @ 7409:30866cd626b0

8004883: NPG: clean up anonymous class fix Summary: Add klass_holder() to return either mirror or class_loader depending on if the class is anonymous or not. Reviewed-by: stefank, jrose
author coleenp
date Wed, 12 Dec 2012 11:39:29 -0500
parents bd7a7ce2e264
children 35431a769282
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.hpp	Fri Dec 07 10:55:16 2012 -0800
+++ b/src/share/vm/oops/instanceKlass.hpp	Wed Dec 12 11:39:29 2012 -0500
@@ -538,6 +538,12 @@
     }
   }
 
+  // Oop that keeps the metadata for this class from being unloaded
+  // in places where the metadata is stored in other places, like nmethods
+  oop klass_holder() const {
+    return is_anonymous() ? java_mirror() : class_loader();
+  }
+
   // signers
   objArrayOop signers() const              { return _signers; }
   void set_signers(objArrayOop s)          { klass_oop_store((oop*)&_signers, s); }