equal
deleted
inserted
replaced
39 #include "memory/metadataFactory.hpp" |
39 #include "memory/metadataFactory.hpp" |
40 #include "memory/metaspaceShared.hpp" |
40 #include "memory/metaspaceShared.hpp" |
41 #include "memory/resourceArea.hpp" |
41 #include "memory/resourceArea.hpp" |
42 #include "memory/universe.hpp" |
42 #include "memory/universe.hpp" |
43 #include "oops/constantPool.hpp" |
43 #include "oops/constantPool.hpp" |
44 #include "oops/fieldStreams.hpp" |
44 #include "oops/fieldStreams.inline.hpp" |
45 #include "oops/klassVtable.hpp" |
45 #include "oops/klassVtable.hpp" |
46 #include "oops/oop.inline.hpp" |
46 #include "oops/oop.inline.hpp" |
47 #include "prims/jvmtiImpl.hpp" |
47 #include "prims/jvmtiImpl.hpp" |
48 #include "prims/jvmtiRedefineClasses.hpp" |
48 #include "prims/jvmtiRedefineClasses.hpp" |
49 #include "prims/jvmtiThreadState.inline.hpp" |
49 #include "prims/jvmtiThreadState.inline.hpp" |
3490 // has already been attached to the_class and old_cp has already |
3490 // has already been attached to the_class and old_cp has already |
3491 // been added as a previous version. The new_cp doesn't have any |
3491 // been added as a previous version. The new_cp doesn't have any |
3492 // cached references to old methods so it doesn't need to be |
3492 // cached references to old methods so it doesn't need to be |
3493 // updated. We can simply start with the previous version(s) in |
3493 // updated. We can simply start with the previous version(s) in |
3494 // that case. |
3494 // that case. |
3495 constantPoolHandle other_cp; |
|
3496 ConstantPoolCache* cp_cache; |
3495 ConstantPoolCache* cp_cache; |
3497 |
3496 |
3498 if (!ik->is_being_redefined()) { |
3497 if (!ik->is_being_redefined()) { |
3499 // this klass' constant pool cache may need adjustment |
3498 // this klass' constant pool cache may need adjustment |
3500 other_cp = constantPoolHandle(ik->constants()); |
3499 ConstantPool* other_cp = ik->constants(); |
3501 cp_cache = other_cp->cache(); |
3500 cp_cache = other_cp->cache(); |
3502 if (cp_cache != NULL) { |
3501 if (cp_cache != NULL) { |
3503 cp_cache->adjust_method_entries(&trace_name_printed); |
3502 cp_cache->adjust_method_entries(&trace_name_printed); |
3504 } |
3503 } |
3505 } |
3504 } |
3514 } |
3513 } |
3515 } |
3514 } |
3516 } |
3515 } |
3517 } |
3516 } |
3518 |
3517 |
3519 void VM_RedefineClasses::update_jmethod_ids() { |
3518 void VM_RedefineClasses::update_jmethod_ids(Thread* thread) { |
3520 for (int j = 0; j < _matching_methods_length; ++j) { |
3519 for (int j = 0; j < _matching_methods_length; ++j) { |
3521 Method* old_method = _matching_old_methods[j]; |
3520 Method* old_method = _matching_old_methods[j]; |
3522 jmethodID jmid = old_method->find_jmethod_id_or_null(); |
3521 jmethodID jmid = old_method->find_jmethod_id_or_null(); |
3523 if (jmid != NULL) { |
3522 if (jmid != NULL) { |
3524 // There is a jmethodID, change it to point to the new method |
3523 // There is a jmethodID, change it to point to the new method |
3525 methodHandle new_method_h(_matching_new_methods[j]); |
3524 methodHandle new_method_h(thread, _matching_new_methods[j]); |
3526 Method::change_method_associated_with_jmethod_id(jmid, new_method_h()); |
3525 Method::change_method_associated_with_jmethod_id(jmid, new_method_h()); |
3527 assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j], |
3526 assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j], |
3528 "should be replaced"); |
3527 "should be replaced"); |
3529 } |
3528 } |
3530 } |
3529 } |
3959 |
3958 |
3960 _old_methods = the_class->methods(); |
3959 _old_methods = the_class->methods(); |
3961 _new_methods = scratch_class->methods(); |
3960 _new_methods = scratch_class->methods(); |
3962 _the_class = the_class; |
3961 _the_class = the_class; |
3963 compute_added_deleted_matching_methods(); |
3962 compute_added_deleted_matching_methods(); |
3964 update_jmethod_ids(); |
3963 update_jmethod_ids(THREAD); |
3965 |
3964 |
3966 _any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods; |
3965 _any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods; |
3967 |
3966 |
3968 // Attach new constant pool to the original klass. The original |
3967 // Attach new constant pool to the original klass. The original |
3969 // klass still refers to the old constant pool (for now). |
3968 // klass still refers to the old constant pool (for now). |