RFR(XXS): 8029091: Bug in calculation of code cache sweeping interval

Albert Noll albert.noll at oracle.com
Mon Nov 25 05:27:46 PST 2013


Hi all,

could I have reviews for this small patch?

Bug: _
_https://bugs.openjdk.java.net/browse/JDK-8029091

Webrev:
http://cr.openjdk.java.net/~anoll/8029091/webrev.00/

Problem:
The calculation of 'wait_until_next_sweep' in 
'NMethodSweeper::possibly_sweep() {}' has a signed
to unsigned conversion bug. The calculation is currently 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 wrong value, which 
disables the intended periodic code cache sweeps.

Solution:
Use only signed types for the calculation of 'wait_until_next_sweep'. 
Furthermore, an assert checks that
'wait_until_next_sweep' is never larger than ' (ReservedCodeCacheSize / 
(16 * M))', which is the
maximum time between two sweeps.


Many thanks in advance,
Albert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20131125/23ddcfb1/attachment.html 


More information about the hotspot-compiler-dev mailing list