Deprecate AlwaysActAsServerClassMachine and NeverActAsServerClassMachine

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P4
    • 26
    • Component/s: hotspot
    • None
    • gc
    • behavioral
    • low
    • Hide
      Default GC selection: Users can impact GC selection via the -XX:+UseXXXGC flag(s) instead.

       Client emulation mode: Users will no longer be able to influence whether client emulation mode should be enabled, it will be solely up to the JVM to enable/disable it until it is eventually removed. We don't see client emulation mode as a desirable feature that should be part of the JVM in the future. If users want to guarantee that client (emulation) mode should be used, they can get ahold of a JVM with only C1 (not C2 and/or JVMCI compiler) enabled.
      Show
      Default GC selection: Users can impact GC selection via the -XX:+UseXXXGC flag(s) instead.  Client emulation mode: Users will no longer be able to influence whether client emulation mode should be enabled, it will be solely up to the JVM to enable/disable it until it is eventually removed. We don't see client emulation mode as a desirable feature that should be part of the JVM in the future. If users want to guarantee that client (emulation) mode should be used, they can get ahold of a JVM with only C1 (not C2 and/or JVMCI compiler) enabled.
    • add/remove/modify command line option
    • JDK

      Summary

      The flags NeverActAsServerClassMachine and AlwaysActAsServerClassMachine should be deprecated in JDK 26, obsoleted in JDK 27, and removed in JDK 28.

      Problem

      The flags NeverActAsServerClassMachine and AlwaysActAsServerClassMachine influence:

      1. Default Garbage Collector Selection: Both flags affect whether the JVM ergonomically selects G1 (for server-class machines) or SerialGC (otherwise) as the default garbage collector.
      2. Client Emulation Mode: Only the NeverActAsServerClassMachine determines if client emulation mode is enabled, even when the C2 and/or JVMCI compilers are active.

      Both flags impact the decision logic that determines whether a system is considered a "server class machine." When deemed a server-class machine, G1 is chosen by default, otherwise, SerialGC is selected. With the planned introduction of JEP 523, this distinction, and thus the need for these flags, is no longer necessary. Even without JEP 523, if a user is configuring SerialGC via the AlwaysActAsServerClassMachine or NeverActAsServerClassMachine flags, they could instead just use -XX:+UseSerialGC.

      Additionally, only NeverActAsServerClassMachine is considered when evaluating whether client emulation mode should be enabled. This is unintuitive, as AlwaysActAsServerClassMachine has no effect in this scenario and is not documented in java.md. The user-facing interaction and precedence of these flags are unclear, especially since their combined use is not documented. If both flags are set to the same value (both true or both false), they conflict, and the undocumented behavior is that NeverActAsServerClassMachine takes precedence.

      The client emulation mode was a way to emulate a client build on platforms with reduced virtual address space, mainly Windows 32-bit (see JDK-8166002). In summary, client emulation mode configures the JVM to use the C1 JIT compiler, SerialGC, and 32Mb CodeCache (conveyed through its Release Note). With Windows 32-bit being deprecated in JDK 24 (see JEP 479), the incentive for the client emulation mode feature is gone. Additionally, the overall usefulness of client emulation mode is questionable, especially since there has been an apparent bug in memory limit from JDK 11 to JDK 26 affecting its usability (see JDK-8369658).

      Removing the ability for users to influence whether client emulation mode should be enabled through the NeverActAsServerClassMachine flag allows us to simplify the JVM implementation and reduce maintenance costs. This aligns with the currently supported platforms, where the client emulation mode no longer serves a definitive purpose.

      Solution

      The flags NeverActAsServerClassMachine and AlwaysActAsServerClassMachine should be deprecated in JDK 26, obsoleted in JDK 27, and removed in JDK 28.

      The ergonomic selection of the default garbage collector based on "server class" detection is becoming obsolete. Even if the default GC is not universally changed to G1, users who rely on a specific GC being chosen through the NeverActAsServerClassMachine and AlwaysActAsServerClassMachine flags should instead explicitly configure the GC they want, e.g. through -XX:+UseSerialGC.

      With these flags removed, users will no longer be able to influence whether client emulation mode should be enabled via the NeverActAsServerClassMachine flag. Client emulation mode will only remain available for JVMs running with C1 and without C2 and JVMCI compilers, until it is eventually removed. Users who need to restrict their JVM to C1-only execution should use the -XX:TieredStopAtLevel=1 flag. Alternatively, a minimal JVM can be built with the --with-jvm-variants=minimal configuration flag, producing a JVM with compiler1 minimal opt-size serialgc capabilities.

      Specification

        product_pd(bool, NeverActAsServerClassMachine,                            \
                "(Deprecated) Never act like a server-class machine")             \
                                                                                  \
        product(bool, AlwaysActAsServerClassMachine, false,                       \
                "(Deprecated) Always act like a server-class machine")            \
      

            Assignee:
            Joel Sikström
            Reporter:
            Joel Sikström
            David Holmes, Stefan Karlsson, Thomas Schatzl, Vladimir Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: