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

Rework the support for the 'ignored' module options in CDS

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 11
    • hotspot
    • behavioral
    • low
    • add/remove/modify command line option
    • Implementation

      Summary

      Clarify the handling of the following module options during CDS dump time and run time:

      • --upgrade-module-path
      • --patch-module
      • --limit-modules

      Problem

      In the JDK 10 documentation, the above 3 options are listed as 'being ignored during dump time.

      However, starting from JDK 10, PlatformClassLoader and AppClassLoader are used to load the platform and app classes, respectively, at CDS dump time. When any of these 3 options are specified during CDS dump time, it affects the initialization of the module system. Therefore, these options are not truly 'ignored'.

      In JDK 10, we can archive module classes from the runtime image defined to both PlatformClassLoader and AppClassLoader. Module classes from --upgrade-module-path could be unintentionally archived (although such archived classes are never used at run time).

      Note:

      Not supporting these 3 options during dump time doesn't seem to be an issue:

      • --upgrade-module-path In JDK 11, only two system modules are upgradeable (java.compiler, jdk.internal.vm.compiler). It won’t be used too much initially for user’s developed modules. Oracle Lab is using --upgrade-module-path to upgrade the above two modules in order to use Graal as the JIT. This can be added in a subsequent enhancement if CDS and Lab Graal are used often together.

      • --patch-module As documented in JEP 261, --patch-module is strongly discouraged for production use.

      • --limit-modules --limit-modules is intended for testing purpose to limit the observable modules (as in the image only contains the limited observable modules). For example, SQE runs tests with --limit-modules java.base to verify if the tests pass with a minimal image.

      Solution

      At CDS dump time, forbid these 3 options at CDS dump time. At run time, if any of these 3 options are specified, disable CDS.

      Specification

      If any of the above 3 module options is specified in the command line with CDS dump enabled (-Xshare:dump), the vm will exit with an error message. e.g.

      Error occurred during initialization of VM
      Cannot use the following option when dumping the shared archive: --patch-module

      If any of the above 3 module options is specified in the command line with CDS enabled (-Xshare:{on, auto}), CDS will be disabled and vm will issue a warning. e.g.

      Java HotSpot(TM) 64-Bit Server VM warning: CDS is disabled when the --patch-module
      option is specified.

            ccheung Calvin Cheung
            jiangli Jiangli Zhou
            Ioi Lam, Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: