Mercurial > hg > graal-compiler
comparison src/share/vm/oops/instanceKlass.cpp @ 2181:d25d4ca69222
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Wed, 16 Feb 2011 13:47:20 +0100 |
parents | 06f017f7daa7 3582bf76420e |
children | d9e4d0aefc90 |
comparison
equal
deleted
inserted
replaced
2108:50b45e2d9725 | 2181:d25d4ca69222 |
---|---|
39 #include "oops/instanceKlass.hpp" | 39 #include "oops/instanceKlass.hpp" |
40 #include "oops/instanceOop.hpp" | 40 #include "oops/instanceOop.hpp" |
41 #include "oops/methodOop.hpp" | 41 #include "oops/methodOop.hpp" |
42 #include "oops/objArrayKlassKlass.hpp" | 42 #include "oops/objArrayKlassKlass.hpp" |
43 #include "oops/oop.inline.hpp" | 43 #include "oops/oop.inline.hpp" |
44 #include "oops/symbolOop.hpp" | 44 #include "oops/symbol.hpp" |
45 #include "prims/jvmtiExport.hpp" | 45 #include "prims/jvmtiExport.hpp" |
46 #include "prims/jvmtiRedefineClassesTrace.hpp" | 46 #include "prims/jvmtiRedefineClassesTrace.hpp" |
47 #include "runtime/fieldDescriptor.hpp" | 47 #include "runtime/fieldDescriptor.hpp" |
48 #include "runtime/handles.inline.hpp" | 48 #include "runtime/handles.inline.hpp" |
49 #include "runtime/javaCalls.hpp" | 49 #include "runtime/javaCalls.hpp" |
94 | 94 |
95 #define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) \ | 95 #define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) \ |
96 { \ | 96 { \ |
97 char* data = NULL; \ | 97 char* data = NULL; \ |
98 int len = 0; \ | 98 int len = 0; \ |
99 symbolOop name = (clss)->name(); \ | 99 Symbol* name = (clss)->name(); \ |
100 if (name != NULL) { \ | 100 if (name != NULL) { \ |
101 data = (char*)name->bytes(); \ | 101 data = (char*)name->bytes(); \ |
102 len = name->utf8_length(); \ | 102 len = name->utf8_length(); \ |
103 } \ | 103 } \ |
104 HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \ | 104 HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \ |
107 | 107 |
108 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \ | 108 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \ |
109 { \ | 109 { \ |
110 char* data = NULL; \ | 110 char* data = NULL; \ |
111 int len = 0; \ | 111 int len = 0; \ |
112 symbolOop name = (clss)->name(); \ | 112 Symbol* name = (clss)->name(); \ |
113 if (name != NULL) { \ | 113 if (name != NULL) { \ |
114 data = (char*)name->bytes(); \ | 114 data = (char*)name->bytes(); \ |
115 len = name->utf8_length(); \ | 115 len = name->utf8_length(); \ |
116 } \ | 116 } \ |
117 HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \ | 117 HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \ |
264 if (super.not_null()) { | 264 if (super.not_null()) { |
265 if (super->is_interface()) { // check if super class is an interface | 265 if (super->is_interface()) { // check if super class is an interface |
266 ResourceMark rm(THREAD); | 266 ResourceMark rm(THREAD); |
267 Exceptions::fthrow( | 267 Exceptions::fthrow( |
268 THREAD_AND_LOCATION, | 268 THREAD_AND_LOCATION, |
269 vmSymbolHandles::java_lang_IncompatibleClassChangeError(), | 269 vmSymbols::java_lang_IncompatibleClassChangeError(), |
270 "class %s has interface %s as super class", | 270 "class %s has interface %s as super class", |
271 this_oop->external_name(), | 271 this_oop->external_name(), |
272 super->external_name() | 272 super->external_name() |
273 ); | 273 ); |
274 return false; | 274 return false; |
498 DTRACE_CLASSINIT_PROBE_WAIT(error, instanceKlass::cast(this_oop()), -1,wait); | 498 DTRACE_CLASSINIT_PROBE_WAIT(error, instanceKlass::cast(this_oop()), -1,wait); |
499 if (e->is_a(SystemDictionary::Error_klass())) { | 499 if (e->is_a(SystemDictionary::Error_klass())) { |
500 THROW_OOP(e()); | 500 THROW_OOP(e()); |
501 } else { | 501 } else { |
502 JavaCallArguments args(e); | 502 JavaCallArguments args(e); |
503 THROW_ARG(vmSymbolHandles::java_lang_ExceptionInInitializerError(), | 503 THROW_ARG(vmSymbols::java_lang_ExceptionInInitializerError(), |
504 vmSymbolHandles::throwable_void_signature(), | 504 vmSymbols::throwable_void_signature(), |
505 &args); | 505 &args); |
506 } | 506 } |
507 } | 507 } |
508 DTRACE_CLASSINIT_PROBE_WAIT(end, instanceKlass::cast(this_oop()), -1,wait); | 508 DTRACE_CLASSINIT_PROBE_WAIT(end, instanceKlass::cast(this_oop()), -1,wait); |
509 } | 509 } |
770 // _oop_map_cache is constant after init; lookup below does is own locking. | 770 // _oop_map_cache is constant after init; lookup below does is own locking. |
771 _oop_map_cache->lookup(method, bci, entry_for); | 771 _oop_map_cache->lookup(method, bci, entry_for); |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 bool instanceKlass::find_local_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | 775 bool instanceKlass::find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
776 const int n = fields()->length(); | 776 const int n = fields()->length(); |
777 for (int i = 0; i < n; i += next_offset ) { | 777 for (int i = 0; i < n; i += next_offset ) { |
778 int name_index = fields()->ushort_at(i + name_index_offset); | 778 int name_index = fields()->ushort_at(i + name_index_offset); |
779 int sig_index = fields()->ushort_at(i + signature_index_offset); | 779 int sig_index = fields()->ushort_at(i + signature_index_offset); |
780 symbolOop f_name = constants()->symbol_at(name_index); | 780 Symbol* f_name = constants()->symbol_at(name_index); |
781 symbolOop f_sig = constants()->symbol_at(sig_index); | 781 Symbol* f_sig = constants()->symbol_at(sig_index); |
782 if (f_name == name && f_sig == sig) { | 782 if (f_name == name && f_sig == sig) { |
783 fd->initialize(as_klassOop(), i); | 783 fd->initialize(as_klassOop(), i); |
784 return true; | 784 return true; |
785 } | 785 } |
786 } | 786 } |
787 return false; | 787 return false; |
788 } | 788 } |
789 | 789 |
790 | 790 |
791 void instanceKlass::field_names_and_sigs_iterate(OopClosure* closure) { | 791 void instanceKlass::shared_symbols_iterate(SymbolClosure* closure) { |
792 Klass::shared_symbols_iterate(closure); | |
793 closure->do_symbol(&_generic_signature); | |
794 closure->do_symbol(&_source_file_name); | |
795 closure->do_symbol(&_source_debug_extension); | |
796 | |
792 const int n = fields()->length(); | 797 const int n = fields()->length(); |
793 for (int i = 0; i < n; i += next_offset ) { | 798 for (int i = 0; i < n; i += next_offset ) { |
794 int name_index = fields()->ushort_at(i + name_index_offset); | 799 int name_index = fields()->ushort_at(i + name_index_offset); |
795 symbolOop name = constants()->symbol_at(name_index); | 800 closure->do_symbol(constants()->symbol_at_addr(name_index)); |
796 closure->do_oop((oop*)&name); | |
797 | |
798 int sig_index = fields()->ushort_at(i + signature_index_offset); | 801 int sig_index = fields()->ushort_at(i + signature_index_offset); |
799 symbolOop sig = constants()->symbol_at(sig_index); | 802 closure->do_symbol(constants()->symbol_at_addr(sig_index)); |
800 closure->do_oop((oop*)&sig); | 803 } |
801 } | 804 } |
802 } | 805 |
803 | 806 |
804 | 807 klassOop instanceKlass::find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
805 klassOop instanceKlass::find_interface_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | |
806 const int n = local_interfaces()->length(); | 808 const int n = local_interfaces()->length(); |
807 for (int i = 0; i < n; i++) { | 809 for (int i = 0; i < n; i++) { |
808 klassOop intf1 = klassOop(local_interfaces()->obj_at(i)); | 810 klassOop intf1 = klassOop(local_interfaces()->obj_at(i)); |
809 assert(Klass::cast(intf1)->is_interface(), "just checking type"); | 811 assert(Klass::cast(intf1)->is_interface(), "just checking type"); |
810 // search for field in current interface | 812 // search for field in current interface |
819 // otherwise field lookup fails | 821 // otherwise field lookup fails |
820 return NULL; | 822 return NULL; |
821 } | 823 } |
822 | 824 |
823 | 825 |
824 klassOop instanceKlass::find_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | 826 klassOop instanceKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
825 // search order according to newest JVM spec (5.4.3.2, p.167). | 827 // search order according to newest JVM spec (5.4.3.2, p.167). |
826 // 1) search for field in current klass | 828 // 1) search for field in current klass |
827 if (find_local_field(name, sig, fd)) { | 829 if (find_local_field(name, sig, fd)) { |
828 return as_klassOop(); | 830 return as_klassOop(); |
829 } | 831 } |
838 // 4) otherwise field lookup fails | 840 // 4) otherwise field lookup fails |
839 return NULL; | 841 return NULL; |
840 } | 842 } |
841 | 843 |
842 | 844 |
843 klassOop instanceKlass::find_field(symbolOop name, symbolOop sig, bool is_static, fieldDescriptor* fd) const { | 845 klassOop instanceKlass::find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const { |
844 // search order according to newest JVM spec (5.4.3.2, p.167). | 846 // search order according to newest JVM spec (5.4.3.2, p.167). |
845 // 1) search for field in current klass | 847 // 1) search for field in current klass |
846 if (find_local_field(name, sig, fd)) { | 848 if (find_local_field(name, sig, fd)) { |
847 if (fd->is_static() == is_static) return as_klassOop(); | 849 if (fd->is_static() == is_static) return as_klassOop(); |
848 } | 850 } |
965 f(as_klassOop()); | 967 f(as_klassOop()); |
966 array_klasses_do(f); | 968 array_klasses_do(f); |
967 } | 969 } |
968 | 970 |
969 #ifdef ASSERT | 971 #ifdef ASSERT |
970 static int linear_search(objArrayOop methods, symbolOop name, symbolOop signature) { | 972 static int linear_search(objArrayOop methods, Symbol* name, Symbol* signature) { |
971 int len = methods->length(); | 973 int len = methods->length(); |
972 for (int index = 0; index < len; index++) { | 974 for (int index = 0; index < len; index++) { |
973 methodOop m = (methodOop)(methods->obj_at(index)); | 975 methodOop m = (methodOop)(methods->obj_at(index)); |
974 assert(m->is_method(), "must be method"); | 976 assert(m->is_method(), "must be method"); |
975 if (m->signature() == signature && m->name() == name) { | 977 if (m->signature() == signature && m->name() == name) { |
978 } | 980 } |
979 return -1; | 981 return -1; |
980 } | 982 } |
981 #endif | 983 #endif |
982 | 984 |
983 methodOop instanceKlass::find_method(symbolOop name, symbolOop signature) const { | 985 methodOop instanceKlass::find_method(Symbol* name, Symbol* signature) const { |
984 return instanceKlass::find_method(methods(), name, signature); | 986 return instanceKlass::find_method(methods(), name, signature); |
985 } | 987 } |
986 | 988 |
987 methodOop instanceKlass::find_method(objArrayOop methods, symbolOop name, symbolOop signature) { | 989 methodOop instanceKlass::find_method(objArrayOop methods, Symbol* name, Symbol* signature) { |
988 int len = methods->length(); | 990 int len = methods->length(); |
989 // methods are sorted, so do binary search | 991 // methods are sorted, so do binary search |
990 int l = 0; | 992 int l = 0; |
991 int h = len - 1; | 993 int h = len - 1; |
992 while (l <= h) { | 994 while (l <= h) { |
1030 assert(index == -1, err_msg("binary search should have found entry %d", index)); | 1032 assert(index == -1, err_msg("binary search should have found entry %d", index)); |
1031 #endif | 1033 #endif |
1032 return NULL; | 1034 return NULL; |
1033 } | 1035 } |
1034 | 1036 |
1035 methodOop instanceKlass::uncached_lookup_method(symbolOop name, symbolOop signature) const { | 1037 methodOop instanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { |
1036 klassOop klass = as_klassOop(); | 1038 klassOop klass = as_klassOop(); |
1037 while (klass != NULL) { | 1039 while (klass != NULL) { |
1038 methodOop method = instanceKlass::cast(klass)->find_method(name, signature); | 1040 methodOop method = instanceKlass::cast(klass)->find_method(name, signature); |
1039 if (method != NULL) return method; | 1041 if (method != NULL) return method; |
1040 klass = instanceKlass::cast(klass)->super(); | 1042 klass = instanceKlass::cast(klass)->super(); |
1041 } | 1043 } |
1042 return NULL; | 1044 return NULL; |
1043 } | 1045 } |
1044 | 1046 |
1045 // lookup a method in all the interfaces that this class implements | 1047 // lookup a method in all the interfaces that this class implements |
1046 methodOop instanceKlass::lookup_method_in_all_interfaces(symbolOop name, | 1048 methodOop instanceKlass::lookup_method_in_all_interfaces(Symbol* name, |
1047 symbolOop signature) const { | 1049 Symbol* signature) const { |
1048 objArrayOop all_ifs = instanceKlass::cast(as_klassOop())->transitive_interfaces(); | 1050 objArrayOop all_ifs = instanceKlass::cast(as_klassOop())->transitive_interfaces(); |
1049 int num_ifs = all_ifs->length(); | 1051 int num_ifs = all_ifs->length(); |
1050 instanceKlass *ik = NULL; | 1052 instanceKlass *ik = NULL; |
1051 for (int i = 0; i < num_ifs; i++) { | 1053 for (int i = 0; i < num_ifs; i++) { |
1052 ik = instanceKlass::cast(klassOop(all_ifs->obj_at(i))); | 1054 ik = instanceKlass::cast(klassOop(all_ifs->obj_at(i))); |
1990 if (_cached_class_file_bytes != NULL) { | 1992 if (_cached_class_file_bytes != NULL) { |
1991 os::free(_cached_class_file_bytes); | 1993 os::free(_cached_class_file_bytes); |
1992 _cached_class_file_bytes = NULL; | 1994 _cached_class_file_bytes = NULL; |
1993 _cached_class_file_len = 0; | 1995 _cached_class_file_len = 0; |
1994 } | 1996 } |
1997 | |
1998 // Decrement symbol reference counts associated with the unloaded class. | |
1999 if (_name != NULL) _name->decrement_refcount(); | |
2000 // unreference array name derived from this class name (arrays of an unloaded | |
2001 // class can't be referenced anymore). | |
2002 if (_array_name != NULL) _array_name->decrement_refcount(); | |
2003 if (_source_file_name != NULL) _source_file_name->decrement_refcount(); | |
2004 if (_source_debug_extension != NULL) _source_debug_extension->decrement_refcount(); | |
2005 // walk constant pool and decrement symbol reference counts | |
2006 _constants->unreference_symbols(); | |
2007 } | |
2008 | |
2009 void instanceKlass::set_source_file_name(Symbol* n) { | |
2010 _source_file_name = n; | |
2011 if (_source_file_name != NULL) _source_file_name->increment_refcount(); | |
2012 } | |
2013 | |
2014 void instanceKlass::set_source_debug_extension(Symbol* n) { | |
2015 _source_debug_extension = n; | |
2016 if (_source_debug_extension != NULL) _source_debug_extension->increment_refcount(); | |
1995 } | 2017 } |
1996 | 2018 |
1997 const char* instanceKlass::signature_name() const { | 2019 const char* instanceKlass::signature_name() const { |
1998 const char* src = (const char*) (name()->as_C_string()); | 2020 const char* src = (const char*) (name()->as_C_string()); |
1999 const int src_length = (int)strlen(src); | 2021 const int src_length = (int)strlen(src); |
2011 | 2033 |
2012 // different verisons of is_same_class_package | 2034 // different verisons of is_same_class_package |
2013 bool instanceKlass::is_same_class_package(klassOop class2) { | 2035 bool instanceKlass::is_same_class_package(klassOop class2) { |
2014 klassOop class1 = as_klassOop(); | 2036 klassOop class1 = as_klassOop(); |
2015 oop classloader1 = instanceKlass::cast(class1)->class_loader(); | 2037 oop classloader1 = instanceKlass::cast(class1)->class_loader(); |
2016 symbolOop classname1 = Klass::cast(class1)->name(); | 2038 Symbol* classname1 = Klass::cast(class1)->name(); |
2017 | 2039 |
2018 if (Klass::cast(class2)->oop_is_objArray()) { | 2040 if (Klass::cast(class2)->oop_is_objArray()) { |
2019 class2 = objArrayKlass::cast(class2)->bottom_klass(); | 2041 class2 = objArrayKlass::cast(class2)->bottom_klass(); |
2020 } | 2042 } |
2021 oop classloader2; | 2043 oop classloader2; |
2023 classloader2 = instanceKlass::cast(class2)->class_loader(); | 2045 classloader2 = instanceKlass::cast(class2)->class_loader(); |
2024 } else { | 2046 } else { |
2025 assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array"); | 2047 assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array"); |
2026 classloader2 = NULL; | 2048 classloader2 = NULL; |
2027 } | 2049 } |
2028 symbolOop classname2 = Klass::cast(class2)->name(); | 2050 Symbol* classname2 = Klass::cast(class2)->name(); |
2029 | 2051 |
2030 return instanceKlass::is_same_class_package(classloader1, classname1, | 2052 return instanceKlass::is_same_class_package(classloader1, classname1, |
2031 classloader2, classname2); | 2053 classloader2, classname2); |
2032 } | 2054 } |
2033 | 2055 |
2034 bool instanceKlass::is_same_class_package(oop classloader2, symbolOop classname2) { | 2056 bool instanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) { |
2035 klassOop class1 = as_klassOop(); | 2057 klassOop class1 = as_klassOop(); |
2036 oop classloader1 = instanceKlass::cast(class1)->class_loader(); | 2058 oop classloader1 = instanceKlass::cast(class1)->class_loader(); |
2037 symbolOop classname1 = Klass::cast(class1)->name(); | 2059 Symbol* classname1 = Klass::cast(class1)->name(); |
2038 | 2060 |
2039 return instanceKlass::is_same_class_package(classloader1, classname1, | 2061 return instanceKlass::is_same_class_package(classloader1, classname1, |
2040 classloader2, classname2); | 2062 classloader2, classname2); |
2041 } | 2063 } |
2042 | 2064 |
2043 // return true if two classes are in the same package, classloader | 2065 // return true if two classes are in the same package, classloader |
2044 // and classname information is enough to determine a class's package | 2066 // and classname information is enough to determine a class's package |
2045 bool instanceKlass::is_same_class_package(oop class_loader1, symbolOop class_name1, | 2067 bool instanceKlass::is_same_class_package(oop class_loader1, Symbol* class_name1, |
2046 oop class_loader2, symbolOop class_name2) { | 2068 oop class_loader2, Symbol* class_name2) { |
2047 if (class_loader1 != class_loader2) { | 2069 if (class_loader1 != class_loader2) { |
2048 return false; | 2070 return false; |
2049 } else if (class_name1 == class_name2) { | 2071 } else if (class_name1 == class_name2) { |
2050 return true; // skip painful bytewise comparison | 2072 return true; // skip painful bytewise comparison |
2051 } else { | 2073 } else { |
2052 ResourceMark rm; | 2074 ResourceMark rm; |
2053 | 2075 |
2054 // The symbolOop's are in UTF8 encoding. Since we only need to check explicitly | 2076 // The Symbol*'s are in UTF8 encoding. Since we only need to check explicitly |
2055 // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding. | 2077 // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding. |
2056 // Otherwise, we just compare jbyte values between the strings. | 2078 // Otherwise, we just compare jbyte values between the strings. |
2057 jbyte *name1 = class_name1->base(); | 2079 const jbyte *name1 = class_name1->base(); |
2058 jbyte *name2 = class_name2->base(); | 2080 const jbyte *name2 = class_name2->base(); |
2059 | 2081 |
2060 jbyte *last_slash1 = UTF8::strrchr(name1, class_name1->utf8_length(), '/'); | 2082 const jbyte *last_slash1 = UTF8::strrchr(name1, class_name1->utf8_length(), '/'); |
2061 jbyte *last_slash2 = UTF8::strrchr(name2, class_name2->utf8_length(), '/'); | 2083 const jbyte *last_slash2 = UTF8::strrchr(name2, class_name2->utf8_length(), '/'); |
2062 | 2084 |
2063 if ((last_slash1 == NULL) || (last_slash2 == NULL)) { | 2085 if ((last_slash1 == NULL) || (last_slash2 == NULL)) { |
2064 // One of the two doesn't have a package. Only return true | 2086 // One of the two doesn't have a package. Only return true |
2065 // if the other one also doesn't have a package. | 2087 // if the other one also doesn't have a package. |
2066 return last_slash1 == last_slash2; | 2088 return last_slash1 == last_slash2; |
2097 // Returns true iff super_method can be overridden by a method in targetclassname | 2119 // Returns true iff super_method can be overridden by a method in targetclassname |
2098 // See JSL 3rd edition 8.4.6.1 | 2120 // See JSL 3rd edition 8.4.6.1 |
2099 // Assumes name-signature match | 2121 // Assumes name-signature match |
2100 // "this" is instanceKlass of super_method which must exist | 2122 // "this" is instanceKlass of super_method which must exist |
2101 // note that the instanceKlass of the method in the targetclassname has not always been created yet | 2123 // note that the instanceKlass of the method in the targetclassname has not always been created yet |
2102 bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloader, symbolHandle targetclassname, TRAPS) { | 2124 bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) { |
2103 // Private methods can not be overridden | 2125 // Private methods can not be overridden |
2104 if (super_method->is_private()) { | 2126 if (super_method->is_private()) { |
2105 return false; | 2127 return false; |
2106 } | 2128 } |
2107 // If super method is accessible, then override | 2129 // If super method is accessible, then override |
2109 (super_method->is_public())) { | 2131 (super_method->is_public())) { |
2110 return true; | 2132 return true; |
2111 } | 2133 } |
2112 // Package-private methods are not inherited outside of package | 2134 // Package-private methods are not inherited outside of package |
2113 assert(super_method->is_package_private(), "must be package private"); | 2135 assert(super_method->is_package_private(), "must be package private"); |
2114 return(is_same_class_package(targetclassloader(), targetclassname())); | 2136 return(is_same_class_package(targetclassloader(), targetclassname)); |
2115 } | 2137 } |
2116 | 2138 |
2117 /* defined for now in jvm.cpp, for historical reasons *-- | 2139 /* defined for now in jvm.cpp, for historical reasons *-- |
2118 klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, | 2140 klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, |
2119 symbolOop& simple_name_result, TRAPS) { | 2141 Symbol*& simple_name_result, TRAPS) { |
2120 ... | 2142 ... |
2121 } | 2143 } |
2122 */ | 2144 */ |
2123 | 2145 |
2124 // tell if two classes have the same enclosing class (at package level) | 2146 // tell if two classes have the same enclosing class (at package level) |
2185 // Strange but true: JVM spec. allows null inner class refs. | 2207 // Strange but true: JVM spec. allows null inner class refs. |
2186 if (ioff == 0) continue; | 2208 if (ioff == 0) continue; |
2187 | 2209 |
2188 // only look at classes that are already loaded | 2210 // only look at classes that are already loaded |
2189 // since we are looking for the flags for our self. | 2211 // since we are looking for the flags for our self. |
2190 symbolOop inner_name = ik->constants()->klass_name_at(ioff); | 2212 Symbol* inner_name = ik->constants()->klass_name_at(ioff); |
2191 if ((ik->name() == inner_name)) { | 2213 if ((ik->name() == inner_name)) { |
2192 // This is really a member class. | 2214 // This is really a member class. |
2193 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); | 2215 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); |
2194 break; | 2216 break; |
2195 } | 2217 } |
2224 | 2246 |
2225 for (int cnt = 0 ; ; cnt ++, ioe ++) { | 2247 for (int cnt = 0 ; ; cnt ++, ioe ++) { |
2226 // If the interface isn't implemented by the receiver class, | 2248 // If the interface isn't implemented by the receiver class, |
2227 // the VM should throw IncompatibleClassChangeError. | 2249 // the VM should throw IncompatibleClassChangeError. |
2228 if (cnt >= nof_interfaces) { | 2250 if (cnt >= nof_interfaces) { |
2229 THROW_OOP_0(vmSymbols::java_lang_IncompatibleClassChangeError()); | 2251 THROW_0(vmSymbols::java_lang_IncompatibleClassChangeError()); |
2230 } | 2252 } |
2231 | 2253 |
2232 klassOop ik = ioe->interface_klass(); | 2254 klassOop ik = ioe->interface_klass(); |
2233 if (ik == holder) break; | 2255 if (ik == holder) break; |
2234 } | 2256 } |
2235 | 2257 |
2236 itableMethodEntry* ime = ioe->first_method_entry(as_klassOop()); | 2258 itableMethodEntry* ime = ioe->first_method_entry(as_klassOop()); |
2237 methodOop m = ime[index].method(); | 2259 methodOop m = ime[index].method(); |
2238 if (m == NULL) { | 2260 if (m == NULL) { |
2239 THROW_OOP_0(vmSymbols::java_lang_AbstractMethodError()); | 2261 THROW_0(vmSymbols::java_lang_AbstractMethodError()); |
2240 } | 2262 } |
2241 return m; | 2263 return m; |
2242 } | 2264 } |
2243 | 2265 |
2244 // On-stack replacement stuff | 2266 // On-stack replacement stuff |
2721 int local_count = 0; | 2743 int local_count = 0; |
2722 for (int i = 0; i < old_methods->length(); i++) { | 2744 for (int i = 0; i < old_methods->length(); i++) { |
2723 if (!emcp_methods->at(i)) { | 2745 if (!emcp_methods->at(i)) { |
2724 // only obsolete methods are interesting | 2746 // only obsolete methods are interesting |
2725 methodOop old_method = (methodOop) old_methods->obj_at(i); | 2747 methodOop old_method = (methodOop) old_methods->obj_at(i); |
2726 symbolOop m_name = old_method->name(); | 2748 Symbol* m_name = old_method->name(); |
2727 symbolOop m_signature = old_method->signature(); | 2749 Symbol* m_signature = old_method->signature(); |
2728 | 2750 |
2729 // skip the last entry since we just added it | 2751 // skip the last entry since we just added it |
2730 for (int j = _previous_versions->length() - 2; j >= 0; j--) { | 2752 for (int j = _previous_versions->length() - 2; j >= 0; j--) { |
2731 // check the previous versions array for a GC'ed weak refs | 2753 // check the previous versions array for a GC'ed weak refs |
2732 pv_node = _previous_versions->at(j); | 2754 pv_node = _previous_versions->at(j); |