Mercurial > hg > truffle
comparison src/share/vm/oops/klass.cpp @ 18058:54bc75c144b0
Merge
author | asaha |
---|---|
date | Thu, 29 May 2014 13:14:25 -0700 |
parents | 096a7e12d63f 7384f6a12fc1 |
children | eaf39a954227 8cb56c8cb30d |
comparison
equal
deleted
inserted
replaced
18055:1fa005fb28f5 | 18058:54bc75c144b0 |
---|---|
136 #endif | 136 #endif |
137 ShouldNotReachHere(); | 137 ShouldNotReachHere(); |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 | 140 |
141 Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature) const { | 141 Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const { |
142 #ifdef ASSERT | 142 #ifdef ASSERT |
143 tty->print_cr("Error: uncached_lookup_method called on a klass oop." | 143 tty->print_cr("Error: uncached_lookup_method called on a klass oop." |
144 " Likely error: reflection method does not correctly" | 144 " Likely error: reflection method does not correctly" |
145 " wrap return value in a mirror object."); | 145 " wrap return value in a mirror object."); |
146 #endif | 146 #endif |
383 super->set_subklass(this); | 383 super->set_subklass(this); |
384 debug_only(verify();) | 384 debug_only(verify();) |
385 } | 385 } |
386 | 386 |
387 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { | 387 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { |
388 assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); | |
389 | |
390 #ifdef ASSERT | 388 #ifdef ASSERT |
391 // The class is alive iff the class loader is alive. | 389 // The class is alive iff the class loader is alive. |
392 oop loader = class_loader(); | 390 oop loader = class_loader(); |
393 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); | 391 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); |
394 #endif // ASSERT | 392 #endif // ASSERT |
492 void Klass::oops_do(OopClosure* cl) { | 490 void Klass::oops_do(OopClosure* cl) { |
493 cl->do_oop(&_java_mirror); | 491 cl->do_oop(&_java_mirror); |
494 } | 492 } |
495 | 493 |
496 void Klass::remove_unshareable_info() { | 494 void Klass::remove_unshareable_info() { |
497 if (!DumpSharedSpaces) { | 495 assert (DumpSharedSpaces, "only called for DumpSharedSpaces"); |
498 // Clean up after OOM during class loading | 496 |
499 if (class_loader_data() != NULL) { | |
500 class_loader_data()->remove_class(this); | |
501 } | |
502 } | |
503 set_subklass(NULL); | 497 set_subklass(NULL); |
504 set_next_sibling(NULL); | 498 set_next_sibling(NULL); |
505 // Clear the java mirror | 499 // Clear the java mirror |
506 set_java_mirror(NULL); | 500 set_java_mirror(NULL); |
507 set_next_link(NULL); | 501 set_next_link(NULL); |
509 // Null out class_loader_data because we don't share that yet. | 503 // Null out class_loader_data because we don't share that yet. |
510 set_class_loader_data(NULL); | 504 set_class_loader_data(NULL); |
511 } | 505 } |
512 | 506 |
513 void Klass::restore_unshareable_info(TRAPS) { | 507 void Klass::restore_unshareable_info(TRAPS) { |
514 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); | 508 TRACE_INIT_ID(this); |
515 // Restore class_loader_data to the null class loader data | 509 // If an exception happened during CDS restore, some of these fields may already be |
516 set_class_loader_data(loader_data); | 510 // set. We leave the class on the CLD list, even if incomplete so that we don't |
517 | 511 // modify the CLD list outside a safepoint. |
518 // Add to null class loader list first before creating the mirror | 512 if (class_loader_data() == NULL) { |
519 // (same order as class file parsing) | 513 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); |
520 loader_data->add_class(this); | 514 // Restore class_loader_data to the null class loader data |
515 set_class_loader_data(loader_data); | |
516 | |
517 // Add to null class loader list first before creating the mirror | |
518 // (same order as class file parsing) | |
519 loader_data->add_class(this); | |
520 } | |
521 | 521 |
522 // Recreate the class mirror. The protection_domain is always null for | 522 // Recreate the class mirror. The protection_domain is always null for |
523 // boot loader, for now. | 523 // boot loader, for now. |
524 java_lang_Class::create_mirror(this, Handle(NULL), CHECK); | 524 // Only recreate it if not present. A previous attempt to restore may have |
525 // gotten an OOM later but keep the mirror if it was created. | |
526 if (java_mirror() == NULL) { | |
527 java_lang_Class::create_mirror(this, Handle(NULL), CHECK); | |
528 } | |
525 } | 529 } |
526 | 530 |
527 Klass* Klass::array_klass_or_null(int rank) { | 531 Klass* Klass::array_klass_or_null(int rank) { |
528 EXCEPTION_MARK; | 532 EXCEPTION_MARK; |
529 // No exception can be thrown by array_klass_impl when called with or_null == true. | 533 // No exception can be thrown by array_klass_impl when called with or_null == true. |
647 } | 651 } |
648 #endif // INCLUDE_SERVICES | 652 #endif // INCLUDE_SERVICES |
649 | 653 |
650 // Verification | 654 // Verification |
651 | 655 |
652 void Klass::verify_on(outputStream* st, bool check_dictionary) { | 656 void Klass::verify_on(outputStream* st) { |
653 | 657 |
654 // This can be expensive, but it is worth checking that this klass is actually | 658 // This can be expensive, but it is worth checking that this klass is actually |
655 // in the CLD graph but not in production. | 659 // in the CLD graph but not in production. |
656 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); | 660 assert(Metaspace::contains((address)this), "Should be"); |
657 | 661 |
658 guarantee(this->is_klass(),"should be klass"); | 662 guarantee(this->is_klass(),"should be klass"); |
659 | 663 |
660 if (super() != NULL) { | 664 if (super() != NULL) { |
661 guarantee(super()->is_klass(), "should be klass"); | 665 guarantee(super()->is_klass(), "should be klass"); |