src/share/vm/oops/klass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 6642881_8u40_hotspot Sdiff src/share/vm/oops

src/share/vm/oops/klass.cpp

Print this page
rev 6604 : 6642881: Improve performance of Class.getClassLoader()
Summary: Add classLoader to java/lang/Class instance for fast access
Reviewed-by: alanb, lfoltan, rriggs, vlivanov, twisti, jfranck


 510 }
 511 
 512 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
 513   TRACE_INIT_ID(this);
 514   // If an exception happened during CDS restore, some of these fields may already be
 515   // set.  We leave the class on the CLD list, even if incomplete so that we don't
 516   // modify the CLD list outside a safepoint.
 517   if (class_loader_data() == NULL) {
 518     // Restore class_loader_data
 519     set_class_loader_data(loader_data);
 520 
 521     // Add to class loader list first before creating the mirror
 522     // (same order as class file parsing)
 523     loader_data->add_class(this);
 524   }
 525 
 526   // Recreate the class mirror.
 527   // Only recreate it if not present.  A previous attempt to restore may have
 528   // gotten an OOM later but keep the mirror if it was created.
 529   if (java_mirror() == NULL) {
 530     java_lang_Class::create_mirror(this, protection_domain, CHECK);
 531   }
 532 }
 533 
 534 Klass* Klass::array_klass_or_null(int rank) {
 535   EXCEPTION_MARK;
 536   // No exception can be thrown by array_klass_impl when called with or_null == true.
 537   // (In anycase, the execption mark will fail if it do so)
 538   return array_klass_impl(true, rank, THREAD);
 539 }
 540 
 541 
 542 Klass* Klass::array_klass_or_null() {
 543   EXCEPTION_MARK;
 544   // No exception can be thrown by array_klass_impl when called with or_null == true.
 545   // (In anycase, the execption mark will fail if it do so)
 546   return array_klass_impl(true, THREAD);
 547 }
 548 
 549 
 550 Klass* Klass::array_klass_impl(bool or_null, int rank, TRAPS) {




 510 }
 511 
 512 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
 513   TRACE_INIT_ID(this);
 514   // If an exception happened during CDS restore, some of these fields may already be
 515   // set.  We leave the class on the CLD list, even if incomplete so that we don't
 516   // modify the CLD list outside a safepoint.
 517   if (class_loader_data() == NULL) {
 518     // Restore class_loader_data
 519     set_class_loader_data(loader_data);
 520 
 521     // Add to class loader list first before creating the mirror
 522     // (same order as class file parsing)
 523     loader_data->add_class(this);
 524   }
 525 
 526   // Recreate the class mirror.
 527   // Only recreate it if not present.  A previous attempt to restore may have
 528   // gotten an OOM later but keep the mirror if it was created.
 529   if (java_mirror() == NULL) {
 530     java_lang_Class::create_mirror(this, class_loader(), protection_domain, CHECK);
 531   }
 532 }
 533 
 534 Klass* Klass::array_klass_or_null(int rank) {
 535   EXCEPTION_MARK;
 536   // No exception can be thrown by array_klass_impl when called with or_null == true.
 537   // (In anycase, the execption mark will fail if it do so)
 538   return array_klass_impl(true, rank, THREAD);
 539 }
 540 
 541 
 542 Klass* Klass::array_klass_or_null() {
 543   EXCEPTION_MARK;
 544   // No exception can be thrown by array_klass_impl when called with or_null == true.
 545   // (In anycase, the execption mark will fail if it do so)
 546   return array_klass_impl(true, THREAD);
 547 }
 548 
 549 
 550 Klass* Klass::array_klass_impl(bool or_null, int rank, TRAPS) {


src/share/vm/oops/klass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File