< prev index next >

src/share/vm/ci/ciObjectFactory.cpp

Print this page
rev 12906 : [mq]: gc_interface

@@ -45,13 +45,10 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "memory/allocation.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/fieldType.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-# include "gc/g1/g1SATBCardTableModRefBS.hpp"
-#endif
 
 // ciObjectFactory
 //
 // This class handles requests for the creation of new instances
 // of ciObject and its subclasses.  It contains a caching mechanism

@@ -177,11 +174,11 @@
     }
   }
 
   ciEnv::_unloaded_cisymbol = ciObjectFactory::get_symbol(vmSymbols::dummy_symbol());
   // Create dummy InstanceKlass and ObjArrayKlass object and assign them idents
-  ciEnv::_unloaded_ciinstance_klass = new (_arena) ciInstanceKlass(ciEnv::_unloaded_cisymbol, NULL, NULL);
+  ciEnv::_unloaded_ciinstance_klass = new (_arena) ciInstanceKlass(ciEnv::_unloaded_cisymbol, NULL, NULL, NULL);
   init_ident_of(ciEnv::_unloaded_ciinstance_klass);
   ciEnv::_unloaded_ciobjarrayklass = new (_arena) ciObjArrayKlass(ciEnv::_unloaded_cisymbol, ciEnv::_unloaded_ciinstance_klass, 1);
   init_ident_of(ciEnv::_unloaded_ciobjarrayklass);
   assert(ciEnv::_unloaded_ciobjarrayklass->is_obj_array_klass(), "just checking");
 

@@ -361,23 +358,10 @@
 // Implementation note: in order to keep Metadata live, an auxiliary ciObject
 // is used, which points to it's holder.
 ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
   EXCEPTION_CONTEXT;
 
-  // Hold metadata from unloading by keeping it's holder alive.
-  if (_initialized && o->is_klass()) {
-    Klass* holder = ((Klass*)o);
-    if (holder->is_instance_klass() && InstanceKlass::cast(holder)->is_anonymous()) {
-      // Though ciInstanceKlass records class loader oop, it's not enough to keep
-      // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
-      // It is enough to record a ciObject, since cached elements are never removed
-      // during ciObjectFactory lifetime. ciObjectFactory itself is created for
-      // every compilation and lives for the whole duration of the compilation.
-      ciObject* h = get(holder->klass_holder());
-    }
-  }
-
   if (o->is_klass()) {
     Klass* k = (Klass*)o;
     if (k->is_instance_klass()) {
       return new (arena()) ciInstanceKlass(k);
     } else if (k->is_objArray_klass()) {

@@ -399,41 +383,10 @@
   // The Metadata* is of some type not supported by the compiler interface.
   ShouldNotReachHere();
   return NULL;
 }
 
-// ------------------------------------------------------------------
-// ciObjectFactory::ensure_metadata_alive
-//
-// Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
-// This is primarily useful for metadata which is considered as weak roots
-// by the GC but need to be strong roots if reachable from a current compilation.
-//
-void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
-  ASSERT_IN_VM; // We're handling raw oops here.
-
-#if INCLUDE_ALL_GCS
-  if (!UseG1GC) {
-    return;
-  }
-  Klass* metadata_owner_klass;
-  if (m->is_klass()) {
-    metadata_owner_klass = m->as_klass()->get_Klass();
-  } else if (m->is_method()) {
-    metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
-  } else {
-    fatal("Not implemented for other types of metadata");
-    return;
-  }
-
-  oop metadata_holder = metadata_owner_klass->klass_holder();
-  if (metadata_holder != NULL) {
-    G1SATBCardTableModRefBS::enqueue(metadata_holder);
-  }
-
-#endif
-}
 
 //------------------------------------------------------------------
 // ciObjectFactory::get_unloaded_method
 //
 // Get the ciMethod representing an unloaded/unfound method.

@@ -540,17 +493,19 @@
       // The element klass is a TypeArrayKlass.
       element_klass = ciTypeArrayKlass::make(element_type);
     }
     new_klass = new (arena()) ciObjArrayKlass(name, element_klass, dimension);
   } else {
+    jobject holder_handle = NULL;
     jobject loader_handle = NULL;
     jobject domain_handle = NULL;
     if (accessing_klass != NULL) {
+      holder_handle = accessing_klass->holder_handle();
       loader_handle = accessing_klass->loader_handle();
       domain_handle = accessing_klass->protection_domain_handle();
     }
-    new_klass = new (arena()) ciInstanceKlass(name, loader_handle, domain_handle);
+    new_klass = new (arena()) ciInstanceKlass(name, holder_handle, loader_handle, domain_handle);
   }
   init_ident_of(new_klass);
   _unloaded_klasses->append(new_klass);
 
   return new_klass;
< prev index next >