1074
1075 if (orig_method != NULL &&
1076 (new_method == NULL || orig_method->name() < new_method->name())) {
1077 merged_methods->at_put(i, orig_method);
1078 original_methods->at_put(orig_idx, NULL);
1079 if (merged_ordering->length() > 0) {
1080 assert(original_ordering != NULL && original_ordering->length() > 0,
1081 "should have original order information for this method");
1082 merged_ordering->at_put(i, original_ordering->at(orig_idx));
1083 }
1084 ++orig_idx;
1085 } else {
1086 merged_methods->at_put(i, new_method);
1087 if (merged_ordering->length() > 0) {
1088 merged_ordering->at_put(i, method_order_index++);
1089 }
1090 ++new_idx;
1091 }
1092 // update idnum for new location
1093 merged_methods->at(i)->set_method_idnum(i);
1094 }
1095
1096 // Verify correct order
1097 #ifdef ASSERT
1098 uintptr_t prev = 0;
1099 for (int i = 0; i < merged_methods->length(); ++i) {
1100 Method* mo = merged_methods->at(i);
1101 uintptr_t nv = (uintptr_t)mo->name();
1102 assert(nv >= prev, "Incorrect method ordering");
1103 prev = nv;
1104 }
1105 #endif
1106
1107 // Replace klass methods with new merged lists
1108 klass->set_methods(merged_methods);
1109 klass->set_initial_method_idnum(new_size);
1110 klass->set_method_ordering(merged_ordering);
1111
1112 // Free metadata
1113 ClassLoaderData* cld = klass->class_loader_data();
|
1074
1075 if (orig_method != NULL &&
1076 (new_method == NULL || orig_method->name() < new_method->name())) {
1077 merged_methods->at_put(i, orig_method);
1078 original_methods->at_put(orig_idx, NULL);
1079 if (merged_ordering->length() > 0) {
1080 assert(original_ordering != NULL && original_ordering->length() > 0,
1081 "should have original order information for this method");
1082 merged_ordering->at_put(i, original_ordering->at(orig_idx));
1083 }
1084 ++orig_idx;
1085 } else {
1086 merged_methods->at_put(i, new_method);
1087 if (merged_ordering->length() > 0) {
1088 merged_ordering->at_put(i, method_order_index++);
1089 }
1090 ++new_idx;
1091 }
1092 // update idnum for new location
1093 merged_methods->at(i)->set_method_idnum(i);
1094 merged_methods->at(i)->set_orig_method_idnum(i);
1095 }
1096
1097 // Verify correct order
1098 #ifdef ASSERT
1099 uintptr_t prev = 0;
1100 for (int i = 0; i < merged_methods->length(); ++i) {
1101 Method* mo = merged_methods->at(i);
1102 uintptr_t nv = (uintptr_t)mo->name();
1103 assert(nv >= prev, "Incorrect method ordering");
1104 prev = nv;
1105 }
1106 #endif
1107
1108 // Replace klass methods with new merged lists
1109 klass->set_methods(merged_methods);
1110 klass->set_initial_method_idnum(new_size);
1111 klass->set_method_ordering(merged_ordering);
1112
1113 // Free metadata
1114 ClassLoaderData* cld = klass->class_loader_data();
|