< prev index next >

src/hotspot/share/runtime/synchronizer.cpp

Print this page




 976 // type of limit.  Beware that if MonitorBound is set to too low a value
 977 // we could just loop. In addition, if MonitorBound is set to a low value
 978 // we'll incur more safepoints, which are harmful to performance.
 979 // See also: GuaranteedSafepointInterval
 980 //
 981 // The current implementation uses asynchronous VM operations.
 982 //
 983 // If MonitorBound is set, the boundry applies to
 984 //     (g_om_population - g_om_free_count)
 985 // i.e., if there are not enough ObjectMonitors on the global free list,
 986 // then a safepoint deflation is induced. Picking a good MonitorBound value
 987 // is non-trivial.
 988 
 989 static void InduceScavenge(Thread* self, const char * Whence) {
 990   // Induce STW safepoint to trim monitors
 991   // Ultimately, this results in a call to deflate_idle_monitors() in the near future.
 992   // More precisely, trigger an asynchronous STW safepoint as the number
 993   // of active monitors passes the specified threshold.
 994   // TODO: assert thread state is reasonable
 995 
 996   if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) {
 997     // Induce a 'null' safepoint to scavenge monitors
 998     // Must VM_Operation instance be heap allocated as the op will be enqueue and posted
 999     // to the VMthread and have a lifespan longer than that of this activation record.
1000     // The VMThread will delete the op when completed.
1001     VMThread::execute(new VM_ScavengeMonitors());
1002   }
1003 }
1004 
1005 ObjectMonitor* ObjectSynchronizer::om_alloc(Thread* self) {
1006   // A large MAXPRIVATE value reduces both list lock contention
1007   // and list coherency traffic, but also tends to increase the
1008   // number of ObjectMonitors in circulation as well as the STW
1009   // scavenge costs.  As usual, we lean toward time in space-time
1010   // tradeoffs.
1011   const int MAXPRIVATE = 1024;
1012   stringStream ss;
1013   for (;;) {
1014     ObjectMonitor* m;
1015 
1016     // 1: try to allocate from the thread's local om_free_list.




 976 // type of limit.  Beware that if MonitorBound is set to too low a value
 977 // we could just loop. In addition, if MonitorBound is set to a low value
 978 // we'll incur more safepoints, which are harmful to performance.
 979 // See also: GuaranteedSafepointInterval
 980 //
 981 // The current implementation uses asynchronous VM operations.
 982 //
 983 // If MonitorBound is set, the boundry applies to
 984 //     (g_om_population - g_om_free_count)
 985 // i.e., if there are not enough ObjectMonitors on the global free list,
 986 // then a safepoint deflation is induced. Picking a good MonitorBound value
 987 // is non-trivial.
 988 
 989 static void InduceScavenge(Thread* self, const char * Whence) {
 990   // Induce STW safepoint to trim monitors
 991   // Ultimately, this results in a call to deflate_idle_monitors() in the near future.
 992   // More precisely, trigger an asynchronous STW safepoint as the number
 993   // of active monitors passes the specified threshold.
 994   // TODO: assert thread state is reasonable
 995 
 996   if (ForceMonitorScavenge == 0 && Atomic::xchg(&ForceMonitorScavenge, 1) == 0) {
 997     // Induce a 'null' safepoint to scavenge monitors
 998     // Must VM_Operation instance be heap allocated as the op will be enqueue and posted
 999     // to the VMthread and have a lifespan longer than that of this activation record.
1000     // The VMThread will delete the op when completed.
1001     VMThread::execute(new VM_ScavengeMonitors());
1002   }
1003 }
1004 
1005 ObjectMonitor* ObjectSynchronizer::om_alloc(Thread* self) {
1006   // A large MAXPRIVATE value reduces both list lock contention
1007   // and list coherency traffic, but also tends to increase the
1008   // number of ObjectMonitors in circulation as well as the STW
1009   // scavenge costs.  As usual, we lean toward time in space-time
1010   // tradeoffs.
1011   const int MAXPRIVATE = 1024;
1012   stringStream ss;
1013   for (;;) {
1014     ObjectMonitor* m;
1015 
1016     // 1: try to allocate from the thread's local om_free_list.


< prev index next >