< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page
rev 8910 : full patch for jfr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -1191,17 +1191,32 @@
 
 
 // Note that we could encounter some performance loss through false-sharing as
 // multiple locks occupy the same $ line.  Padding might be appropriate.
 
+static void post_monitor_inflate_event(EventJavaMonitorInflate& event,
+                                       const oop obj,
+                                       //const ObjectSynchronizer::InflateCause cause) {
+                                       // unsupport cause
+                                       const u1 cause) {
+#if INCLUDE_TRACE
+  assert(event.should_commit(), "check outside");
+  event.set_monitorClass(obj->klass());
+  event.set_address((TYPE_ADDRESS)(uintptr_t)(void*)obj);
+  event.set_cause((u1)cause);
+  event.commit();
+#endif
+}
 
 ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
   // 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 +1343,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, (u1)0);
+          }
           return m ;
       }
 
       // CASE: neutral
       // TODO-FIXME: for entry we currently inflate and then try to CAS _owner.

@@ -1378,10 +1396,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, (u1)0);
+      }
       return m ;
   }
 }
 
 // Note that we could encounter some performance loss through false-sharing as
< prev index next >