Mercurial > hg > truffle
comparison src/share/vm/oops/methodOop.cpp @ 6123:2fe087c3e814
7172967: Eliminate constMethod's _method backpointer to methodOop.
Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod.
Reviewed-by: roland, bdelsart, kamg
author | jiangli |
---|---|
date | Wed, 06 Jun 2012 14:33:43 -0400 |
parents | 0382d2b469b2 |
children | eba1d5bce9e8 |
comparison
equal
deleted
inserted
replaced
6115:6e2633440960 | 6123:2fe087c3e814 |
---|---|
529 return best_line; | 529 return best_line; |
530 } | 530 } |
531 | 531 |
532 | 532 |
533 bool methodOopDesc::is_klass_loaded_by_klass_index(int klass_index) const { | 533 bool methodOopDesc::is_klass_loaded_by_klass_index(int klass_index) const { |
534 if( _constants->tag_at(klass_index).is_unresolved_klass() ) { | 534 if( constants()->tag_at(klass_index).is_unresolved_klass() ) { |
535 Thread *thread = Thread::current(); | 535 Thread *thread = Thread::current(); |
536 Symbol* klass_name = _constants->klass_name_at(klass_index); | 536 Symbol* klass_name = constants()->klass_name_at(klass_index); |
537 Handle loader(thread, instanceKlass::cast(method_holder())->class_loader()); | 537 Handle loader(thread, instanceKlass::cast(method_holder())->class_loader()); |
538 Handle prot (thread, Klass::cast(method_holder())->protection_domain()); | 538 Handle prot (thread, Klass::cast(method_holder())->protection_domain()); |
539 return SystemDictionary::find(klass_name, loader, prot, thread) != NULL; | 539 return SystemDictionary::find(klass_name, loader, prot, thread) != NULL; |
540 } else { | 540 } else { |
541 return true; | 541 return true; |
542 } | 542 } |
543 } | 543 } |
544 | 544 |
545 | 545 |
546 bool methodOopDesc::is_klass_loaded(int refinfo_index, bool must_be_resolved) const { | 546 bool methodOopDesc::is_klass_loaded(int refinfo_index, bool must_be_resolved) const { |
547 int klass_index = _constants->klass_ref_index_at(refinfo_index); | 547 int klass_index = constants()->klass_ref_index_at(refinfo_index); |
548 if (must_be_resolved) { | 548 if (must_be_resolved) { |
549 // Make sure klass is resolved in constantpool. | 549 // Make sure klass is resolved in constantpool. |
550 if (constants()->tag_at(klass_index).is_unresolved_klass()) return false; | 550 if (constants()->tag_at(klass_index).is_unresolved_klass()) return false; |
551 } | 551 } |
552 return is_klass_loaded_by_klass_index(klass_index); | 552 return is_klass_loaded_by_klass_index(klass_index); |
884 assert(mt->klass() == SystemDictionary::MethodType_klass(), ""); | 884 assert(mt->klass() == SystemDictionary::MethodType_klass(), ""); |
885 return mt; | 885 return mt; |
886 } | 886 } |
887 | 887 |
888 jint* methodOopDesc::method_type_offsets_chain() { | 888 jint* methodOopDesc::method_type_offsets_chain() { |
889 static jint pchase[] = { -1, -1, -1 }; | 889 static jint pchase[] = { -1, -1, -1, -1 }; |
890 if (pchase[0] == -1) { | 890 if (pchase[0] == -1) { |
891 jint step0 = in_bytes(constants_offset()); | 891 jint step0 = in_bytes(const_offset()); |
892 jint step1 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize; | 892 jint step1 = in_bytes(constMethodOopDesc::constants_offset()); |
893 jint step2 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize; | |
893 // do this in reverse to avoid races: | 894 // do this in reverse to avoid races: |
895 OrderAccess::release_store(&pchase[2], step2); | |
894 OrderAccess::release_store(&pchase[1], step1); | 896 OrderAccess::release_store(&pchase[1], step1); |
895 OrderAccess::release_store(&pchase[0], step0); | 897 OrderAccess::release_store(&pchase[0], step0); |
896 } | 898 } |
897 return pchase; | 899 return pchase; |
898 } | 900 } |
1074 memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc)); | 1076 memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc)); |
1075 m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc); | 1077 m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc); |
1076 assert(m->constMethod()->is_parsable(), "Should remain parsable"); | 1078 assert(m->constMethod()->is_parsable(), "Should remain parsable"); |
1077 | 1079 |
1078 // Reset correct method/const method, method size, and parameter info | 1080 // Reset correct method/const method, method size, and parameter info |
1079 newcm->set_method(newm()); | |
1080 newm->set_constMethod(newcm); | 1081 newm->set_constMethod(newcm); |
1081 assert(newcm->method() == newm(), "check"); | |
1082 newm->constMethod()->set_code_size(new_code_length); | 1082 newm->constMethod()->set_code_size(new_code_length); |
1083 newm->constMethod()->set_constMethod_size(new_const_method_size); | 1083 newm->constMethod()->set_constMethod_size(new_const_method_size); |
1084 newm->set_method_size(new_method_size); | 1084 newm->set_method_size(new_method_size); |
1085 assert(newm->code_size() == new_code_length, "check"); | 1085 assert(newm->code_size() == new_code_length, "check"); |
1086 assert(newm->checked_exceptions_length() == checked_exceptions_len, "check"); | 1086 assert(newm->checked_exceptions_length() == checked_exceptions_len, "check"); |