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

Compact symbol table layout inside shared archive

    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.
        1. HW.symbol
          360 kB
          Jiangli Zhou
        2. HW.symboltable
          506 kB
          Jiangli Zhou

          Issue Links

            Activity

            Hide
            jiangli Jiangli Zhou added a comment - - edited
            Here is a sample of the shared compact symbol table that John requested:

            Bucket start_offsets
            ============
               Bucket_1:1733
               Bucket_2:1741
               Bucket_3:1747
               Bucket_4:1751
               Bucket_5:1757
               Bucket_6:1759
               Bucket_7:1767
               Bucket_8:1777
               Bucket_9:1795
               Bucket_10:1801
               Bucket_11:1815
               Bucket_12:1825
               Bucket_13:1837
               Bucket_14:1841
               Bucket_15:1855
               Bucket_16:1867
               Bucket_17:1877
               Bucket_18:1883
               Bucket_19:1889
               Bucket_20:1897
               ...
               Bucket_1135:10779
               Bucket_1136:10791
               Bucket_1137:10797
               Bucket_1138:10807
               Bucket_1139:10813
               Bucket_1140:10821
               Bucket_1141:10839
               Bucket_1142:10845
               Bucket_1143:10857
               Bucket_1144:10869
               Bucket_1145:10877
               Bucket_1146:10887
               Bucket_1147:10897
               Bucket_1148:10907
               Bucket_1149:10917

            Bucket sizes
            ========
               Bucket_1:4
               Bucket_2:3
               Bucket_3:2
               Bucket_4:3
               Bucket_5:1
               Bucket_6:4
               Bucket_7:5
               Bucket_8:9
               Bucket_9:3
               Bucket_10:7
               ...
               Bucket_1135:6
               Bucket_1136:3
               Bucket_1137:5
               Bucket_1138:3
               Bucket_1139:4
               Bucket_1140:9
               Bucket_1141:3
               Bucket_1142:6
               Bucket_1143:6
               Bucket_1144:4
               Bucket_1145:5
               Bucket_1146:5
               Bucket_1147:5
               Bucket_1148:5
               Bucket_1149:4

            ...
            Entries: Symbol address offsets from base address
            ================================
              Bucket_0: 106760(Ljava/io/PrintStream;), 145960(setDaemon), 424568(Ljava/lang/Class<Ljava/lang/Byte;>;), 61288(),
              Bucket_1: 60496(getAnnotationType), 177888((Ljava/lang/Object;TV;)TV;), 171240(Properties.java), 26976((Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;),
              Bucket_2: 438864(LongCache), 241056(NF_staticOffset), 94128(synchronizedSet),
              Bucket_3: 57728(getMethod0), 51936(allPermDomain),
              Bucket_4: 18536(vmloader), 406456(DIRECTIONALITY_EUROPEAN_NUMBER), 92888(class "),
              Bucket_5: 151128(NORM_PRIORITY),
              Bucket_6: 288152(exprString), 190680(Dictionary.java), 405432(MAX_VALUE), 202744(getParameterCount),
              Bucket_7: 237936((Ljava/lang/Class;)Ljava/lang/invoke/MethodType;), 375024(checkURL), 55696(()Ljava/security/ProtectionDomain;), 53608(()[Ljava/lang/Class<*>;), 122800(delete),
              Bucket_8: 135440(access allowed ), 31976(([CI)V), 227216(null value), 288792(zero), 163312(unsuspendSomeThreads), 67880(casAnnotationData), 418248(sun/misc/FloatConsts), 11112(BootstrapMethods), 394224(CodeSource.java),
              Bucket_9: 403272(Ljava/lang/Boolean;), 318008(CallSite.java), 114736( ),
              Bucket_10: 154504((I)Ljava/lang/Thread$State;), 20816(putObject), 16944(parent), 248728(asType), 66712(removeByNameAndDescriptor), 14168(modifiers), 130136(),
               ...
            Show
            jiangli Jiangli Zhou added a comment - - edited Here is a sample of the shared compact symbol table that John requested: Bucket start_offsets ============    Bucket_1:1733    Bucket_2:1741    Bucket_3:1747    Bucket_4:1751    Bucket_5:1757    Bucket_6:1759    Bucket_7:1767    Bucket_8:1777    Bucket_9:1795    Bucket_10:1801    Bucket_11:1815    Bucket_12:1825    Bucket_13:1837    Bucket_14:1841    Bucket_15:1855    Bucket_16:1867    Bucket_17:1877    Bucket_18:1883    Bucket_19:1889    Bucket_20:1897    ...    Bucket_1135:10779    Bucket_1136:10791    Bucket_1137:10797    Bucket_1138:10807    Bucket_1139:10813    Bucket_1140:10821    Bucket_1141:10839    Bucket_1142:10845    Bucket_1143:10857    Bucket_1144:10869    Bucket_1145:10877    Bucket_1146:10887    Bucket_1147:10897    Bucket_1148:10907    Bucket_1149:10917 Bucket sizes ========    Bucket_1:4    Bucket_2:3    Bucket_3:2    Bucket_4:3    Bucket_5:1    Bucket_6:4    Bucket_7:5    Bucket_8:9    Bucket_9:3    Bucket_10:7    ...    Bucket_1135:6    Bucket_1136:3    Bucket_1137:5    Bucket_1138:3    Bucket_1139:4    Bucket_1140:9    Bucket_1141:3    Bucket_1142:6    Bucket_1143:6    Bucket_1144:4    Bucket_1145:5    Bucket_1146:5    Bucket_1147:5    Bucket_1148:5    Bucket_1149:4 ... Entries: Symbol address offsets from base address ================================   Bucket_0: 106760(Ljava/io/PrintStream;), 145960(setDaemon), 424568(Ljava/lang/Class<Ljava/lang/Byte;>;), 61288(),   Bucket_1: 60496(getAnnotationType), 177888((Ljava/lang/Object;TV;)TV;), 171240(Properties.java), 26976((Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;),   Bucket_2: 438864(LongCache), 241056(NF_staticOffset), 94128(synchronizedSet),   Bucket_3: 57728(getMethod0), 51936(allPermDomain),   Bucket_4: 18536(vmloader), 406456(DIRECTIONALITY_EUROPEAN_NUMBER), 92888(class "),   Bucket_5: 151128(NORM_PRIORITY),   Bucket_6: 288152(exprString), 190680(Dictionary.java), 405432(MAX_VALUE), 202744(getParameterCount),   Bucket_7: 237936((Ljava/lang/Class;)Ljava/lang/invoke/MethodType;), 375024(checkURL), 55696(()Ljava/security/ProtectionDomain;), 53608(()[Ljava/lang/Class<*>;), 122800(delete),   Bucket_8: 135440(access allowed ), 31976(([CI)V), 227216(null value), 288792(zero), 163312(unsuspendSomeThreads), 67880(casAnnotationData), 418248(sun/misc/FloatConsts), 11112(BootstrapMethods), 394224(CodeSource.java),   Bucket_9: 403272(Ljava/lang/Boolean;), 318008(CallSite.java), 114736( ),   Bucket_10: 154504((I)Ljava/lang/Thread$State;), 20816(putObject), 16944(parent), 248728(asType), 66712(removeByNameAndDescriptor), 14168(modifiers), 130136(),    ...
            Hide
            jiangli Jiangli Zhou added a comment -
            The shared compact symbol table with all symbols from running HelloWorld.
            Show
            jiangli Jiangli Zhou added a comment - The shared compact symbol table with all symbols from running HelloWorld.
            Hide
            jiangli Jiangli Zhou added a comment -
            The complete list of symbols for HelloWorld.
            Show
            jiangli Jiangli Zhou added a comment - The complete list of symbols for HelloWorld.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/05c08ab3cf65
            User: jiangli
            Date: 2014-12-18 06:52:39 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/05c08ab3cf65 User: jiangli Date: 2014-12-18 06:52:39 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/05c08ab3cf65
            User: lana
            Date: 2015-01-21 21:54:46 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/05c08ab3cf65 User: lana Date: 2015-01-21 21:54:46 +0000

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: