Mercurial > hg > truffle
comparison src/share/vm/classfile/classFileParser.cpp @ 3245:8ce625481709
7032407: Crash in LinkResolver::runtime_resolve_virtual_method()
Summary: Make CDS reorder vtables so that dump time vtables match run time order, so when redefine classes reinitializes them, they aren't in the wrong order.
Reviewed-by: dcubed, acorn
author | coleenp |
---|---|
date | Fri, 15 Apr 2011 09:36:28 -0400 |
parents | 758ba0bf7bcc |
children | 498c6cf70f7e |
comparison
equal
deleted
inserted
replaced
3244:a534c140904e | 3245:8ce625481709 |
---|---|
2194 objArrayHandle methods_parameter_annotations, | 2194 objArrayHandle methods_parameter_annotations, |
2195 objArrayHandle methods_default_annotations, | 2195 objArrayHandle methods_default_annotations, |
2196 TRAPS) { | 2196 TRAPS) { |
2197 typeArrayHandle nullHandle; | 2197 typeArrayHandle nullHandle; |
2198 int length = methods()->length(); | 2198 int length = methods()->length(); |
2199 // If JVMTI original method ordering is enabled we have to | 2199 // If JVMTI original method ordering or sharing is enabled we have to |
2200 // remember the original class file ordering. | 2200 // remember the original class file ordering. |
2201 // We temporarily use the vtable_index field in the methodOop to store the | 2201 // We temporarily use the vtable_index field in the methodOop to store the |
2202 // class file index, so we can read in after calling qsort. | 2202 // class file index, so we can read in after calling qsort. |
2203 if (JvmtiExport::can_maintain_original_method_order()) { | 2203 // Put the method ordering in the shared archive. |
2204 if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { | |
2204 for (int index = 0; index < length; index++) { | 2205 for (int index = 0; index < length; index++) { |
2205 methodOop m = methodOop(methods->obj_at(index)); | 2206 methodOop m = methodOop(methods->obj_at(index)); |
2206 assert(!m->valid_vtable_index(), "vtable index should not be set"); | 2207 assert(!m->valid_vtable_index(), "vtable index should not be set"); |
2207 m->set_vtable_index(index); | 2208 m->set_vtable_index(index); |
2208 } | 2209 } |
2212 methodOopDesc::sort_methods(methods(), | 2213 methodOopDesc::sort_methods(methods(), |
2213 methods_annotations(), | 2214 methods_annotations(), |
2214 methods_parameter_annotations(), | 2215 methods_parameter_annotations(), |
2215 methods_default_annotations()); | 2216 methods_default_annotations()); |
2216 | 2217 |
2217 // If JVMTI original method ordering is enabled construct int array remembering the original ordering | 2218 // If JVMTI original method ordering or sharing is enabled construct int |
2218 if (JvmtiExport::can_maintain_original_method_order()) { | 2219 // array remembering the original ordering |
2220 if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { | |
2219 typeArrayOop new_ordering = oopFactory::new_permanent_intArray(length, CHECK_(nullHandle)); | 2221 typeArrayOop new_ordering = oopFactory::new_permanent_intArray(length, CHECK_(nullHandle)); |
2220 typeArrayHandle method_ordering(THREAD, new_ordering); | 2222 typeArrayHandle method_ordering(THREAD, new_ordering); |
2221 for (int index = 0; index < length; index++) { | 2223 for (int index = 0; index < length; index++) { |
2222 methodOop m = methodOop(methods->obj_at(index)); | 2224 methodOop m = methodOop(methods->obj_at(index)); |
2223 int old_index = m->vtable_index(); | 2225 int old_index = m->vtable_index(); |