< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page

        

@@ -22,10 +22,11 @@
  *
  */
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "jfr/jfrEvents.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/handles.inline.hpp"

@@ -1176,10 +1177,19 @@
 
     Thread::muxRelease (&ListLock) ;
     TEVENT (omFlush) ;
 }
 
+static void post_monitor_inflate_event(EventJavaMonitorInflate* event,
+                                       const oop obj) {
+  assert(event != NULL, "invariant");
+  assert(event->should_commit(), "invariant");
+  event->set_monitorClass(obj->klass());
+  event->set_address((uintptr_t)(void*)obj);
+  event->commit();
+}
+
 // Fast path code shared by multiple functions
 ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) {
   markOop mark = obj->mark();
   if (mark->has_monitor()) {
     assert(ObjectSynchronizer::verify_objmon_isinpool(mark->monitor()), "monitor is invalid");

@@ -1198,10 +1208,12 @@
   // Inflate mutates the heap ...
   // Relaxing assertion for bug 6320749.
   assert (Universe::verify_in_progress() ||
           !SafepointSynchronize::is_at_safepoint(), "invariant") ;
 
+  EventJavaMonitorInflate event;
+
   for (;;) {
       const markOop mark = object->mark() ;
       assert (!mark->has_bias_pattern(), "invariant") ;
 
       // The mark can be in one of the following states:

@@ -1328,10 +1340,13 @@
               tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
                 (void *) object, (intptr_t) object->mark(),
                 object->klass()->external_name());
             }
           }
+          if (event.should_commit()) {
+            post_monitor_inflate_event(&event, object);
+          }
           return m ;
       }
 
       // CASE: neutral
       // TODO-FIXME: for entry we currently inflate and then try to CAS _owner.

@@ -1378,10 +1393,13 @@
           tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
             (void *) object, (intptr_t) object->mark(),
             object->klass()->external_name());
         }
       }
+      if (event.should_commit()) {
+        post_monitor_inflate_event(&event, object);
+      }
       return m ;
   }
 }
 
 // Note that we could encounter some performance loss through false-sharing as
< prev index next >