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

G1: Improve check for string dedup

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 16
    • hotspot
    • gc
    • b23

      Currently the G1 evacuation-time test for string deduplication first tests the enable flag. If enabled, it collects some arguments and calls into the dedup handling code. One of the first things done by the dedup handling code is to test whether the object is actually a string, doing nothing if it isn't.

      This is done for every (before JDK-8158045, every non-array after) object. As a result, enabling dedup has a pretty significant cost, since most objects are not strings.

      A better approach is to add a member to G1ParScanThreadState whose value is SystemDictionary::String_klass if dedup is enabled, else nullptr.

      Change the test for dedup to compare the already available klass of the object with the value in that new state member. If not equal then either not a string or dedup is disabled. Otherwise, call into the dedup handling.

      With this change, enabling dedup only imposes a cost on evacuation of strings.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: