< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page




1653       assert(prevtail->FreeNext == NULL, "cleaned up deflated?");
1654       prevtail->FreeNext = mid;
1655     }
1656     *freeTailp = mid;
1657     deflated = true;
1658   }
1659   return deflated;
1660 }
1661 
1662 // Walk a given monitor list, and deflate idle monitors
1663 // The given list could be a per-thread list or a global list
1664 // Caller acquires gListLock.
1665 //
1666 // In the case of parallel processing of thread local monitor lists,
1667 // work is done by Threads::parallel_threads_do() which ensures that
1668 // each Java thread is processed by exactly one worker thread, and
1669 // thus avoid conflicts that would arise when worker threads would
1670 // process the same monitor lists concurrently.
1671 //
1672 // See also ParallelSPCleanupTask and
1673 // SafepointSynchronizer::do_cleanup_tasks() in safepoint.cpp and
1674 // Threads::parallel_java_threads_do() in thread.cpp.
1675 int ObjectSynchronizer::deflate_monitor_list(ObjectMonitor** listHeadp,
1676                                              ObjectMonitor** freeHeadp,
1677                                              ObjectMonitor** freeTailp) {
1678   ObjectMonitor* mid;
1679   ObjectMonitor* next;
1680   ObjectMonitor* cur_mid_in_use = NULL;
1681   int deflated_count = 0;
1682 
1683   for (mid = *listHeadp; mid != NULL;) {
1684     oop obj = (oop) mid->object();
1685     if (obj != NULL && deflate_monitor(mid, obj, freeHeadp, freeTailp)) {
1686       // if deflate_monitor succeeded,
1687       // extract from per-thread in-use list
1688       if (mid == *listHeadp) {
1689         *listHeadp = mid->FreeNext;
1690       } else if (cur_mid_in_use != NULL) {
1691         cur_mid_in_use->FreeNext = mid->FreeNext; // maintain the current thread in-use list
1692       }
1693       next = mid->FreeNext;




1653       assert(prevtail->FreeNext == NULL, "cleaned up deflated?");
1654       prevtail->FreeNext = mid;
1655     }
1656     *freeTailp = mid;
1657     deflated = true;
1658   }
1659   return deflated;
1660 }
1661 
1662 // Walk a given monitor list, and deflate idle monitors
1663 // The given list could be a per-thread list or a global list
1664 // Caller acquires gListLock.
1665 //
1666 // In the case of parallel processing of thread local monitor lists,
1667 // work is done by Threads::parallel_threads_do() which ensures that
1668 // each Java thread is processed by exactly one worker thread, and
1669 // thus avoid conflicts that would arise when worker threads would
1670 // process the same monitor lists concurrently.
1671 //
1672 // See also ParallelSPCleanupTask and
1673 // SafepointSynchronize::do_cleanup_tasks() in safepoint.cpp and
1674 // Threads::parallel_java_threads_do() in thread.cpp.
1675 int ObjectSynchronizer::deflate_monitor_list(ObjectMonitor** listHeadp,
1676                                              ObjectMonitor** freeHeadp,
1677                                              ObjectMonitor** freeTailp) {
1678   ObjectMonitor* mid;
1679   ObjectMonitor* next;
1680   ObjectMonitor* cur_mid_in_use = NULL;
1681   int deflated_count = 0;
1682 
1683   for (mid = *listHeadp; mid != NULL;) {
1684     oop obj = (oop) mid->object();
1685     if (obj != NULL && deflate_monitor(mid, obj, freeHeadp, freeTailp)) {
1686       // if deflate_monitor succeeded,
1687       // extract from per-thread in-use list
1688       if (mid == *listHeadp) {
1689         *listHeadp = mid->FreeNext;
1690       } else if (cur_mid_in_use != NULL) {
1691         cur_mid_in_use->FreeNext = mid->FreeNext; // maintain the current thread in-use list
1692       }
1693       next = mid->FreeNext;


< prev index next >