src/hotspot/share/prims/jvmtiRedefineClasses.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54786 ebf733a324d4
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
   230   if (_any_class_has_resolved_methods) {
   230   if (_any_class_has_resolved_methods) {
   231     bool trace_name_printed = false;
   231     bool trace_name_printed = false;
   232     ResolvedMethodTable::adjust_method_entries(&trace_name_printed);
   232     ResolvedMethodTable::adjust_method_entries(&trace_name_printed);
   233   }
   233   }
   234 
   234 
   235   // Disable any dependent concurrent compilations
   235   // Increment flag indicating that some invariants are no longer true.
   236   SystemDictionary::notice_modification();
       
   237 
       
   238   // Set flag indicating that some invariants are no longer true.
       
   239   // See jvmtiExport.hpp for detailed explanation.
   236   // See jvmtiExport.hpp for detailed explanation.
   240   JvmtiExport::set_has_redefined_a_class();
   237   JvmtiExport::increment_redefinition_count();
   241 
   238 
   242   // check_class() is optionally called for product bits, but is
   239   // check_class() is optionally called for product bits, but is
   243   // always called for non-product bits.
   240   // always called for non-product bits.
   244 #ifdef PRODUCT
   241 #ifdef PRODUCT
   245   if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) {
   242   if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) {
  1624     // The merge can fail due to memory allocation failure or due
  1621     // The merge can fail due to memory allocation failure or due
  1625     // to robustness checks.
  1622     // to robustness checks.
  1626     return JVMTI_ERROR_INTERNAL;
  1623     return JVMTI_ERROR_INTERNAL;
  1627   }
  1624   }
  1628 
  1625 
       
  1626   if (old_cp->has_dynamic_constant()) {
       
  1627     merge_cp->set_has_dynamic_constant();
       
  1628     scratch_cp->set_has_dynamic_constant();
       
  1629   }
       
  1630 
  1629   log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count);
  1631   log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count);
  1630 
  1632 
  1631   if (_index_map_count == 0) {
  1633   if (_index_map_count == 0) {
  1632     // there is nothing to map between the new and merged constant pools
  1634     // there is nothing to map between the new and merged constant pools
  1633 
  1635 
  3247 
  3249 
  3248   // attach klass to new constant pool
  3250   // attach klass to new constant pool
  3249   // reference to the cp holder is needed for copy_operands()
  3251   // reference to the cp holder is needed for copy_operands()
  3250   smaller_cp->set_pool_holder(scratch_class);
  3252   smaller_cp->set_pool_holder(scratch_class);
  3251 
  3253 
       
  3254   if (scratch_cp->has_dynamic_constant()) {
       
  3255     smaller_cp->set_has_dynamic_constant();
       
  3256   }
       
  3257 
  3252   scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
  3258   scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
  3253   if (HAS_PENDING_EXCEPTION) {
  3259   if (HAS_PENDING_EXCEPTION) {
  3254     // Exception is handled in the caller
  3260     // Exception is handled in the caller
  3255     loader_data->add_to_deallocate_list(smaller_cp());
  3261     loader_data->add_to_deallocate_list(smaller_cp());
  3256     return;
  3262     return;
  3518       // There is a jmethodID, change it to point to the new method
  3524       // There is a jmethodID, change it to point to the new method
  3519       methodHandle new_method_h(_matching_new_methods[j]);
  3525       methodHandle new_method_h(_matching_new_methods[j]);
  3520       Method::change_method_associated_with_jmethod_id(jmid, new_method_h());
  3526       Method::change_method_associated_with_jmethod_id(jmid, new_method_h());
  3521       assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j],
  3527       assert(Method::resolve_jmethod_id(jmid) == _matching_new_methods[j],
  3522              "should be replaced");
  3528              "should be replaced");
  3523     }
       
  3524   }
       
  3525   // Update deleted jmethodID
       
  3526   for (int j = 0; j < _deleted_methods_length; ++j) {
       
  3527     Method* old_method = _deleted_methods[j];
       
  3528     jmethodID jmid = old_method->find_jmethod_id_or_null();
       
  3529     if (jmid != NULL) {
       
  3530       // Change the jmethodID to point to NSME.
       
  3531       Method::change_method_associated_with_jmethod_id(jmid, Universe::throw_no_such_method_error());
       
  3532     }
  3529     }
  3533   }
  3530   }
  3534 }
  3531 }
  3535 
  3532 
  3536 int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
  3533 int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {