410 //
411 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
412 ASSERT_IN_VM; // We're handling raw oops here.
413
414 #if INCLUDE_ALL_GCS
415 if (!(UseG1GC || UseShenandoahGC)) {
416 return;
417 }
418 Klass* metadata_owner_klass;
419 if (m->is_klass()) {
420 metadata_owner_klass = m->as_klass()->get_Klass();
421 } else if (m->is_method()) {
422 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
423 } else {
424 fatal("Not implemented for other types of metadata");
425 return;
426 }
427
428 oop metadata_holder = metadata_owner_klass->klass_holder();
429 if (metadata_holder != NULL) {
430 G1SATBCardTableModRefBS::enqueue(metadata_holder);
431 }
432
433 #endif
434 }
435
436 //------------------------------------------------------------------
437 // ciObjectFactory::get_unloaded_method
438 //
439 // Get the ciMethod representing an unloaded/unfound method.
440 //
441 // Implementation note: unloaded methods are currently stored in
442 // an unordered array, requiring a linear-time lookup for each
443 // unloaded method. This may need to change.
444 ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
445 ciSymbol* name,
446 ciSymbol* signature,
447 ciInstanceKlass* accessor) {
448 ciSignature* that = NULL;
449 for (int i = 0; i < _unloaded_methods->length(); i++) {
450 ciMethod* entry = _unloaded_methods->at(i);
|
410 //
411 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
412 ASSERT_IN_VM; // We're handling raw oops here.
413
414 #if INCLUDE_ALL_GCS
415 if (!(UseG1GC || UseShenandoahGC)) {
416 return;
417 }
418 Klass* metadata_owner_klass;
419 if (m->is_klass()) {
420 metadata_owner_klass = m->as_klass()->get_Klass();
421 } else if (m->is_method()) {
422 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
423 } else {
424 fatal("Not implemented for other types of metadata");
425 return;
426 }
427
428 oop metadata_holder = metadata_owner_klass->klass_holder();
429 if (metadata_holder != NULL) {
430 oopDesc::bs()->keep_alive_barrier(metadata_holder);
431 }
432
433 #endif
434 }
435
436 //------------------------------------------------------------------
437 // ciObjectFactory::get_unloaded_method
438 //
439 // Get the ciMethod representing an unloaded/unfound method.
440 //
441 // Implementation note: unloaded methods are currently stored in
442 // an unordered array, requiring a linear-time lookup for each
443 // unloaded method. This may need to change.
444 ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
445 ciSymbol* name,
446 ciSymbol* signature,
447 ciInstanceKlass* accessor) {
448 ciSignature* that = NULL;
449 for (int i = 0; i < _unloaded_methods->length(); i++) {
450 ciMethod* entry = _unloaded_methods->at(i);
|