--- old/src/share/vm/runtime/sweeper.cpp 2013-11-25 14:06:27.192067939 +0100 +++ new/src/share/vm/runtime/sweeper.cpp 2013-11-25 14:06:27.124067940 +0100 @@ -256,9 +256,11 @@ // Large ReservedCodeCacheSize: (e.g., 256M + code Cache is 90% full). The formula // computes: (256 / 16) - 10 = 6. if (!_should_sweep) { - int time_since_last_sweep = _time_counter - _last_sweep; - double wait_until_next_sweep = (ReservedCodeCacheSize / (16 * M)) - time_since_last_sweep - - CodeCache::reverse_free_ratio(); + const int time_since_last_sweep = _time_counter - _last_sweep; + const int max_wait_time = ReservedCodeCacheSize / (16 * M); + // Use only signed types + double wait_until_next_sweep = max_wait_time - time_since_last_sweep - CodeCache::reverse_free_ratio(); + assert(wait_until_next_sweep <= (double)max_wait_time, "Calculation of code cache sweeper interval is incorrect"); if ((wait_until_next_sweep <= 0.0) || !CompileBroker::should_compile_new_jobs()) { _should_sweep = true;