Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 6985:80e866b1d053
Merge
author | coleenp |
---|---|
date | Fri, 16 Nov 2012 09:19:12 -0500 |
parents | 070d523b96a7 |
children | 35431a769282 |
comparison
equal
deleted
inserted
replaced
6974:6b6ddf8c4329 | 6985:80e866b1d053 |
---|---|
220 if (java_lang_Class::is_primitive(klass_mirror)) { | 220 if (java_lang_Class::is_primitive(klass_mirror)) { |
221 return false; | 221 return false; |
222 } | 222 } |
223 Klass* the_class_oop = java_lang_Class::as_Klass(klass_mirror); | 223 Klass* the_class_oop = java_lang_Class::as_Klass(klass_mirror); |
224 // classes for arrays cannot be redefined | 224 // classes for arrays cannot be redefined |
225 if (the_class_oop == NULL || !Klass::cast(the_class_oop)->oop_is_instance()) { | 225 if (the_class_oop == NULL || !the_class_oop->oop_is_instance()) { |
226 return false; | 226 return false; |
227 } | 227 } |
228 return true; | 228 return true; |
229 } | 229 } |
230 | 230 |
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; |