The calculation of wait_until_next_sweep in NMethodSweeper::possibly_sweep() {} has a signed to unsigned conversion bug. The calculation was done as follows: double wait_until_next_sweep = (ReservedCodeCacheSize / (16 * M)) - time_since_last_sweep - CodeCache::reverse_free_ratio(); Since the type of ReservedCodeCacheSize (uintx) has a higher rank than time_since_last_sleep (int) and time_since_last_sweep can be larger than (ReservedCodeCacheSize / (16 * M)) there is an underflow. Consequently, wait_until_next_sweep is assigned a high value, which disables the intended periodic code cache sweeps. The current version will run the sweeper only if the code cache is full or the accumulated size of all nmethods that changed their state size the last sweep is larger than 1% of the ReservedCodeCacheSize.
|