equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "classfile/vmSymbols.hpp" |
26 #include "classfile/vmSymbols.hpp" |
27 #include "logging/log.hpp" |
27 #include "logging/log.hpp" |
|
28 #include "jfr/jfrEvents.hpp" |
28 #include "memory/allocation.inline.hpp" |
29 #include "memory/allocation.inline.hpp" |
29 #include "memory/metaspaceShared.hpp" |
30 #include "memory/metaspaceShared.hpp" |
30 #include "memory/padded.hpp" |
31 #include "memory/padded.hpp" |
31 #include "memory/resourceArea.hpp" |
32 #include "memory/resourceArea.hpp" |
32 #include "oops/markOop.hpp" |
33 #include "oops/markOop.hpp" |
44 #include "runtime/stubRoutines.hpp" |
45 #include "runtime/stubRoutines.hpp" |
45 #include "runtime/synchronizer.hpp" |
46 #include "runtime/synchronizer.hpp" |
46 #include "runtime/thread.inline.hpp" |
47 #include "runtime/thread.inline.hpp" |
47 #include "runtime/vframe.hpp" |
48 #include "runtime/vframe.hpp" |
48 #include "runtime/vmThread.hpp" |
49 #include "runtime/vmThread.hpp" |
49 #include "trace/traceMacros.hpp" |
|
50 #include "trace/tracing.hpp" |
|
51 #include "utilities/align.hpp" |
50 #include "utilities/align.hpp" |
52 #include "utilities/dtrace.hpp" |
51 #include "utilities/dtrace.hpp" |
53 #include "utilities/events.hpp" |
52 #include "utilities/events.hpp" |
54 #include "utilities/preserveException.hpp" |
53 #include "utilities/preserveException.hpp" |
55 |
54 |
125 int ObjectSynchronizer::gOmInUseCount = 0; |
124 int ObjectSynchronizer::gOmInUseCount = 0; |
126 |
125 |
127 static volatile intptr_t gListLock = 0; // protects global monitor lists |
126 static volatile intptr_t gListLock = 0; // protects global monitor lists |
128 static volatile int gMonitorFreeCount = 0; // # on gFreeList |
127 static volatile int gMonitorFreeCount = 0; // # on gFreeList |
129 static volatile int gMonitorPopulation = 0; // # Extant -- in circulation |
128 static volatile int gMonitorPopulation = 0; // # Extant -- in circulation |
130 |
|
131 static void post_monitor_inflate_event(EventJavaMonitorInflate&, |
|
132 const oop, |
|
133 const ObjectSynchronizer::InflateCause); |
|
134 |
129 |
135 #define CHAINMARKER (cast_to_oop<intptr_t>(-1)) |
130 #define CHAINMARKER (cast_to_oop<intptr_t>(-1)) |
136 |
131 |
137 |
132 |
138 // =====================> Quick functions |
133 // =====================> Quick functions |
1363 |
1358 |
1364 Thread::muxRelease(&gListLock); |
1359 Thread::muxRelease(&gListLock); |
1365 TEVENT(omFlush); |
1360 TEVENT(omFlush); |
1366 } |
1361 } |
1367 |
1362 |
|
1363 static void post_monitor_inflate_event(EventJavaMonitorInflate* event, |
|
1364 const oop obj, |
|
1365 ObjectSynchronizer::InflateCause cause) { |
|
1366 assert(event != NULL, "invariant"); |
|
1367 assert(event->should_commit(), "invariant"); |
|
1368 event->set_monitorClass(obj->klass()); |
|
1369 event->set_address((uintptr_t)(void*)obj); |
|
1370 event->set_cause((u1)cause); |
|
1371 event->commit(); |
|
1372 } |
|
1373 |
1368 // Fast path code shared by multiple functions |
1374 // Fast path code shared by multiple functions |
1369 ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) { |
1375 ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) { |
1370 markOop mark = obj->mark(); |
1376 markOop mark = obj->mark(); |
1371 if (mark->has_monitor()) { |
1377 if (mark->has_monitor()) { |
1372 assert(ObjectSynchronizer::verify_objmon_isinpool(mark->monitor()), "monitor is invalid"); |
1378 assert(ObjectSynchronizer::verify_objmon_isinpool(mark->monitor()), "monitor is invalid"); |
1517 p2i(object), p2i(object->mark()), |
1523 p2i(object), p2i(object->mark()), |
1518 object->klass()->external_name()); |
1524 object->klass()->external_name()); |
1519 } |
1525 } |
1520 } |
1526 } |
1521 if (event.should_commit()) { |
1527 if (event.should_commit()) { |
1522 post_monitor_inflate_event(event, object, cause); |
1528 post_monitor_inflate_event(&event, object, cause); |
1523 } |
1529 } |
1524 return m; |
1530 return m; |
1525 } |
1531 } |
1526 |
1532 |
1527 // CASE: neutral |
1533 // CASE: neutral |
1568 p2i(object), p2i(object->mark()), |
1574 p2i(object), p2i(object->mark()), |
1569 object->klass()->external_name()); |
1575 object->klass()->external_name()); |
1570 } |
1576 } |
1571 } |
1577 } |
1572 if (event.should_commit()) { |
1578 if (event.should_commit()) { |
1573 post_monitor_inflate_event(event, object, cause); |
1579 post_monitor_inflate_event(&event, object, cause); |
1574 } |
1580 } |
1575 return m; |
1581 return m; |
1576 } |
1582 } |
1577 } |
1583 } |
1578 |
1584 |
1895 ShouldNotReachHere(); |
1901 ShouldNotReachHere(); |
1896 } |
1902 } |
1897 return "Unknown"; |
1903 return "Unknown"; |
1898 } |
1904 } |
1899 |
1905 |
1900 static void post_monitor_inflate_event(EventJavaMonitorInflate& event, |
|
1901 const oop obj, |
|
1902 const ObjectSynchronizer::InflateCause cause) { |
|
1903 #if INCLUDE_TRACE |
|
1904 assert(event.should_commit(), "check outside"); |
|
1905 event.set_monitorClass(obj->klass()); |
|
1906 event.set_address((TYPE_ADDRESS)(uintptr_t)(void*)obj); |
|
1907 event.set_cause((u1)cause); |
|
1908 event.commit(); |
|
1909 #endif |
|
1910 } |
|
1911 |
|
1912 //------------------------------------------------------------------------------ |
1906 //------------------------------------------------------------------------------ |
1913 // Debugging code |
1907 // Debugging code |
1914 |
1908 |
1915 void ObjectSynchronizer::sanity_checks(const bool verbose, |
1909 void ObjectSynchronizer::sanity_checks(const bool verbose, |
1916 const uint cache_line_size, |
1910 const uint cache_line_size, |