src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page

        

@@ -40,10 +40,11 @@
 #include "prims/jvmtiRedefineClasses.hpp"
 #include "prims/methodComparator.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/relocator.hpp"
 #include "utilities/bitMap.inline.hpp"
+#include "utilities/events.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 Array<Method*>* VM_RedefineClasses::_old_methods = NULL;
 Array<Method*>* VM_RedefineClasses::_new_methods = NULL;

@@ -170,10 +171,13 @@
 
 void VM_RedefineClasses::doit_epilogue() {
   // Free os::malloc allocated memory.
   os::free(_scratch_classes);
 
+  // Reset the_class_oop to null for error printing.
+  _the_class_oop = NULL;
+
   if (RC_TRACE_ENABLED(0x00000004)) {
     // Used to have separate timers for "doit" and "all", but the timer
     // overhead skewed the measurements.
     jlong doit_time = _timer_rsc_phase1.milliseconds() +
                       _timer_rsc_phase2.milliseconds();

@@ -4094,10 +4098,17 @@
     ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
     the_class->external_name(),
     java_lang_Class::classRedefinedCount(the_class_mirror),
     os::available_memory() >> 10));
 
+  {
+    ResourceMark rm(THREAD);
+    Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
+                             the_class->external_name(),
+                             java_lang_Class::classRedefinedCount(the_class_mirror));
+
+  }
   RC_TIMER_STOP(_timer_rsc_phase2);
 } // end redefine_single_class()
 
 
 // Increment the classRedefinedCount field in the specific InstanceKlass

@@ -4238,5 +4249,13 @@
     tty->print(" --  ");
     m->print_name(tty);
     tty->cr();
   }
 }
+
+void VM_RedefineClasses::print_on_error(outputStream* st) const {
+  VM_Operation::print_on_error(st);
+  if (_the_class_oop != NULL) {
+    ResourceMark rm;
+    st->print_cr(", redefining class %s", _the_class_oop->external_name());
+  }
+}