1.1 --- a/src/share/vm/oops/instanceKlass.cpp Wed Mar 18 18:13:49 2015 -0700 1.2 +++ b/src/share/vm/oops/instanceKlass.cpp Wed Mar 25 11:31:54 2015 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -2798,30 +2798,33 @@ 1.11 // not yet in the vtable due to concurrent subclass define and superinterface 1.12 // redefinition 1.13 // Note: those in the vtable, should have been updated via adjust_method_entries 1.14 -void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods, 1.15 - int methods_length, bool* trace_name_printed) { 1.16 +void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) { 1.17 // search the default_methods for uses of either obsolete or EMCP methods 1.18 if (default_methods() != NULL) { 1.19 - for (int j = 0; j < methods_length; j++) { 1.20 - Method* old_method = old_methods[j]; 1.21 - Method* new_method = new_methods[j]; 1.22 - 1.23 - for (int index = 0; index < default_methods()->length(); index ++) { 1.24 - if (default_methods()->at(index) == old_method) { 1.25 - default_methods()->at_put(index, new_method); 1.26 - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { 1.27 - if (!(*trace_name_printed)) { 1.28 - // RC_TRACE_MESG macro has an embedded ResourceMark 1.29 - RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s", 1.30 - external_name(), 1.31 - old_method->method_holder()->external_name())); 1.32 - *trace_name_printed = true; 1.33 - } 1.34 - RC_TRACE(0x00100000, ("default method update: %s(%s) ", 1.35 - new_method->name()->as_C_string(), 1.36 - new_method->signature()->as_C_string())); 1.37 - } 1.38 + for (int index = 0; index < default_methods()->length(); index ++) { 1.39 + Method* old_method = default_methods()->at(index); 1.40 + if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) { 1.41 + continue; // skip uninteresting entries 1.42 + } 1.43 + assert(!old_method->is_deleted(), "default methods may not be deleted"); 1.44 + 1.45 + Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); 1.46 + 1.47 + assert(new_method != NULL, "method_with_idnum() should not be NULL"); 1.48 + assert(old_method != new_method, "sanity check"); 1.49 + 1.50 + default_methods()->at_put(index, new_method); 1.51 + if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { 1.52 + if (!(*trace_name_printed)) { 1.53 + // RC_TRACE_MESG macro has an embedded ResourceMark 1.54 + RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s", 1.55 + external_name(), 1.56 + old_method->method_holder()->external_name())); 1.57 + *trace_name_printed = true; 1.58 } 1.59 + RC_TRACE(0x00100000, ("default method update: %s(%s) ", 1.60 + new_method->name()->as_C_string(), 1.61 + new_method->signature()->as_C_string())); 1.62 } 1.63 } 1.64 }