mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
7032407: Crash in LinkResolver::runtime_resolve_virtual_method()
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
This commit is contained in:
parent
2a5436b3d3
commit
8acea1848a
7 changed files with 75 additions and 13 deletions
|
@ -2196,11 +2196,12 @@ typeArrayHandle ClassFileParser::sort_methods(objArrayHandle methods,
|
|||
TRAPS) {
|
||||
typeArrayHandle nullHandle;
|
||||
int length = methods()->length();
|
||||
// If JVMTI original method ordering is enabled we have to
|
||||
// If JVMTI original method ordering or sharing is enabled we have to
|
||||
// remember the original class file ordering.
|
||||
// We temporarily use the vtable_index field in the methodOop to store the
|
||||
// class file index, so we can read in after calling qsort.
|
||||
if (JvmtiExport::can_maintain_original_method_order()) {
|
||||
// Put the method ordering in the shared archive.
|
||||
if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
|
||||
for (int index = 0; index < length; index++) {
|
||||
methodOop m = methodOop(methods->obj_at(index));
|
||||
assert(!m->valid_vtable_index(), "vtable index should not be set");
|
||||
|
@ -2214,8 +2215,9 @@ typeArrayHandle ClassFileParser::sort_methods(objArrayHandle methods,
|
|||
methods_parameter_annotations(),
|
||||
methods_default_annotations());
|
||||
|
||||
// If JVMTI original method ordering is enabled construct int array remembering the original ordering
|
||||
if (JvmtiExport::can_maintain_original_method_order()) {
|
||||
// If JVMTI original method ordering or sharing is enabled construct int
|
||||
// array remembering the original ordering
|
||||
if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
|
||||
typeArrayOop new_ordering = oopFactory::new_permanent_intArray(length, CHECK_(nullHandle));
|
||||
typeArrayHandle method_ordering(THREAD, new_ordering);
|
||||
for (int index = 0; index < length; index++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue