571 // Check superclasses, or rather their names, since superclasses themselves can be |
571 // Check superclasses, or rather their names, since superclasses themselves can be |
572 // requested to replace. |
572 // requested to replace. |
573 // Check for NULL superclass first since this might be java.lang.Object |
573 // Check for NULL superclass first since this might be java.lang.Object |
574 if (the_class->super() != scratch_class->super() && |
574 if (the_class->super() != scratch_class->super() && |
575 (the_class->super() == NULL || scratch_class->super() == NULL || |
575 (the_class->super() == NULL || scratch_class->super() == NULL || |
576 Klass::cast(the_class->super())->name() != |
576 the_class->super()->name() != |
577 Klass::cast(scratch_class->super())->name())) { |
577 scratch_class->super()->name())) { |
578 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
578 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
579 } |
579 } |
580 |
580 |
581 // Check if the number, names and order of directly implemented interfaces are the same. |
581 // Check if the number, names and order of directly implemented interfaces are the same. |
582 // I think in principle we should just check if the sets of names of directly implemented |
582 // I think in principle we should just check if the sets of names of directly implemented |
590 int n_intfs = k_interfaces->length(); |
590 int n_intfs = k_interfaces->length(); |
591 if (n_intfs != k_new_interfaces->length()) { |
591 if (n_intfs != k_new_interfaces->length()) { |
592 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
592 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
593 } |
593 } |
594 for (i = 0; i < n_intfs; i++) { |
594 for (i = 0; i < n_intfs; i++) { |
595 if (Klass::cast(k_interfaces->at(i))->name() != |
595 if (k_interfaces->at(i)->name() != |
596 Klass::cast(k_new_interfaces->at(i))->name()) { |
596 k_new_interfaces->at(i)->name()) { |
597 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
597 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; |
598 } |
598 } |
599 } |
599 } |
600 |
600 |
601 // Check whether class is in the error init state. |
601 // Check whether class is in the error init state. |
2682 // interface or if the current class is a subclass of the_class, then |
2682 // interface or if the current class is a subclass of the_class, then |
2683 // we potentially have to fix the itable. If we are redefining an |
2683 // we potentially have to fix the itable. If we are redefining an |
2684 // interface, then we have to call adjust_method_entries() for |
2684 // interface, then we have to call adjust_method_entries() for |
2685 // every InstanceKlass that has an itable since there isn't a |
2685 // every InstanceKlass that has an itable since there isn't a |
2686 // subclass relationship between an interface and an InstanceKlass. |
2686 // subclass relationship between an interface and an InstanceKlass. |
2687 if (ik->itable_length() > 0 && (Klass::cast(_the_class_oop)->is_interface() |
2687 if (ik->itable_length() > 0 && (_the_class_oop->is_interface() |
2688 || ik->is_subclass_of(_the_class_oop))) { |
2688 || ik->is_subclass_of(_the_class_oop))) { |
2689 // ik->itable() creates a wrapper object; rm cleans it up |
2689 // ik->itable() creates a wrapper object; rm cleans it up |
2690 ResourceMark rm(THREAD); |
2690 ResourceMark rm(THREAD); |
2691 ik->itable()->adjust_method_entries(_matching_old_methods, |
2691 ik->itable()->adjust_method_entries(_matching_old_methods, |
2692 _matching_new_methods, |
2692 _matching_new_methods, |
2927 // where 'prefix' is the prefix at that 'depth' (first prefix, second prefix,...) |
2927 // where 'prefix' is the prefix at that 'depth' (first prefix, second prefix,...) |
2928 Method* search_prefix_name_space(int depth, char* name_str, size_t name_len, |
2928 Method* search_prefix_name_space(int depth, char* name_str, size_t name_len, |
2929 Symbol* signature) { |
2929 Symbol* signature) { |
2930 TempNewSymbol name_symbol = SymbolTable::probe(name_str, (int)name_len); |
2930 TempNewSymbol name_symbol = SymbolTable::probe(name_str, (int)name_len); |
2931 if (name_symbol != NULL) { |
2931 if (name_symbol != NULL) { |
2932 Method* method = Klass::cast(the_class())->lookup_method(name_symbol, signature); |
2932 Method* method = the_class()->lookup_method(name_symbol, signature); |
2933 if (method != NULL) { |
2933 if (method != NULL) { |
2934 // Even if prefixed, intermediate methods must exist. |
2934 // Even if prefixed, intermediate methods must exist. |
2935 if (method->is_native()) { |
2935 if (method->is_native()) { |
2936 // Wahoo, we found a (possibly prefixed) version of the method, return it. |
2936 // Wahoo, we found a (possibly prefixed) version of the method, return it. |
2937 return method; |
2937 return method; |