Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029091

Bug in calculation of code cache sweeping interval

XMLWordPrintable

    • b117
    • 8
    • b01
    • generic
    • generic

        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.

              anoll Albert Noll (Inactive)
              anoll Albert Noll (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: