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

Lots of trivial classes are generated by Nashorn compiler

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 9
    • None
    • core-libs

    Backports

      Description

        Running the fresh Nashorn with dumping all classes:

        ~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java -jar ~/trunks/jdk9-dev/build/linux-x86_64-normal-server-release/images/j2sdk-image/jre/lib/ext/nashorn.jar -Dnashorn.typeInfo.disabled=false --class-cache-size=0 --persistent-code-cache=false -scripting --log=time -d=generated/ test/script/basic/compile-octane.js -- --iterations 1

        ...yields an interesting tidbit: there are lots of trivial classes generated:
         http://cr.openjdk.java.net/~shade/8057588/nashorn-generated-classes-1.list

        Notice how bytecode sizes have a very long tail in lower-sized classes. 3300/4900 of all classes seem to be those tiny classes. Disassembling a few of those tiny classes yields the almost the same content:

        Compiled from "file:/home/shade/trunks/jdk9-dev/nashorn/test/script/basic/../external/octane/pdfjs.js"
        public class jdk.nashorn.internal.scripts.Script$Recompilation$235$1$pdfjs$cu2 extends jdk.nashorn.internal.scripts.JS {
          public static final boolean strictMode;

        }

        ...maybe we can cache them? Having all these tiny splices floating around are probably contaminating the symbol table with redundant string symbols from all those "jdk.nashorn.internal.scripts.Script$Recompilation$235$1$pdfjs$cu2".

        Attachments

          Issue Links

            Activity

              People

                lagergren Marcus Lagergren
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: