969 // This is called both with and without CodeCache_lock held so |
969 // This is called both with and without CodeCache_lock held so |
970 // handle both cases. |
970 // handle both cases. |
971 if (CodeCache_lock->owned_by_self()) { |
971 if (CodeCache_lock->owned_by_self()) { |
972 return _heap->largest_free_block(); |
972 return _heap->largest_free_block(); |
973 } else { |
973 } else { |
974 // Avoid lock ordering problems with ttyLock. |
|
975 ttyUnlocker ttyul; |
|
976 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
974 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
977 return _heap->largest_free_block(); |
975 return _heap->largest_free_block(); |
978 } |
976 } |
979 } |
977 } |