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

Compact symbol table layout inside shared archive

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b47
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Currently, every symbol in the SymbolTable is associated with a HashtableEntry<Symbol*, mtSymbol>, which is 24-byte per instance on 64-bit (12 bytes on 32-bit). There is also a 8-byte pointer per bucket slot.

        Also, when the SymbolTable is re-balanced, the HashtableEntries may be written into, which would reduce the read-only ratio (even for the HashtableEntry that are placed in the shared archive).

        We can use a smaller data structure (8 bytes per symbol) than HashtableEntry, and reduce the size of the buckets to 6 bytes per bucket slot. This is what CLDC does.

        // Layout of compact symbol table in the shared archive:
        // juint num_symbols;
        // juint num_buckets;
        // juint buckets[num_buckets];
        // jushort bucket_sizes[num_buckets];
        // juint table[num_symbols * 2]
        //
        // Each symbol's entry is 8 bytes in the table[]:
        // juint hash;
        //#ifdef _LP64
        // juint offset; /* Symbol *sym = (Symbol*)(SharedBaseAddress + offset) */
        //#else
        // Symbol* sym;
        //#endif

        Currently, with the default classlist in JDK8, on 64-bit JVM, the SymbolTable Hash Entries take up about 6% of total CDS space. After the change, this should go down to about 2%.

        Notes:

        [1] This means, however, that the SymbolTable now needs to be split into two parts -- the CDS table, which is read-only (and will not be re-balanced), and the "regular" table, which may be modified/rebalanced at run-time.
        [2] Shared StringTable (when it's implemented) can be handled in a very similar manner.

          Attachments

          1. HW.symboltable
            506 kB
          2. HW.symbol
            360 kB

            Issue Links

              Activity

                People

                Assignee:
                jiangli Jiangli Zhou
                Reporter:
                jiangli Jiangli Zhou
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: