Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.cpp @ 11034:e0c9a1d29eb4
8016325: JVM hangs verifying system dictionary
Summary: Minimize redundant verifications of Klasses.
Reviewed-by: hseigel, jmasa
author | coleenp |
---|---|
date | Mon, 24 Jun 2013 18:55:46 -0400 |
parents | 6c138b9851fb |
children | 71180a6e5080 |
comparison
equal
deleted
inserted
replaced
11033:d9eed26d638a | 11034:e0c9a1d29eb4 |
---|---|
3086 public: | 3086 public: |
3087 virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); } | 3087 virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); } |
3088 virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); } | 3088 virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); } |
3089 }; | 3089 }; |
3090 | 3090 |
3091 void InstanceKlass::verify_on(outputStream* st) { | 3091 void InstanceKlass::verify_on(outputStream* st, bool check_dictionary) { |
3092 Klass::verify_on(st); | |
3093 Thread *thread = Thread::current(); | |
3094 | |
3095 #ifndef PRODUCT | 3092 #ifndef PRODUCT |
3096 // Avoid redundant verifies | 3093 // Avoid redundant verifies, this really should be in product. |
3097 if (_verify_count == Universe::verify_count()) return; | 3094 if (_verify_count == Universe::verify_count()) return; |
3098 _verify_count = Universe::verify_count(); | 3095 _verify_count = Universe::verify_count(); |
3099 #endif | 3096 #endif |
3100 // Verify that klass is present in SystemDictionary | 3097 |
3101 if (is_loaded() && !is_anonymous()) { | 3098 // Verify Klass |
3099 Klass::verify_on(st, check_dictionary); | |
3100 | |
3101 // Verify that klass is present in SystemDictionary if not already | |
3102 // verifying the SystemDictionary. | |
3103 if (is_loaded() && !is_anonymous() && check_dictionary) { | |
3102 Symbol* h_name = name(); | 3104 Symbol* h_name = name(); |
3103 SystemDictionary::verify_obj_klass_present(h_name, class_loader_data()); | 3105 SystemDictionary::verify_obj_klass_present(h_name, class_loader_data()); |
3104 } | 3106 } |
3105 | 3107 |
3106 // Verify static fields | |
3107 VerifyFieldClosure blk; | |
3108 | |
3109 // Verify vtables | 3108 // Verify vtables |
3110 if (is_linked()) { | 3109 if (is_linked()) { |
3111 ResourceMark rm(thread); | 3110 ResourceMark rm; |
3112 // $$$ This used to be done only for m/s collections. Doing it | 3111 // $$$ This used to be done only for m/s collections. Doing it |
3113 // always seemed a valid generalization. (DLD -- 6/00) | 3112 // always seemed a valid generalization. (DLD -- 6/00) |
3114 vtable()->verify(st); | 3113 vtable()->verify(st); |
3115 } | 3114 } |
3116 | 3115 |
3117 // Verify first subklass | 3116 // Verify first subklass |
3118 if (subklass_oop() != NULL) { | 3117 if (subklass_oop() != NULL) { |
3119 guarantee(subklass_oop()->is_metadata(), "should be in metaspace"); | |
3120 guarantee(subklass_oop()->is_klass(), "should be klass"); | 3118 guarantee(subklass_oop()->is_klass(), "should be klass"); |
3121 } | 3119 } |
3122 | 3120 |
3123 // Verify siblings | 3121 // Verify siblings |
3124 Klass* super = this->super(); | 3122 Klass* super = this->super(); |
3126 if (sib != NULL) { | 3124 if (sib != NULL) { |
3127 if (sib == this) { | 3125 if (sib == this) { |
3128 fatal(err_msg("subclass points to itself " PTR_FORMAT, sib)); | 3126 fatal(err_msg("subclass points to itself " PTR_FORMAT, sib)); |
3129 } | 3127 } |
3130 | 3128 |
3131 guarantee(sib->is_metadata(), "should be in metaspace"); | |
3132 guarantee(sib->is_klass(), "should be klass"); | 3129 guarantee(sib->is_klass(), "should be klass"); |
3133 guarantee(sib->super() == super, "siblings should have same superklass"); | 3130 guarantee(sib->super() == super, "siblings should have same superklass"); |
3134 } | 3131 } |
3135 | 3132 |
3136 // Verify implementor fields | 3133 // Verify implementor fields |
3162 | 3159 |
3163 // Verify methods | 3160 // Verify methods |
3164 if (methods() != NULL) { | 3161 if (methods() != NULL) { |
3165 Array<Method*>* methods = this->methods(); | 3162 Array<Method*>* methods = this->methods(); |
3166 for (int j = 0; j < methods->length(); j++) { | 3163 for (int j = 0; j < methods->length(); j++) { |
3167 guarantee(methods->at(j)->is_metadata(), "should be in metaspace"); | |
3168 guarantee(methods->at(j)->is_method(), "non-method in methods array"); | 3164 guarantee(methods->at(j)->is_method(), "non-method in methods array"); |
3169 } | 3165 } |
3170 for (int j = 0; j < methods->length() - 1; j++) { | 3166 for (int j = 0; j < methods->length() - 1; j++) { |
3171 Method* m1 = methods->at(j); | 3167 Method* m1 = methods->at(j); |
3172 Method* m2 = methods->at(j + 1); | 3168 Method* m2 = methods->at(j + 1); |
3200 jni_ids()->verify(this); | 3196 jni_ids()->verify(this); |
3201 } | 3197 } |
3202 | 3198 |
3203 // Verify other fields | 3199 // Verify other fields |
3204 if (array_klasses() != NULL) { | 3200 if (array_klasses() != NULL) { |
3205 guarantee(array_klasses()->is_metadata(), "should be in metaspace"); | |
3206 guarantee(array_klasses()->is_klass(), "should be klass"); | 3201 guarantee(array_klasses()->is_klass(), "should be klass"); |
3207 } | 3202 } |
3208 if (constants() != NULL) { | 3203 if (constants() != NULL) { |
3209 guarantee(constants()->is_metadata(), "should be in metaspace"); | |
3210 guarantee(constants()->is_constantPool(), "should be constant pool"); | 3204 guarantee(constants()->is_constantPool(), "should be constant pool"); |
3211 } | 3205 } |
3212 const Klass* host = host_klass(); | 3206 const Klass* host = host_klass(); |
3213 if (host != NULL) { | 3207 if (host != NULL) { |
3214 guarantee(host->is_metadata(), "should be in metaspace"); | |
3215 guarantee(host->is_klass(), "should be klass"); | 3208 guarantee(host->is_klass(), "should be klass"); |
3216 } | 3209 } |
3217 } | 3210 } |
3218 | 3211 |
3219 void InstanceKlass::oop_verify_on(oop obj, outputStream* st) { | 3212 void InstanceKlass::oop_verify_on(oop obj, outputStream* st) { |