src/share/vm/ci/ciObjectFactory.cpp

changeset 6992
2c6ef90f030a
parent 6198
55fb97c4c58d
child 7074
833b0f92429a
equal deleted inserted replaced
6991:882004b9e7e1 6992:2c6ef90f030a
44 #include "gc_interface/collectedHeap.inline.hpp" 44 #include "gc_interface/collectedHeap.inline.hpp"
45 #include "memory/allocation.inline.hpp" 45 #include "memory/allocation.inline.hpp"
46 #include "oops/oop.inline.hpp" 46 #include "oops/oop.inline.hpp"
47 #include "oops/oop.inline2.hpp" 47 #include "oops/oop.inline2.hpp"
48 #include "runtime/fieldType.hpp" 48 #include "runtime/fieldType.hpp"
49 #if INCLUDE_ALL_GCS
50 # include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
51 #endif
49 52
50 // ciObjectFactory 53 // ciObjectFactory
51 // 54 //
52 // This class handles requests for the creation of new instances 55 // This class handles requests for the creation of new instances
53 // of ciObject and its subclasses. It contains a caching mechanism 56 // of ciObject and its subclasses. It contains a caching mechanism
370 } 373 }
371 374
372 // The oop is of some type not supported by the compiler interface. 375 // The oop is of some type not supported by the compiler interface.
373 ShouldNotReachHere(); 376 ShouldNotReachHere();
374 return NULL; 377 return NULL;
378 }
379
380 // ------------------------------------------------------------------
381 // ciObjectFactory::ensure_metadata_alive
382 //
383 // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
384 // This is primarily useful for metadata which is considered as weak roots
385 // by the GC but need to be strong roots if reachable from a current compilation.
386 //
387 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
388 ASSERT_IN_VM; // We're handling raw oops here.
389
390 #if INCLUDE_ALL_GCS
391 if (!UseG1GC) {
392 return;
393 }
394 Klass* metadata_owner_klass;
395 if (m->is_klass()) {
396 metadata_owner_klass = m->as_klass()->get_Klass();
397 } else if (m->is_method()) {
398 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
399 } else {
400 fatal("Not implemented for other types of metadata");
401 }
402
403 oop metadata_holder = metadata_owner_klass->klass_holder();
404 if (metadata_holder != NULL) {
405 G1SATBCardTableModRefBS::enqueue(metadata_holder);
406 }
407
408 #endif
375 } 409 }
376 410
377 //------------------------------------------------------------------ 411 //------------------------------------------------------------------
378 // ciObjectFactory::get_unloaded_method 412 // ciObjectFactory::get_unloaded_method
379 // 413 //

mercurial