Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 33df1aeaebbf 1d7922586cf6 |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
565 ObjectLocker ol(this_oop, THREAD); | 565 ObjectLocker ol(this_oop, THREAD); |
566 this_oop->set_init_state(state); | 566 this_oop->set_init_state(state); |
567 ol.notify_all(CHECK); | 567 ol.notify_all(CHECK); |
568 } | 568 } |
569 | 569 |
570 // The embedded _implementor field can only record one implementor. | |
571 // When there are more than one implementors, the _implementor field | |
572 // is set to the interface klassOop itself. Following are the possible | |
573 // values for the _implementor field: | |
574 // NULL - no implementor | |
575 // implementor klassOop - one implementor | |
576 // self - more than one implementor | |
577 // | |
578 // The _implementor field only exists for interfaces. | |
570 void instanceKlass::add_implementor(klassOop k) { | 579 void instanceKlass::add_implementor(klassOop k) { |
571 assert(Compile_lock->owned_by_self(), ""); | 580 assert(Compile_lock->owned_by_self(), ""); |
581 assert(is_interface(), "not interface"); | |
572 // Filter out my subinterfaces. | 582 // Filter out my subinterfaces. |
573 // (Note: Interfaces are never on the subklass list.) | 583 // (Note: Interfaces are never on the subklass list.) |
574 if (instanceKlass::cast(k)->is_interface()) return; | 584 if (instanceKlass::cast(k)->is_interface()) return; |
575 | 585 |
576 // Filter out subclasses whose supers already implement me. | 586 // Filter out subclasses whose supers already implement me. |
581 // We only need to check one immediate superclass, since the | 591 // We only need to check one immediate superclass, since the |
582 // implements_interface query looks at transitive_interfaces. | 592 // implements_interface query looks at transitive_interfaces. |
583 // Any supers of the super have the same (or fewer) transitive_interfaces. | 593 // Any supers of the super have the same (or fewer) transitive_interfaces. |
584 return; | 594 return; |
585 | 595 |
586 // Update number of implementors | 596 klassOop ik = implementor(); |
587 int i = _nof_implementors++; | 597 if (ik == NULL) { |
588 | 598 set_implementor(k); |
589 // Record this implementor, if there are not too many already | 599 } else if (ik != this->as_klassOop()) { |
590 if (i < implementors_limit) { | 600 // There is already an implementor. Use itself as an indicator of |
591 assert(_implementors[i] == NULL, "should be exactly one implementor"); | 601 // more than one implementors. |
592 oop_store_without_check((oop*)&_implementors[i], k); | 602 set_implementor(this->as_klassOop()); |
593 } else if (i == implementors_limit) { | |
594 // clear out the list on first overflow | |
595 for (int i2 = 0; i2 < implementors_limit; i2++) | |
596 oop_store_without_check((oop*)&_implementors[i2], NULL); | |
597 } | 603 } |
598 | 604 |
599 // The implementor also implements the transitive_interfaces | 605 // The implementor also implements the transitive_interfaces |
600 for (int index = 0; index < local_interfaces()->length(); index++) { | 606 for (int index = 0; index < local_interfaces()->length(); index++) { |
601 instanceKlass::cast(klassOop(local_interfaces()->obj_at(index)))->add_implementor(k); | 607 instanceKlass::cast(klassOop(local_interfaces()->obj_at(index)))->add_implementor(k); |
602 } | 608 } |
603 } | 609 } |
604 | 610 |
605 void instanceKlass::init_implementor() { | 611 void instanceKlass::init_implementor() { |
606 for (int i = 0; i < implementors_limit; i++) | 612 if (is_interface()) { |
607 oop_store_without_check((oop*)&_implementors[i], NULL); | 613 set_implementor(NULL); |
608 _nof_implementors = 0; | 614 } |
609 } | 615 } |
610 | 616 |
611 | 617 |
612 void instanceKlass::process_interfaces(Thread *thread) { | 618 void instanceKlass::process_interfaces(Thread *thread) { |
613 // link this class into the implementors list of every interface it implements | 619 // link this class into the implementors list of every interface it implements |
667 | 673 |
668 objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) { | 674 objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) { |
669 if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | 675 if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); |
670 if (length > arrayOopDesc::max_array_length(T_OBJECT)) { | 676 if (length > arrayOopDesc::max_array_length(T_OBJECT)) { |
671 report_java_out_of_memory("Requested array size exceeds VM limit"); | 677 report_java_out_of_memory("Requested array size exceeds VM limit"); |
678 JvmtiExport::post_array_size_exhausted(); | |
672 THROW_OOP_0(Universe::out_of_memory_error_array_size()); | 679 THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
673 } | 680 } |
674 int size = objArrayOopDesc::object_size(length); | 681 int size = objArrayOopDesc::object_size(length); |
675 klassOop ak = array_klass(n, CHECK_NULL); | 682 klassOop ak = array_klass(n, CHECK_NULL); |
676 KlassHandle h_ak (THREAD, ak); | 683 KlassHandle h_ak (THREAD, ak); |
838 | 845 |
839 void instanceKlass::shared_symbols_iterate(SymbolClosure* closure) { | 846 void instanceKlass::shared_symbols_iterate(SymbolClosure* closure) { |
840 Klass::shared_symbols_iterate(closure); | 847 Klass::shared_symbols_iterate(closure); |
841 closure->do_symbol(&_generic_signature); | 848 closure->do_symbol(&_generic_signature); |
842 closure->do_symbol(&_source_file_name); | 849 closure->do_symbol(&_source_file_name); |
843 closure->do_symbol(&_source_debug_extension); | |
844 | 850 |
845 for (JavaFieldStream fs(this); !fs.done(); fs.next()) { | 851 for (JavaFieldStream fs(this); !fs.done(); fs.next()) { |
846 int name_index = fs.name_index(); | 852 int name_index = fs.name_index(); |
847 closure->do_symbol(constants()->symbol_at_addr(name_index)); | 853 closure->do_symbol(constants()->symbol_at_addr(name_index)); |
848 int sig_index = fs.signature_index(); | 854 int sig_index = fs.signature_index(); |
980 super->do_nonstatic_fields(cl); | 986 super->do_nonstatic_fields(cl); |
981 } | 987 } |
982 fieldDescriptor fd; | 988 fieldDescriptor fd; |
983 int length = java_fields_count(); | 989 int length = java_fields_count(); |
984 // In DebugInfo nonstatic fields are sorted by offset. | 990 // In DebugInfo nonstatic fields are sorted by offset. |
985 int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1)); | 991 int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1), mtClass); |
986 int j = 0; | 992 int j = 0; |
987 for (int i = 0; i < length; i += 1) { | 993 for (int i = 0; i < length; i += 1) { |
988 fd.initialize(as_klassOop(), i); | 994 fd.initialize(as_klassOop(), i); |
989 if (!fd.is_static()) { | 995 if (!fd.is_static()) { |
990 fields_sorted[j + 0] = fd.offset(); | 996 fields_sorted[j + 0] = fd.offset(); |
1000 fd.initialize(as_klassOop(), fields_sorted[i + 1]); | 1006 fd.initialize(as_klassOop(), fields_sorted[i + 1]); |
1001 assert(!fd.is_static() && fd.offset() == fields_sorted[i], "only nonstatic fields"); | 1007 assert(!fd.is_static() && fd.offset() == fields_sorted[i], "only nonstatic fields"); |
1002 cl->do_field(&fd); | 1008 cl->do_field(&fd); |
1003 } | 1009 } |
1004 } | 1010 } |
1005 FREE_C_HEAP_ARRAY(int, fields_sorted); | 1011 FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass); |
1006 } | 1012 } |
1007 | 1013 |
1008 | 1014 |
1009 void instanceKlass::array_klasses_do(void f(klassOop k)) { | 1015 void instanceKlass::array_klasses_do(void f(klassOop k)) { |
1010 if (array_klasses() != NULL) | 1016 if (array_klasses() != NULL) |
1130 probe = jni_id_for_impl(this->as_klassOop(), offset); | 1136 probe = jni_id_for_impl(this->as_klassOop(), offset); |
1131 } | 1137 } |
1132 return probe; | 1138 return probe; |
1133 } | 1139 } |
1134 | 1140 |
1141 u2 instanceKlass::enclosing_method_data(int offset) { | |
1142 typeArrayOop inner_class_list = inner_classes(); | |
1143 if (inner_class_list == NULL) { | |
1144 return 0; | |
1145 } | |
1146 int length = inner_class_list->length(); | |
1147 if (length % inner_class_next_offset == 0) { | |
1148 return 0; | |
1149 } else { | |
1150 int index = length - enclosing_method_attribute_size; | |
1151 typeArrayHandle inner_class_list_h(inner_class_list); | |
1152 assert(offset < enclosing_method_attribute_size, "invalid offset"); | |
1153 return inner_class_list_h->ushort_at(index + offset); | |
1154 } | |
1155 } | |
1156 | |
1157 void instanceKlass::set_enclosing_method_indices(u2 class_index, | |
1158 u2 method_index) { | |
1159 typeArrayOop inner_class_list = inner_classes(); | |
1160 assert (inner_class_list != NULL, "_inner_classes list is not set up"); | |
1161 int length = inner_class_list->length(); | |
1162 if (length % inner_class_next_offset == enclosing_method_attribute_size) { | |
1163 int index = length - enclosing_method_attribute_size; | |
1164 typeArrayHandle inner_class_list_h(inner_class_list); | |
1165 inner_class_list_h->ushort_at_put( | |
1166 index + enclosing_method_class_index_offset, class_index); | |
1167 inner_class_list_h->ushort_at_put( | |
1168 index + enclosing_method_method_index_offset, method_index); | |
1169 } | |
1170 } | |
1135 | 1171 |
1136 // Lookup or create a jmethodID. | 1172 // Lookup or create a jmethodID. |
1137 // This code is called by the VMThread and JavaThreads so the | 1173 // This code is called by the VMThread and JavaThreads so the |
1138 // locking has to be done very carefully to avoid deadlocks | 1174 // locking has to be done very carefully to avoid deadlocks |
1139 // and/or other cache consistency problems. | 1175 // and/or other cache consistency problems. |
1197 // may not allocate new_jmeths or use it if we allocate it | 1233 // may not allocate new_jmeths or use it if we allocate it |
1198 jmethodID* new_jmeths = NULL; | 1234 jmethodID* new_jmeths = NULL; |
1199 if (length <= idnum) { | 1235 if (length <= idnum) { |
1200 // allocate a new cache that might be used | 1236 // allocate a new cache that might be used |
1201 size_t size = MAX2(idnum+1, (size_t)ik_h->idnum_allocated_count()); | 1237 size_t size = MAX2(idnum+1, (size_t)ik_h->idnum_allocated_count()); |
1202 new_jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1); | 1238 new_jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1, mtClass); |
1203 memset(new_jmeths, 0, (size+1)*sizeof(jmethodID)); | 1239 memset(new_jmeths, 0, (size+1)*sizeof(jmethodID)); |
1204 // cache size is stored in element[0], other elements offset by one | 1240 // cache size is stored in element[0], other elements offset by one |
1205 new_jmeths[0] = (jmethodID)size; | 1241 new_jmeths[0] = (jmethodID)size; |
1206 } | 1242 } |
1207 | 1243 |
1358 indices = methods_cached_itable_indices_acquire(); | 1394 indices = methods_cached_itable_indices_acquire(); |
1359 size_t length = 0; | 1395 size_t length = 0; |
1360 // cache size is stored in element[0], other elements offset by one | 1396 // cache size is stored in element[0], other elements offset by one |
1361 if (indices == NULL || (length = (size_t)indices[0]) <= idnum) { | 1397 if (indices == NULL || (length = (size_t)indices[0]) <= idnum) { |
1362 size_t size = MAX2(idnum+1, (size_t)idnum_allocated_count()); | 1398 size_t size = MAX2(idnum+1, (size_t)idnum_allocated_count()); |
1363 int* new_indices = NEW_C_HEAP_ARRAY(int, size+1); | 1399 int* new_indices = NEW_C_HEAP_ARRAY(int, size+1, mtClass); |
1364 new_indices[0] = (int)size; | 1400 new_indices[0] = (int)size; |
1365 // copy any existing entries | 1401 // copy any existing entries |
1366 size_t i; | 1402 size_t i; |
1367 for (i = 0; i < length; i++) { | 1403 for (i = 0; i < length; i++) { |
1368 new_indices[i+1] = indices[i+1]; | 1404 new_indices[i+1] = indices[i+1]; |
1816 // Subklass and sibling links are handled by Klass::follow_weak_klass_links | 1852 // Subklass and sibling links are handled by Klass::follow_weak_klass_links |
1817 | 1853 |
1818 void instanceKlass::follow_weak_klass_links( | 1854 void instanceKlass::follow_weak_klass_links( |
1819 BoolObjectClosure* is_alive, OopClosure* keep_alive) { | 1855 BoolObjectClosure* is_alive, OopClosure* keep_alive) { |
1820 assert(is_alive->do_object_b(as_klassOop()), "this oop should be live"); | 1856 assert(is_alive->do_object_b(as_klassOop()), "this oop should be live"); |
1821 if (ClassUnloading) { | 1857 |
1822 for (int i = 0; i < implementors_limit; i++) { | 1858 if (is_interface()) { |
1823 klassOop impl = _implementors[i]; | 1859 if (ClassUnloading) { |
1824 if (impl == NULL) break; // no more in the list | 1860 klassOop impl = implementor(); |
1825 if (!is_alive->do_object_b(impl)) { | 1861 if (impl != NULL) { |
1826 // remove this guy from the list by overwriting him with the tail | 1862 if (!is_alive->do_object_b(impl)) { |
1827 int lasti = --_nof_implementors; | 1863 // remove this guy |
1828 assert(lasti >= i && lasti < implementors_limit, "just checking"); | 1864 *adr_implementor() = NULL; |
1829 _implementors[i] = _implementors[lasti]; | 1865 } |
1830 _implementors[lasti] = NULL; | |
1831 --i; // rerun the loop at this index | |
1832 } | 1866 } |
1833 } | 1867 } else { |
1834 } else { | 1868 assert(adr_implementor() != NULL, "just checking"); |
1835 for (int i = 0; i < implementors_limit; i++) { | 1869 keep_alive->do_oop(adr_implementor()); |
1836 keep_alive->do_oop(&adr_implementors()[i]); | 1870 } |
1837 } | 1871 } |
1838 } | 1872 |
1839 Klass::follow_weak_klass_links(is_alive, keep_alive); | 1873 Klass::follow_weak_klass_links(is_alive, keep_alive); |
1840 } | 1874 } |
1841 | 1875 |
1842 void instanceKlass::remove_unshareable_info() { | 1876 void instanceKlass::remove_unshareable_info() { |
1843 Klass::remove_unshareable_info(); | 1877 Klass::remove_unshareable_info(); |
1896 _previous_versions = NULL; | 1930 _previous_versions = NULL; |
1897 } | 1931 } |
1898 | 1932 |
1899 // deallocate the cached class file | 1933 // deallocate the cached class file |
1900 if (_cached_class_file_bytes != NULL) { | 1934 if (_cached_class_file_bytes != NULL) { |
1901 os::free(_cached_class_file_bytes); | 1935 os::free(_cached_class_file_bytes, mtClass); |
1902 _cached_class_file_bytes = NULL; | 1936 _cached_class_file_bytes = NULL; |
1903 _cached_class_file_len = 0; | 1937 _cached_class_file_len = 0; |
1904 } | 1938 } |
1905 | 1939 |
1906 // Decrement symbol reference counts associated with the unloaded class. | 1940 // Decrement symbol reference counts associated with the unloaded class. |
1907 if (_name != NULL) _name->decrement_refcount(); | 1941 if (_name != NULL) _name->decrement_refcount(); |
1908 // unreference array name derived from this class name (arrays of an unloaded | 1942 // unreference array name derived from this class name (arrays of an unloaded |
1909 // class can't be referenced anymore). | 1943 // class can't be referenced anymore). |
1910 if (_array_name != NULL) _array_name->decrement_refcount(); | 1944 if (_array_name != NULL) _array_name->decrement_refcount(); |
1911 if (_source_file_name != NULL) _source_file_name->decrement_refcount(); | 1945 if (_source_file_name != NULL) _source_file_name->decrement_refcount(); |
1912 if (_source_debug_extension != NULL) _source_debug_extension->decrement_refcount(); | |
1913 // walk constant pool and decrement symbol reference counts | 1946 // walk constant pool and decrement symbol reference counts |
1914 _constants->unreference_symbols(); | 1947 _constants->unreference_symbols(); |
1948 | |
1949 if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass); | |
1915 } | 1950 } |
1916 | 1951 |
1917 void instanceKlass::set_source_file_name(Symbol* n) { | 1952 void instanceKlass::set_source_file_name(Symbol* n) { |
1918 _source_file_name = n; | 1953 _source_file_name = n; |
1919 if (_source_file_name != NULL) _source_file_name->increment_refcount(); | 1954 if (_source_file_name != NULL) _source_file_name->increment_refcount(); |
1920 } | 1955 } |
1921 | 1956 |
1922 void instanceKlass::set_source_debug_extension(Symbol* n) { | 1957 void instanceKlass::set_source_debug_extension(char* array, int length) { |
1923 _source_debug_extension = n; | 1958 if (array == NULL) { |
1924 if (_source_debug_extension != NULL) _source_debug_extension->increment_refcount(); | 1959 _source_debug_extension = NULL; |
1960 } else { | |
1961 // Adding one to the attribute length in order to store a null terminator | |
1962 // character could cause an overflow because the attribute length is | |
1963 // already coded with an u4 in the classfile, but in practice, it's | |
1964 // unlikely to happen. | |
1965 assert((length+1) > length, "Overflow checking"); | |
1966 char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass); | |
1967 for (int i = 0; i < length; i++) { | |
1968 sde[i] = array[i]; | |
1969 } | |
1970 sde[length] = '\0'; | |
1971 _source_debug_extension = sde; | |
1972 } | |
1925 } | 1973 } |
1926 | 1974 |
1927 address instanceKlass::static_field_addr(int offset) { | 1975 address instanceKlass::static_field_addr(int offset) { |
1928 return (address)(offset + instanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror()); | 1976 return (address)(offset + instanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror()); |
1929 } | 1977 } |
2104 jint instanceKlass::compute_modifier_flags(TRAPS) const { | 2152 jint instanceKlass::compute_modifier_flags(TRAPS) const { |
2105 klassOop k = as_klassOop(); | 2153 klassOop k = as_klassOop(); |
2106 jint access = access_flags().as_int(); | 2154 jint access = access_flags().as_int(); |
2107 | 2155 |
2108 // But check if it happens to be member class. | 2156 // But check if it happens to be member class. |
2109 typeArrayOop inner_class_list = inner_classes(); | 2157 instanceKlassHandle ik(THREAD, k); |
2110 int length = (inner_class_list == NULL) ? 0 : inner_class_list->length(); | 2158 InnerClassesIterator iter(ik); |
2111 assert (length % instanceKlass::inner_class_next_offset == 0, "just checking"); | 2159 for (; !iter.done(); iter.next()) { |
2112 if (length > 0) { | 2160 int ioff = iter.inner_class_info_index(); |
2113 typeArrayHandle inner_class_list_h(THREAD, inner_class_list); | 2161 // Inner class attribute can be zero, skip it. |
2114 instanceKlassHandle ik(THREAD, k); | 2162 // Strange but true: JVM spec. allows null inner class refs. |
2115 for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { | 2163 if (ioff == 0) continue; |
2116 int ioff = inner_class_list_h->ushort_at( | 2164 |
2117 i + instanceKlass::inner_class_inner_class_info_offset); | 2165 // only look at classes that are already loaded |
2118 | 2166 // since we are looking for the flags for our self. |
2119 // Inner class attribute can be zero, skip it. | 2167 Symbol* inner_name = ik->constants()->klass_name_at(ioff); |
2120 // Strange but true: JVM spec. allows null inner class refs. | 2168 if ((ik->name() == inner_name)) { |
2121 if (ioff == 0) continue; | 2169 // This is really a member class. |
2122 | 2170 access = iter.inner_access_flags(); |
2123 // only look at classes that are already loaded | 2171 break; |
2124 // since we are looking for the flags for our self. | |
2125 Symbol* inner_name = ik->constants()->klass_name_at(ioff); | |
2126 if ((ik->name() == inner_name)) { | |
2127 // This is really a member class. | |
2128 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); | |
2129 break; | |
2130 } | |
2131 } | 2172 } |
2132 } | 2173 } |
2133 // Remember to strip ACC_SUPER bit | 2174 // Remember to strip ACC_SUPER bit |
2134 return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; | 2175 return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; |
2135 } | 2176 } |
2386 st->print(" = "); | 2427 st->print(" = "); |
2387 java_lang_invoke_MethodType::print_signature(obj, st); | 2428 java_lang_invoke_MethodType::print_signature(obj, st); |
2388 } else if (java_lang_boxing_object::is_instance(obj)) { | 2429 } else if (java_lang_boxing_object::is_instance(obj)) { |
2389 st->print(" = "); | 2430 st->print(" = "); |
2390 java_lang_boxing_object::print(obj, st); | 2431 java_lang_boxing_object::print(obj, st); |
2432 } else if (as_klassOop() == SystemDictionary::LambdaForm_klass()) { | |
2433 oop vmentry = java_lang_invoke_LambdaForm::vmentry(obj); | |
2434 if (vmentry != NULL) { | |
2435 st->print(" => "); | |
2436 vmentry->print_value_on(st); | |
2437 } | |
2438 } else if (as_klassOop() == SystemDictionary::MemberName_klass()) { | |
2439 oop vmtarget = java_lang_invoke_MemberName::vmtarget(obj); | |
2440 if (vmtarget != NULL) { | |
2441 st->print(" = "); | |
2442 vmtarget->print_value_on(st); | |
2443 } else { | |
2444 java_lang_invoke_MemberName::clazz(obj)->print_value_on(st); | |
2445 st->print("."); | |
2446 java_lang_invoke_MemberName::name(obj)->print_value_on(st); | |
2447 } | |
2391 } | 2448 } |
2392 } | 2449 } |
2393 | 2450 |
2394 const char* instanceKlass::internal_name() const { | 2451 const char* instanceKlass::internal_name() const { |
2395 return external_name(); | 2452 return external_name(); |
2500 | 2557 |
2501 if (_previous_versions == NULL) { | 2558 if (_previous_versions == NULL) { |
2502 // This is the first previous version so make some space. | 2559 // This is the first previous version so make some space. |
2503 // Start with 2 elements under the assumption that the class | 2560 // Start with 2 elements under the assumption that the class |
2504 // won't be redefined much. | 2561 // won't be redefined much. |
2505 _previous_versions = new (ResourceObj::C_HEAP) | 2562 _previous_versions = new (ResourceObj::C_HEAP, mtClass) |
2506 GrowableArray<PreviousVersionNode *>(2, true); | 2563 GrowableArray<PreviousVersionNode *>(2, true); |
2507 } | 2564 } |
2508 | 2565 |
2509 // RC_TRACE macro has an embedded ResourceMark | 2566 // RC_TRACE macro has an embedded ResourceMark |
2510 RC_TRACE(0x00000100, ("adding previous version ref for %s @%d, EMCP_cnt=%d", | 2567 RC_TRACE(0x00000100, ("adding previous version ref for %s @%d, EMCP_cnt=%d", |
2526 pv_node = new PreviousVersionNode(cp_ref, !cp_h->is_shared(), NULL); | 2583 pv_node = new PreviousVersionNode(cp_ref, !cp_h->is_shared(), NULL); |
2527 RC_TRACE(0x00000400, | 2584 RC_TRACE(0x00000400, |
2528 ("add: all methods are obsolete; flushing any EMCP weak refs")); | 2585 ("add: all methods are obsolete; flushing any EMCP weak refs")); |
2529 } else { | 2586 } else { |
2530 int local_count = 0; | 2587 int local_count = 0; |
2531 GrowableArray<jweak>* method_refs = new (ResourceObj::C_HEAP) | 2588 GrowableArray<jweak>* method_refs = new (ResourceObj::C_HEAP, mtClass) |
2532 GrowableArray<jweak>(emcp_method_count, true); | 2589 GrowableArray<jweak>(emcp_method_count, true); |
2533 for (int i = 0; i < old_methods->length(); i++) { | 2590 for (int i = 0; i < old_methods->length(); i++) { |
2534 if (emcp_methods->at(i)) { | 2591 if (emcp_methods->at(i)) { |
2535 // this old method is EMCP so save a weak ref | 2592 // this old method is EMCP so save a weak ref |
2536 methodOop old_method = (methodOop) old_methods->obj_at(i); | 2593 methodOop old_method = (methodOop) old_methods->obj_at(i); |
2918 | 2975 |
2919 int length = _previous_versions->length(); | 2976 int length = _previous_versions->length(); |
2920 | 2977 |
2921 while (_current_index < length) { | 2978 while (_current_index < length) { |
2922 PreviousVersionNode * pv_node = _previous_versions->at(_current_index++); | 2979 PreviousVersionNode * pv_node = _previous_versions->at(_current_index++); |
2923 PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP) | 2980 PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP, mtClass) |
2924 PreviousVersionInfo(pv_node); | 2981 PreviousVersionInfo(pv_node); |
2925 | 2982 |
2926 constantPoolHandle cp_h = pv_info->prev_constant_pool_handle(); | 2983 constantPoolHandle cp_h = pv_info->prev_constant_pool_handle(); |
2927 if (cp_h.is_null()) { | 2984 if (cp_h.is_null()) { |
2928 delete pv_info; | 2985 delete pv_info; |