Improve fidelity between contents of default CDS archive and classes loaded at runtime

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 15
    • Affects Version/s: None
    • Component/s: infrastructure
    • b10

      When generating the CDS default classlist at build time, we currently run a trial application with no CDS enabled. This means we take slightly different paths through the initial bootstraps than we will when later running -Xshare:dump on a full image.

      Similarly, when generating the default archive using -Xshare:dump, any pre-existing CDS archive is ignored. This again mean we take different paths through the bootstrap when dumping vs typical runtime.

      By doing multiple invocations of the HelloClasslist application, with a CDS dump in between, the lib/classlist file is trimmed down:

      diff -r 474a1f484ff0 make/GenerateLinkOptData.gmk
      --- a/make/GenerateLinkOptData.gmk Thu Dec 19 14:47:32 2019 +0100
      +++ b/make/GenerateLinkOptData.gmk Thu Dec 19 16:29:22 2019 +0100
      @@ -66,6 +66,13 @@
        $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
        $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
        $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \
      + -Duser.language=en -Duser.country=US \
      + -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
      + build.tools.classlist.HelloClasslist $(LOG_DEBUG)
      + $(GREP) -v HelloClasslist $@.raw > $(INTERIM_IMAGE_DIR)/lib/classlist
      + $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -Xshare:dump \
      + -Xmx128M -Xms128M $(LOG_INFO)
      + $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \
        -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
        -Duser.language=en -Duser.country=US \
        -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \

      This has partial effect (jdk.internal.module.SystemModules$all is excluded from base CDS).

      To get full effect we need to ensure -Xshare:dump doesn't include such classes we'll not load during real startup, e.g. by having -Xshare:dump changed to not dump anything except the classes explicitly listed in the classlist file. This would reduce variance of CDS archives generated on different systems with different settings.

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

              Created:
              Updated:
              Resolved: