hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
changeset 31234 48000028382c
parent 30773 3f15e2dc056b
child 31237 f166af10646e
equal deleted inserted replaced
31027:6df6a1332f23 31234:48000028382c
    41 #include "prims/jvmtiRedefineClasses.hpp"
    41 #include "prims/jvmtiRedefineClasses.hpp"
    42 #include "prims/methodComparator.hpp"
    42 #include "prims/methodComparator.hpp"
    43 #include "runtime/deoptimization.hpp"
    43 #include "runtime/deoptimization.hpp"
    44 #include "runtime/relocator.hpp"
    44 #include "runtime/relocator.hpp"
    45 #include "utilities/bitMap.inline.hpp"
    45 #include "utilities/bitMap.inline.hpp"
       
    46 #include "utilities/events.hpp"
    46 
    47 
    47 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
    48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
    48 
    49 
    49 Array<Method*>* VM_RedefineClasses::_old_methods = NULL;
    50 Array<Method*>* VM_RedefineClasses::_old_methods = NULL;
    50 Array<Method*>* VM_RedefineClasses::_new_methods = NULL;
    51 Array<Method*>* VM_RedefineClasses::_new_methods = NULL;
   171 }
   172 }
   172 
   173 
   173 void VM_RedefineClasses::doit_epilogue() {
   174 void VM_RedefineClasses::doit_epilogue() {
   174   // Free os::malloc allocated memory.
   175   // Free os::malloc allocated memory.
   175   os::free(_scratch_classes);
   176   os::free(_scratch_classes);
       
   177 
       
   178   // Reset the_class_oop to null for error printing.
       
   179   _the_class_oop = NULL;
   176 
   180 
   177   if (RC_TRACE_ENABLED(0x00000004)) {
   181   if (RC_TRACE_ENABLED(0x00000004)) {
   178     // Used to have separate timers for "doit" and "all", but the timer
   182     // Used to have separate timers for "doit" and "all", but the timer
   179     // overhead skewed the measurements.
   183     // overhead skewed the measurements.
   180     jlong doit_time = _timer_rsc_phase1.milliseconds() +
   184     jlong doit_time = _timer_rsc_phase1.milliseconds() +
  4103     ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
  4107     ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
  4104     the_class->external_name(),
  4108     the_class->external_name(),
  4105     java_lang_Class::classRedefinedCount(the_class_mirror),
  4109     java_lang_Class::classRedefinedCount(the_class_mirror),
  4106     os::available_memory() >> 10));
  4110     os::available_memory() >> 10));
  4107 
  4111 
       
  4112   {
       
  4113     ResourceMark rm(THREAD);
       
  4114     Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
       
  4115                              the_class->external_name(),
       
  4116                              java_lang_Class::classRedefinedCount(the_class_mirror));
       
  4117 
       
  4118   }
  4108   RC_TIMER_STOP(_timer_rsc_phase2);
  4119   RC_TIMER_STOP(_timer_rsc_phase2);
  4109 } // end redefine_single_class()
  4120 } // end redefine_single_class()
  4110 
  4121 
  4111 
  4122 
  4112 // Increment the classRedefinedCount field in the specific InstanceKlass
  4123 // Increment the classRedefinedCount field in the specific InstanceKlass
  4247     tty->print(" --  ");
  4258     tty->print(" --  ");
  4248     m->print_name(tty);
  4259     m->print_name(tty);
  4249     tty->cr();
  4260     tty->cr();
  4250   }
  4261   }
  4251 }
  4262 }
       
  4263 
       
  4264 void VM_RedefineClasses::print_on_error(outputStream* st) const {
       
  4265   VM_Operation::print_on_error(st);
       
  4266   if (_the_class_oop != NULL) {
       
  4267     ResourceMark rm;
       
  4268     st->print_cr(", redefining class %s", _the_class_oop->external_name());
       
  4269   }
       
  4270 }