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

Generate CharacterDataLatin1 lookup tables directly

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      java.lang.CharacterDataLatin1 and others are generated at build time by the GenerateCharacter tool, which has a -string mode to generate lookup tables as Strings literals rather than arrays directly. This serves multiple purposes:

      1. it reduces the size of the generated bytecode, which is necessary to keep code below method bytecode limits if the arrays generated are very large
      2. it may under certain circumstances (large enough arrays, JITed code) be a performance optimization

      The compact strings feature that went into 9 unfortunately made String::toCharArray less friendly to startup, and since the same feature means we're now always loading the CharacterDataLatin1 class on bootstrap in all locales it seemed reasonable to re-examine whether this class in particular really gains from generating its lookup tables via String literals.

      Turns out it doesn't. By generating CharacterDataLatin1 tables as arrays explicitly:

      - executed bytecode drop from 21,782 to 2,077 when initializing this class (approximately 2% of executed bytecode; 1.5% of total instructions)
      - slight reduction (~1Kb) in the minimum retained heap usage
      - the size of CharacterDataLatin1.class only grows from 6458 to 7385 bytes

        Attachments

          Activity

            People

            • Assignee:
              redestad Claes Redestad
              Reporter:
              redestad Claes Redestad
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: