Mercurial > hg > graal-compiler
comparison src/share/vm/oops/instanceKlass.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | f95d63e2154a |
children | d25d4ca69222 e5383553fd4e |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
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 } |
768 // _oop_map_cache is constant after init; lookup below does is own locking. | 768 // _oop_map_cache is constant after init; lookup below does is own locking. |
769 _oop_map_cache->lookup(method, bci, entry_for); | 769 _oop_map_cache->lookup(method, bci, entry_for); |
770 } | 770 } |
771 | 771 |
772 | 772 |
773 bool instanceKlass::find_local_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | 773 bool instanceKlass::find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
774 const int n = fields()->length(); | 774 const int n = fields()->length(); |
775 for (int i = 0; i < n; i += next_offset ) { | 775 for (int i = 0; i < n; i += next_offset ) { |
776 int name_index = fields()->ushort_at(i + name_index_offset); | 776 int name_index = fields()->ushort_at(i + name_index_offset); |
777 int sig_index = fields()->ushort_at(i + signature_index_offset); | 777 int sig_index = fields()->ushort_at(i + signature_index_offset); |
778 symbolOop f_name = constants()->symbol_at(name_index); | 778 Symbol* f_name = constants()->symbol_at(name_index); |
779 symbolOop f_sig = constants()->symbol_at(sig_index); | 779 Symbol* f_sig = constants()->symbol_at(sig_index); |
780 if (f_name == name && f_sig == sig) { | 780 if (f_name == name && f_sig == sig) { |
781 fd->initialize(as_klassOop(), i); | 781 fd->initialize(as_klassOop(), i); |
782 return true; | 782 return true; |
783 } | 783 } |
784 } | 784 } |
785 return false; | 785 return false; |
786 } | 786 } |
787 | 787 |
788 | 788 |
789 void instanceKlass::field_names_and_sigs_iterate(OopClosure* closure) { | 789 void instanceKlass::shared_symbols_iterate(SymbolClosure* closure) { |
790 Klass::shared_symbols_iterate(closure); | |
791 closure->do_symbol(&_generic_signature); | |
792 closure->do_symbol(&_source_file_name); | |
793 closure->do_symbol(&_source_debug_extension); | |
794 | |
790 const int n = fields()->length(); | 795 const int n = fields()->length(); |
791 for (int i = 0; i < n; i += next_offset ) { | 796 for (int i = 0; i < n; i += next_offset ) { |
792 int name_index = fields()->ushort_at(i + name_index_offset); | 797 int name_index = fields()->ushort_at(i + name_index_offset); |
793 symbolOop name = constants()->symbol_at(name_index); | 798 closure->do_symbol(constants()->symbol_at_addr(name_index)); |
794 closure->do_oop((oop*)&name); | |
795 | |
796 int sig_index = fields()->ushort_at(i + signature_index_offset); | 799 int sig_index = fields()->ushort_at(i + signature_index_offset); |
797 symbolOop sig = constants()->symbol_at(sig_index); | 800 closure->do_symbol(constants()->symbol_at_addr(sig_index)); |
798 closure->do_oop((oop*)&sig); | 801 } |
799 } | 802 } |
800 } | 803 |
801 | 804 |
802 | 805 klassOop instanceKlass::find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
803 klassOop instanceKlass::find_interface_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | |
804 const int n = local_interfaces()->length(); | 806 const int n = local_interfaces()->length(); |
805 for (int i = 0; i < n; i++) { | 807 for (int i = 0; i < n; i++) { |
806 klassOop intf1 = klassOop(local_interfaces()->obj_at(i)); | 808 klassOop intf1 = klassOop(local_interfaces()->obj_at(i)); |
807 assert(Klass::cast(intf1)->is_interface(), "just checking type"); | 809 assert(Klass::cast(intf1)->is_interface(), "just checking type"); |
808 // search for field in current interface | 810 // search for field in current interface |
817 // otherwise field lookup fails | 819 // otherwise field lookup fails |
818 return NULL; | 820 return NULL; |
819 } | 821 } |
820 | 822 |
821 | 823 |
822 klassOop instanceKlass::find_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const { | 824 klassOop instanceKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
823 // search order according to newest JVM spec (5.4.3.2, p.167). | 825 // search order according to newest JVM spec (5.4.3.2, p.167). |
824 // 1) search for field in current klass | 826 // 1) search for field in current klass |
825 if (find_local_field(name, sig, fd)) { | 827 if (find_local_field(name, sig, fd)) { |
826 return as_klassOop(); | 828 return as_klassOop(); |
827 } | 829 } |
836 // 4) otherwise field lookup fails | 838 // 4) otherwise field lookup fails |
837 return NULL; | 839 return NULL; |
838 } | 840 } |
839 | 841 |
840 | 842 |
841 klassOop instanceKlass::find_field(symbolOop name, symbolOop sig, bool is_static, fieldDescriptor* fd) const { | 843 klassOop instanceKlass::find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const { |
842 // search order according to newest JVM spec (5.4.3.2, p.167). | 844 // search order according to newest JVM spec (5.4.3.2, p.167). |
843 // 1) search for field in current klass | 845 // 1) search for field in current klass |
844 if (find_local_field(name, sig, fd)) { | 846 if (find_local_field(name, sig, fd)) { |
845 if (fd->is_static() == is_static) return as_klassOop(); | 847 if (fd->is_static() == is_static) return as_klassOop(); |
846 } | 848 } |
963 f(as_klassOop()); | 965 f(as_klassOop()); |
964 array_klasses_do(f); | 966 array_klasses_do(f); |
965 } | 967 } |
966 | 968 |
967 #ifdef ASSERT | 969 #ifdef ASSERT |
968 static int linear_search(objArrayOop methods, symbolOop name, symbolOop signature) { | 970 static int linear_search(objArrayOop methods, Symbol* name, Symbol* signature) { |
969 int len = methods->length(); | 971 int len = methods->length(); |
970 for (int index = 0; index < len; index++) { | 972 for (int index = 0; index < len; index++) { |
971 methodOop m = (methodOop)(methods->obj_at(index)); | 973 methodOop m = (methodOop)(methods->obj_at(index)); |
972 assert(m->is_method(), "must be method"); | 974 assert(m->is_method(), "must be method"); |
973 if (m->signature() == signature && m->name() == name) { | 975 if (m->signature() == signature && m->name() == name) { |
976 } | 978 } |
977 return -1; | 979 return -1; |
978 } | 980 } |
979 #endif | 981 #endif |
980 | 982 |
981 methodOop instanceKlass::find_method(symbolOop name, symbolOop signature) const { | 983 methodOop instanceKlass::find_method(Symbol* name, Symbol* signature) const { |
982 return instanceKlass::find_method(methods(), name, signature); | 984 return instanceKlass::find_method(methods(), name, signature); |
983 } | 985 } |
984 | 986 |
985 methodOop instanceKlass::find_method(objArrayOop methods, symbolOop name, symbolOop signature) { | 987 methodOop instanceKlass::find_method(objArrayOop methods, Symbol* name, Symbol* signature) { |
986 int len = methods->length(); | 988 int len = methods->length(); |
987 // methods are sorted, so do binary search | 989 // methods are sorted, so do binary search |
988 int l = 0; | 990 int l = 0; |
989 int h = len - 1; | 991 int h = len - 1; |
990 while (l <= h) { | 992 while (l <= h) { |
1028 assert(index == -1, err_msg("binary search should have found entry %d", index)); | 1030 assert(index == -1, err_msg("binary search should have found entry %d", index)); |
1029 #endif | 1031 #endif |
1030 return NULL; | 1032 return NULL; |
1031 } | 1033 } |
1032 | 1034 |
1033 methodOop instanceKlass::uncached_lookup_method(symbolOop name, symbolOop signature) const { | 1035 methodOop instanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { |
1034 klassOop klass = as_klassOop(); | 1036 klassOop klass = as_klassOop(); |
1035 while (klass != NULL) { | 1037 while (klass != NULL) { |
1036 methodOop method = instanceKlass::cast(klass)->find_method(name, signature); | 1038 methodOop method = instanceKlass::cast(klass)->find_method(name, signature); |
1037 if (method != NULL) return method; | 1039 if (method != NULL) return method; |
1038 klass = instanceKlass::cast(klass)->super(); | 1040 klass = instanceKlass::cast(klass)->super(); |
1039 } | 1041 } |
1040 return NULL; | 1042 return NULL; |
1041 } | 1043 } |
1042 | 1044 |
1043 // lookup a method in all the interfaces that this class implements | 1045 // lookup a method in all the interfaces that this class implements |
1044 methodOop instanceKlass::lookup_method_in_all_interfaces(symbolOop name, | 1046 methodOop instanceKlass::lookup_method_in_all_interfaces(Symbol* name, |
1045 symbolOop signature) const { | 1047 Symbol* signature) const { |
1046 objArrayOop all_ifs = instanceKlass::cast(as_klassOop())->transitive_interfaces(); | 1048 objArrayOop all_ifs = instanceKlass::cast(as_klassOop())->transitive_interfaces(); |
1047 int num_ifs = all_ifs->length(); | 1049 int num_ifs = all_ifs->length(); |
1048 instanceKlass *ik = NULL; | 1050 instanceKlass *ik = NULL; |
1049 for (int i = 0; i < num_ifs; i++) { | 1051 for (int i = 0; i < num_ifs; i++) { |
1050 ik = instanceKlass::cast(klassOop(all_ifs->obj_at(i))); | 1052 ik = instanceKlass::cast(klassOop(all_ifs->obj_at(i))); |
1988 if (_cached_class_file_bytes != NULL) { | 1990 if (_cached_class_file_bytes != NULL) { |
1989 os::free(_cached_class_file_bytes); | 1991 os::free(_cached_class_file_bytes); |
1990 _cached_class_file_bytes = NULL; | 1992 _cached_class_file_bytes = NULL; |
1991 _cached_class_file_len = 0; | 1993 _cached_class_file_len = 0; |
1992 } | 1994 } |
1995 | |
1996 // Decrement symbol reference counts associated with the unloaded class. | |
1997 if (_name != NULL) _name->decrement_refcount(); | |
1998 // unreference array name derived from this class name (arrays of an unloaded | |
1999 // class can't be referenced anymore). | |
2000 if (_array_name != NULL) _array_name->decrement_refcount(); | |
2001 if (_source_file_name != NULL) _source_file_name->decrement_refcount(); | |
2002 if (_source_debug_extension != NULL) _source_debug_extension->decrement_refcount(); | |
2003 // walk constant pool and decrement symbol reference counts | |
2004 _constants->unreference_symbols(); | |
2005 } | |
2006 | |
2007 void instanceKlass::set_source_file_name(Symbol* n) { | |
2008 _source_file_name = n; | |
2009 if (_source_file_name != NULL) _source_file_name->increment_refcount(); | |
2010 } | |
2011 | |
2012 void instanceKlass::set_source_debug_extension(Symbol* n) { | |
2013 _source_debug_extension = n; | |
2014 if (_source_debug_extension != NULL) _source_debug_extension->increment_refcount(); | |
1993 } | 2015 } |
1994 | 2016 |
1995 const char* instanceKlass::signature_name() const { | 2017 const char* instanceKlass::signature_name() const { |
1996 const char* src = (const char*) (name()->as_C_string()); | 2018 const char* src = (const char*) (name()->as_C_string()); |
1997 const int src_length = (int)strlen(src); | 2019 const int src_length = (int)strlen(src); |
2009 | 2031 |
2010 // different verisons of is_same_class_package | 2032 // different verisons of is_same_class_package |
2011 bool instanceKlass::is_same_class_package(klassOop class2) { | 2033 bool instanceKlass::is_same_class_package(klassOop class2) { |
2012 klassOop class1 = as_klassOop(); | 2034 klassOop class1 = as_klassOop(); |
2013 oop classloader1 = instanceKlass::cast(class1)->class_loader(); | 2035 oop classloader1 = instanceKlass::cast(class1)->class_loader(); |
2014 symbolOop classname1 = Klass::cast(class1)->name(); | 2036 Symbol* classname1 = Klass::cast(class1)->name(); |
2015 | 2037 |
2016 if (Klass::cast(class2)->oop_is_objArray()) { | 2038 if (Klass::cast(class2)->oop_is_objArray()) { |
2017 class2 = objArrayKlass::cast(class2)->bottom_klass(); | 2039 class2 = objArrayKlass::cast(class2)->bottom_klass(); |
2018 } | 2040 } |
2019 oop classloader2; | 2041 oop classloader2; |
2021 classloader2 = instanceKlass::cast(class2)->class_loader(); | 2043 classloader2 = instanceKlass::cast(class2)->class_loader(); |
2022 } else { | 2044 } else { |
2023 assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array"); | 2045 assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array"); |
2024 classloader2 = NULL; | 2046 classloader2 = NULL; |
2025 } | 2047 } |
2026 symbolOop classname2 = Klass::cast(class2)->name(); | 2048 Symbol* classname2 = Klass::cast(class2)->name(); |
2027 | 2049 |
2028 return instanceKlass::is_same_class_package(classloader1, classname1, | 2050 return instanceKlass::is_same_class_package(classloader1, classname1, |
2029 classloader2, classname2); | 2051 classloader2, classname2); |
2030 } | 2052 } |
2031 | 2053 |
2032 bool instanceKlass::is_same_class_package(oop classloader2, symbolOop classname2) { | 2054 bool instanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) { |
2033 klassOop class1 = as_klassOop(); | 2055 klassOop class1 = as_klassOop(); |
2034 oop classloader1 = instanceKlass::cast(class1)->class_loader(); | 2056 oop classloader1 = instanceKlass::cast(class1)->class_loader(); |
2035 symbolOop classname1 = Klass::cast(class1)->name(); | 2057 Symbol* classname1 = Klass::cast(class1)->name(); |
2036 | 2058 |
2037 return instanceKlass::is_same_class_package(classloader1, classname1, | 2059 return instanceKlass::is_same_class_package(classloader1, classname1, |
2038 classloader2, classname2); | 2060 classloader2, classname2); |
2039 } | 2061 } |
2040 | 2062 |
2041 // return true if two classes are in the same package, classloader | 2063 // return true if two classes are in the same package, classloader |
2042 // and classname information is enough to determine a class's package | 2064 // and classname information is enough to determine a class's package |
2043 bool instanceKlass::is_same_class_package(oop class_loader1, symbolOop class_name1, | 2065 bool instanceKlass::is_same_class_package(oop class_loader1, Symbol* class_name1, |
2044 oop class_loader2, symbolOop class_name2) { | 2066 oop class_loader2, Symbol* class_name2) { |
2045 if (class_loader1 != class_loader2) { | 2067 if (class_loader1 != class_loader2) { |
2046 return false; | 2068 return false; |
2047 } else if (class_name1 == class_name2) { | 2069 } else if (class_name1 == class_name2) { |
2048 return true; // skip painful bytewise comparison | 2070 return true; // skip painful bytewise comparison |
2049 } else { | 2071 } else { |
2050 ResourceMark rm; | 2072 ResourceMark rm; |
2051 | 2073 |
2052 // The symbolOop's are in UTF8 encoding. Since we only need to check explicitly | 2074 // The Symbol*'s are in UTF8 encoding. Since we only need to check explicitly |
2053 // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding. | 2075 // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding. |
2054 // Otherwise, we just compare jbyte values between the strings. | 2076 // Otherwise, we just compare jbyte values between the strings. |
2055 jbyte *name1 = class_name1->base(); | 2077 const jbyte *name1 = class_name1->base(); |
2056 jbyte *name2 = class_name2->base(); | 2078 const jbyte *name2 = class_name2->base(); |
2057 | 2079 |
2058 jbyte *last_slash1 = UTF8::strrchr(name1, class_name1->utf8_length(), '/'); | 2080 const jbyte *last_slash1 = UTF8::strrchr(name1, class_name1->utf8_length(), '/'); |
2059 jbyte *last_slash2 = UTF8::strrchr(name2, class_name2->utf8_length(), '/'); | 2081 const jbyte *last_slash2 = UTF8::strrchr(name2, class_name2->utf8_length(), '/'); |
2060 | 2082 |
2061 if ((last_slash1 == NULL) || (last_slash2 == NULL)) { | 2083 if ((last_slash1 == NULL) || (last_slash2 == NULL)) { |
2062 // One of the two doesn't have a package. Only return true | 2084 // One of the two doesn't have a package. Only return true |
2063 // if the other one also doesn't have a package. | 2085 // if the other one also doesn't have a package. |
2064 return last_slash1 == last_slash2; | 2086 return last_slash1 == last_slash2; |
2095 // Returns true iff super_method can be overridden by a method in targetclassname | 2117 // Returns true iff super_method can be overridden by a method in targetclassname |
2096 // See JSL 3rd edition 8.4.6.1 | 2118 // See JSL 3rd edition 8.4.6.1 |
2097 // Assumes name-signature match | 2119 // Assumes name-signature match |
2098 // "this" is instanceKlass of super_method which must exist | 2120 // "this" is instanceKlass of super_method which must exist |
2099 // note that the instanceKlass of the method in the targetclassname has not always been created yet | 2121 // note that the instanceKlass of the method in the targetclassname has not always been created yet |
2100 bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloader, symbolHandle targetclassname, TRAPS) { | 2122 bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) { |
2101 // Private methods can not be overridden | 2123 // Private methods can not be overridden |
2102 if (super_method->is_private()) { | 2124 if (super_method->is_private()) { |
2103 return false; | 2125 return false; |
2104 } | 2126 } |
2105 // If super method is accessible, then override | 2127 // If super method is accessible, then override |
2107 (super_method->is_public())) { | 2129 (super_method->is_public())) { |
2108 return true; | 2130 return true; |
2109 } | 2131 } |
2110 // Package-private methods are not inherited outside of package | 2132 // Package-private methods are not inherited outside of package |
2111 assert(super_method->is_package_private(), "must be package private"); | 2133 assert(super_method->is_package_private(), "must be package private"); |
2112 return(is_same_class_package(targetclassloader(), targetclassname())); | 2134 return(is_same_class_package(targetclassloader(), targetclassname)); |
2113 } | 2135 } |
2114 | 2136 |
2115 /* defined for now in jvm.cpp, for historical reasons *-- | 2137 /* defined for now in jvm.cpp, for historical reasons *-- |
2116 klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, | 2138 klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, |
2117 symbolOop& simple_name_result, TRAPS) { | 2139 Symbol*& simple_name_result, TRAPS) { |
2118 ... | 2140 ... |
2119 } | 2141 } |
2120 */ | 2142 */ |
2121 | 2143 |
2122 // tell if two classes have the same enclosing class (at package level) | 2144 // tell if two classes have the same enclosing class (at package level) |
2183 // Strange but true: JVM spec. allows null inner class refs. | 2205 // Strange but true: JVM spec. allows null inner class refs. |
2184 if (ioff == 0) continue; | 2206 if (ioff == 0) continue; |
2185 | 2207 |
2186 // only look at classes that are already loaded | 2208 // only look at classes that are already loaded |
2187 // since we are looking for the flags for our self. | 2209 // since we are looking for the flags for our self. |
2188 symbolOop inner_name = ik->constants()->klass_name_at(ioff); | 2210 Symbol* inner_name = ik->constants()->klass_name_at(ioff); |
2189 if ((ik->name() == inner_name)) { | 2211 if ((ik->name() == inner_name)) { |
2190 // This is really a member class. | 2212 // This is really a member class. |
2191 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); | 2213 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); |
2192 break; | 2214 break; |
2193 } | 2215 } |
2222 | 2244 |
2223 for (int cnt = 0 ; ; cnt ++, ioe ++) { | 2245 for (int cnt = 0 ; ; cnt ++, ioe ++) { |
2224 // If the interface isn't implemented by the receiver class, | 2246 // If the interface isn't implemented by the receiver class, |
2225 // the VM should throw IncompatibleClassChangeError. | 2247 // the VM should throw IncompatibleClassChangeError. |
2226 if (cnt >= nof_interfaces) { | 2248 if (cnt >= nof_interfaces) { |
2227 THROW_OOP_0(vmSymbols::java_lang_IncompatibleClassChangeError()); | 2249 THROW_0(vmSymbols::java_lang_IncompatibleClassChangeError()); |
2228 } | 2250 } |
2229 | 2251 |
2230 klassOop ik = ioe->interface_klass(); | 2252 klassOop ik = ioe->interface_klass(); |
2231 if (ik == holder) break; | 2253 if (ik == holder) break; |
2232 } | 2254 } |
2233 | 2255 |
2234 itableMethodEntry* ime = ioe->first_method_entry(as_klassOop()); | 2256 itableMethodEntry* ime = ioe->first_method_entry(as_klassOop()); |
2235 methodOop m = ime[index].method(); | 2257 methodOop m = ime[index].method(); |
2236 if (m == NULL) { | 2258 if (m == NULL) { |
2237 THROW_OOP_0(vmSymbols::java_lang_AbstractMethodError()); | 2259 THROW_0(vmSymbols::java_lang_AbstractMethodError()); |
2238 } | 2260 } |
2239 return m; | 2261 return m; |
2240 } | 2262 } |
2241 | 2263 |
2242 // On-stack replacement stuff | 2264 // On-stack replacement stuff |
2719 int local_count = 0; | 2741 int local_count = 0; |
2720 for (int i = 0; i < old_methods->length(); i++) { | 2742 for (int i = 0; i < old_methods->length(); i++) { |
2721 if (!emcp_methods->at(i)) { | 2743 if (!emcp_methods->at(i)) { |
2722 // only obsolete methods are interesting | 2744 // only obsolete methods are interesting |
2723 methodOop old_method = (methodOop) old_methods->obj_at(i); | 2745 methodOop old_method = (methodOop) old_methods->obj_at(i); |
2724 symbolOop m_name = old_method->name(); | 2746 Symbol* m_name = old_method->name(); |
2725 symbolOop m_signature = old_method->signature(); | 2747 Symbol* m_signature = old_method->signature(); |
2726 | 2748 |
2727 // skip the last entry since we just added it | 2749 // skip the last entry since we just added it |
2728 for (int j = _previous_versions->length() - 2; j >= 0; j--) { | 2750 for (int j = _previous_versions->length() - 2; j >= 0; j--) { |
2729 // check the previous versions array for a GC'ed weak refs | 2751 // check the previous versions array for a GC'ed weak refs |
2730 pv_node = _previous_versions->at(j); | 2752 pv_node = _previous_versions->at(j); |