386 methodHandle h_m(THREAD, ((MethodData*)o)->method());
387 return new (arena()) ciMethodData((MethodData*)o);
388 }
389
390 // The Metadata* is of some type not supported by the compiler interface.
391 ShouldNotReachHere();
392 return NULL;
393 }
394
395 // ------------------------------------------------------------------
396 // ciObjectFactory::ensure_metadata_alive
397 //
398 // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
399 // This is primarily useful for metadata which is considered as weak roots
400 // by the GC but need to be strong roots if reachable from a current compilation.
401 //
402 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
403 ASSERT_IN_VM; // We're handling raw oops here.
404
405 #if INCLUDE_ALL_GCS
406 if (!UseG1GC) {
407 return;
408 }
409 Klass* metadata_owner_klass;
410 if (m->is_klass()) {
411 metadata_owner_klass = m->as_klass()->get_Klass();
412 } else if (m->is_method()) {
413 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
414 } else {
415 fatal("Not implemented for other types of metadata");
416 return;
417 }
418
419 oop metadata_holder = metadata_owner_klass->klass_holder();
420 if (metadata_holder != NULL) {
421 G1SATBCardTableModRefBS::enqueue(metadata_holder);
422 }
423
424 #endif
425 }
426
|
386 methodHandle h_m(THREAD, ((MethodData*)o)->method());
387 return new (arena()) ciMethodData((MethodData*)o);
388 }
389
390 // The Metadata* is of some type not supported by the compiler interface.
391 ShouldNotReachHere();
392 return NULL;
393 }
394
395 // ------------------------------------------------------------------
396 // ciObjectFactory::ensure_metadata_alive
397 //
398 // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
399 // This is primarily useful for metadata which is considered as weak roots
400 // by the GC but need to be strong roots if reachable from a current compilation.
401 //
402 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
403 ASSERT_IN_VM; // We're handling raw oops here.
404
405 #if INCLUDE_ALL_GCS
406 if (!(UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier))) {
407 return;
408 }
409 Klass* metadata_owner_klass;
410 if (m->is_klass()) {
411 metadata_owner_klass = m->as_klass()->get_Klass();
412 } else if (m->is_method()) {
413 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
414 } else {
415 fatal("Not implemented for other types of metadata");
416 return;
417 }
418
419 oop metadata_holder = metadata_owner_klass->klass_holder();
420 if (metadata_holder != NULL) {
421 G1SATBCardTableModRefBS::enqueue(metadata_holder);
422 }
423
424 #endif
425 }
426
|