390
391 // The Metadata* is of some type not supported by the compiler interface.
392 ShouldNotReachHere();
393 return NULL;
394 }
395
396 // ------------------------------------------------------------------
397 // ciObjectFactory::ensure_metadata_alive
398 //
399 // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
400 // This is primarily useful for metadata which is considered as weak roots
401 // by the GC but need to be strong roots if reachable from a current compilation.
402 //
403 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
404 ASSERT_IN_VM; // We're handling raw oops here.
405
406 #if INCLUDE_ALL_GCS
407 if (!UseG1GC) {
408 return;
409 }
410 Klass* metadata_owner_klass;
411 if (m->is_klass()) {
412 metadata_owner_klass = m->as_klass()->get_Klass();
413 } else if (m->is_method()) {
414 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
415 } else {
416 fatal("Not implemented for other types of metadata");
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
427 //------------------------------------------------------------------
428 // ciObjectFactory::get_unloaded_method
429 //
430 // Get the ciMethod representing an unloaded/unfound method.
431 //
432 // Implementation note: unloaded methods are currently stored in
433 // an unordered array, requiring a linear-time lookup for each
434 // unloaded method. This may need to change.
435 ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
436 ciSymbol* name,
437 ciSymbol* signature,
438 ciInstanceKlass* accessor) {
439 ciSignature* that = NULL;
440 for (int i = 0; i < _unloaded_methods->length(); i++) {
441 ciMethod* entry = _unloaded_methods->at(i);
|
390
391 // The Metadata* is of some type not supported by the compiler interface.
392 ShouldNotReachHere();
393 return NULL;
394 }
395
396 // ------------------------------------------------------------------
397 // ciObjectFactory::ensure_metadata_alive
398 //
399 // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC.
400 // This is primarily useful for metadata which is considered as weak roots
401 // by the GC but need to be strong roots if reachable from a current compilation.
402 //
403 void ciObjectFactory::ensure_metadata_alive(ciMetadata* m) {
404 ASSERT_IN_VM; // We're handling raw oops here.
405
406 #if INCLUDE_ALL_GCS
407 if (!UseG1GC) {
408 return;
409 }
410 Klass* metadata_owner_klass = NULL;
411 if (m->is_klass()) {
412 metadata_owner_klass = m->as_klass()->get_Klass();
413 } else if (m->is_method()) {
414 metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
415 } else {
416 fatal("Not implemented for other types of metadata");
417 }
418
419 if (metadata_owner_klass != NULL) {
420 oop metadata_holder = metadata_owner_klass->klass_holder();
421 if (metadata_holder != NULL) {
422 G1SATBCardTableModRefBS::enqueue(metadata_holder);
423 }
424 }
425
426 #endif
427 }
428
429 //------------------------------------------------------------------
430 // ciObjectFactory::get_unloaded_method
431 //
432 // Get the ciMethod representing an unloaded/unfound method.
433 //
434 // Implementation note: unloaded methods are currently stored in
435 // an unordered array, requiring a linear-time lookup for each
436 // unloaded method. This may need to change.
437 ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder,
438 ciSymbol* name,
439 ciSymbol* signature,
440 ciInstanceKlass* accessor) {
441 ciSignature* that = NULL;
442 for (int i = 0; i < _unloaded_methods->length(); i++) {
443 ciMethod* entry = _unloaded_methods->at(i);
|