< prev index next >

src/hotspot/share/prims/jvmtiRedefineClasses.cpp

Print this page




3529     for (int index = 0; index < num_methods; ++index) {
3530       if (methods->at(index)->method_data() != NULL) {
3531         methods->at(index)->method_data()->clean_weak_method_links();
3532       }
3533     }
3534   }
3535 }
3536 
3537 void VM_RedefineClasses::update_jmethod_ids() {
3538   for (int j = 0; j < _matching_methods_length; ++j) {
3539     Method* old_method = _matching_old_methods[j];
3540     jmethodID jmid = old_method->find_jmethod_id_or_null();
3541     if (jmid != NULL) {
3542       // There is a jmethodID, change it to point to the new method
3543       methodHandle new_method_h(_matching_new_methods[j]);
3544       Method::change_method_associated_with_jmethod_id(jmid, new_method_h());
3545       assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j],
3546              "should be replaced");
3547     }
3548   }









3549 }
3550 
3551 int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
3552   int emcp_method_count = 0;
3553   int obsolete_count = 0;
3554   int old_index = 0;
3555   for (int j = 0; j < _matching_methods_length; ++j, ++old_index) {
3556     Method* old_method = _matching_old_methods[j];
3557     Method* new_method = _matching_new_methods[j];
3558     Method* old_array_method;
3559 
3560     // Maintain an old_index into the _old_methods array by skipping
3561     // deleted methods
3562     while ((old_array_method = _old_methods->at(old_index)) != old_method) {
3563       ++old_index;
3564     }
3565 
3566     if (MethodComparator::methods_EMCP(old_method, new_method)) {
3567       // The EMCP definition from JSR-163 requires the bytecodes to be
3568       // the same with the exception of constant pool indices which may




3529     for (int index = 0; index < num_methods; ++index) {
3530       if (methods->at(index)->method_data() != NULL) {
3531         methods->at(index)->method_data()->clean_weak_method_links();
3532       }
3533     }
3534   }
3535 }
3536 
3537 void VM_RedefineClasses::update_jmethod_ids() {
3538   for (int j = 0; j < _matching_methods_length; ++j) {
3539     Method* old_method = _matching_old_methods[j];
3540     jmethodID jmid = old_method->find_jmethod_id_or_null();
3541     if (jmid != NULL) {
3542       // There is a jmethodID, change it to point to the new method
3543       methodHandle new_method_h(_matching_new_methods[j]);
3544       Method::change_method_associated_with_jmethod_id(jmid, new_method_h());
3545       assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j],
3546              "should be replaced");
3547     }
3548   }
3549   // Update deleted jmethodID
3550   for (int j = 0; j < _deleted_methods_length; ++j) {
3551     Method* old_method = _deleted_methods[j];
3552     jmethodID jmid = old_method->find_jmethod_id_or_null();
3553     if (jmid != NULL) {
3554       // Change the jmethodID to point to NSME.
3555       Method::change_method_associated_with_jmethod_id(jmid, Universe::throw_no_such_method_error());
3556     }
3557   }
3558 }
3559 
3560 int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
3561   int emcp_method_count = 0;
3562   int obsolete_count = 0;
3563   int old_index = 0;
3564   for (int j = 0; j < _matching_methods_length; ++j, ++old_index) {
3565     Method* old_method = _matching_old_methods[j];
3566     Method* new_method = _matching_new_methods[j];
3567     Method* old_array_method;
3568 
3569     // Maintain an old_index into the _old_methods array by skipping
3570     // deleted methods
3571     while ((old_array_method = _old_methods->at(old_index)) != old_method) {
3572       ++old_index;
3573     }
3574 
3575     if (MethodComparator::methods_EMCP(old_method, new_method)) {
3576       // The EMCP definition from JSR-163 requires the bytecodes to be
3577       // the same with the exception of constant pool indices which may


< prev index next >