comparison src/share/vm/oops/klass.cpp @ 11173:6b0fd0964b87

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 31 Jul 2013 11:00:54 +0200
parents 836a62f43af9 71180a6e5080
children cefad50507d8
comparison
equal deleted inserted replaced
10912:4ea54634f03e 11173:6b0fd0964b87
166 af.set_flags(0); 166 af.set_flags(0);
167 set_access_flags(af); 167 set_access_flags(af);
168 set_subklass(NULL); 168 set_subklass(NULL);
169 set_next_sibling(NULL); 169 set_next_sibling(NULL);
170 set_next_link(NULL); 170 set_next_link(NULL);
171 set_alloc_count(0);
172 TRACE_INIT_ID(this); 171 TRACE_INIT_ID(this);
173 172
174 set_prototype_header(markOopDesc::prototype()); 173 set_prototype_header(markOopDesc::prototype());
175 set_biased_lock_revocation_count(0); 174 set_biased_lock_revocation_count(0);
176 set_last_biased_lock_bulk_revocation_time(0); 175 set_last_biased_lock_bulk_revocation_time(0);
375 super->set_subklass(this); 374 super->set_subklass(this);
376 debug_only(verify();) 375 debug_only(verify();)
377 } 376 }
378 377
379 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { 378 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) {
380 assert(is_metadata(), "p is not meta-data");
381 assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); 379 assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace");
382 380
383 #ifdef ASSERT 381 #ifdef ASSERT
384 // The class is alive iff the class loader is alive. 382 // The class is alive iff the class loader is alive.
385 oop loader = class_loader(); 383 oop loader = class_loader();
541 539
542 Klass* Klass::array_klass_impl(bool or_null, TRAPS) { 540 Klass* Klass::array_klass_impl(bool or_null, TRAPS) {
543 fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass"); 541 fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
544 return NULL; 542 return NULL;
545 } 543 }
546
547
548 void Klass::with_array_klasses_do(void f(Klass* k)) {
549 f(this);
550 }
551
552 544
553 oop Klass::class_loader() const { return class_loader_data()->class_loader(); } 545 oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
554 546
555 const char* Klass::external_name() const { 547 const char* Klass::external_name() const {
556 if (oop_is_instance()) { 548 if (oop_is_instance()) {
646 } 638 }
647 #endif // INCLUDE_SERVICES 639 #endif // INCLUDE_SERVICES
648 640
649 // Verification 641 // Verification
650 642
651 void Klass::verify_on(outputStream* st) { 643 void Klass::verify_on(outputStream* st, bool check_dictionary) {
652 guarantee(!Universe::heap()->is_in_reserved(this), "Shouldn't be"); 644
653 guarantee(this->is_metadata(), "should be in metaspace"); 645 // This can be expensive, but it is worth checking that this klass is actually
654 646 // in the CLD graph but not in production.
655 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); 647 assert(ClassLoaderDataGraph::contains((address)this), "Should be");
656 648
657 guarantee(this->is_klass(),"should be klass"); 649 guarantee(this->is_klass(),"should be klass");
658 650
659 if (super() != NULL) { 651 if (super() != NULL) {
660 guarantee(super()->is_metadata(), "should be in metaspace");
661 guarantee(super()->is_klass(), "should be klass"); 652 guarantee(super()->is_klass(), "should be klass");
662 } 653 }
663 if (secondary_super_cache() != NULL) { 654 if (secondary_super_cache() != NULL) {
664 Klass* ko = secondary_super_cache(); 655 Klass* ko = secondary_super_cache();
665 guarantee(ko->is_metadata(), "should be in metaspace");
666 guarantee(ko->is_klass(), "should be klass"); 656 guarantee(ko->is_klass(), "should be klass");
667 } 657 }
668 for ( uint i = 0; i < primary_super_limit(); i++ ) { 658 for ( uint i = 0; i < primary_super_limit(); i++ ) {
669 Klass* ko = _primary_supers[i]; 659 Klass* ko = _primary_supers[i];
670 if (ko != NULL) { 660 if (ko != NULL) {
671 guarantee(ko->is_metadata(), "should be in metaspace");
672 guarantee(ko->is_klass(), "should be klass"); 661 guarantee(ko->is_klass(), "should be klass");
673 } 662 }
674 } 663 }
675 664
676 if (java_mirror() != NULL) { 665 if (java_mirror() != NULL) {
678 } 667 }
679 } 668 }
680 669
681 void Klass::oop_verify_on(oop obj, outputStream* st) { 670 void Klass::oop_verify_on(oop obj, outputStream* st) {
682 guarantee(obj->is_oop(), "should be oop"); 671 guarantee(obj->is_oop(), "should be oop");
683 guarantee(obj->klass()->is_metadata(), "should not be in Java heap");
684 guarantee(obj->klass()->is_klass(), "klass field is not a klass"); 672 guarantee(obj->klass()->is_klass(), "klass field is not a klass");
685 } 673 }
686 674
687 #ifndef PRODUCT 675 #ifndef PRODUCT
688 676