JDK-8279195 : Document the -XX:+NeverActAsServerClassMachine flag
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-12-23
  • Updated: 2021-12-27
  • Resolved: 2021-12-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18 JDK 19
18 masterFixed 19Fixed
Related Reports
Relates :  
Description
This product flag provides a way to emulate the old "client VM" but has never been documented in the java command reference (aka manpage). It should be documented.

As a doc fix this can be targeted to 18 right up to RC stage.
Comments
Changeset: 2945b786 Author: Vladimir Kozlov <kvn@openjdk.org> Date: 2021-12-24 22:32:16 +0000 URL: https://git.openjdk.java.net/jdk18/commit/2945b786ba6b60cc33153bb1d40ac7a0918dadbe
24-12-2021

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk18/pull/71 Date: 2021-12-24 01:34:42 +0000
24-12-2021

Final text: Enable the "Client VM emulation" mode which only uses the C1 JIT compiler, a 32Mb CodeCache and the Serial GC. The maximum amount of memory that the JVM may use (controlled by the -XX:MaxRAM=n flag) is set to 1GB by default. The string "emulated-client" is added to the JVM version string. By default the flag is set to `true` only on Windows in 32-bit mode and `false` in all other cases. The "Client VM emulation" mode will not be enabled if any of the following flags are used on the command line: -XX:{+|-}TieredCompilation, -XX:CompilationMode=s, -XX:TieredStopAtLevel=n, -XX:{+|-}EnableJVMCI, XX:{+|-}UseJVMCICompiler.
24-12-2021

I assigned it to myself to update java man page in our sources.
24-12-2021

[~kvn] Okay so I was reading things as if 1G was an absolute hard limit, but it seems that is just the default in Client VM emulation mode. Also it affects all memory not just Java heap. In which case I suggest: The maximum amount of memory that the JVM may use (controlled by the -XX:MaxRAM=n flag) is set to 1GB by default.
23-12-2021

Q: Is -XX:MaxRAM the same as -Xmx? Does this mean that if you specify MaxRAM=2G you will get an error, or will it just disable Client VM emulation mode? MaxRAM sets physical memory size limit available to VM. It is used to set default value for MaxHeapSize (-Xmx) as fraction of the limit: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1689 Changing MaxRAM does not disable Client VM emulation: $ java -XX:+NeverActAsServerClassMachine -XX:MaxRAM=4G -Xlog:gc -version [0.019s][info][gc] Using Serial java version "19-internal" 2022-09-20 Java(TM) SE Runtime Environment (fastdebug build 19-internal+0-2021-12-14-0248174.vkozlov...) Java HotSpot(TM) 64-Bit Server VM (fastdebug build 19-internal+0-2021-12-14-0248174.vkozlov..., mixed mode, emulated-client, sharing) Q: Does any use of those JIT flags disable it, regardless of the flags value? Yes, any of listed flags regadless +/-/value disable Client VM emulation. For simplicity we just check if any of these flags are changed (not default): https://github.com/openjdk/jdk/blob/master/src/hotspot/share/compiler/compilerDefinitions.cpp#L202
23-12-2021

Thanks [~kvn]. Needs some minor grammatical editing: Enable the "Client VM emulation" mode which only uses the C1 JIT compiler, a 32Mb CodeCache and the Serial GC. The maximum amount of memory that the JVM may use for the Java heap (controlled by -XX:MaxRAM=n flag) is set to 1GB. The string "emulated-client" is added to the JVM version string. By default the flag is set to `true` only on Windows in 32-bit mode and `false` in all other cases. The "Client VM emulation" mode will not be enabled if any of the following flags are used on the command line: -XX:{+|-}TieredCompilation, -XX:CompilationMode=s, -XX:TieredStopAtLevel=n, -XX:{+|-}EnableJVMCI, XX:{+|-}UseJVMCICompiler. Q: Is -XX:MaxRAM the same as -Xmx? Does this mean that if you specify MaxRAM=2G you will get an error, or will it just disable Client VM emulation mode? Q: Does any use of those JIT flags disable it, regardless of the flags value?
23-12-2021

[~dholmes] please review the text.
23-12-2021

Proposed text: -XX:+NeverActAsServerClassMachine Enable the Client VM emulation which only uses the C1 JIT compiler, 32Mb CodeCache and Serial GC. Maximum amount of memory that the JVM may use for the Java heap (controlled by -XX:MaxRAM=n flag) is set to 1GB. The string "emulated-client" is added to the JVM version string. By default the flag is set to `true` only on Windows in 32-bit mode and `false` in all other cases. The Client VM emulation will not be enabled if following flags are used on command line: -XX:{+|-}TieredCompilation, -XX:CompilationMode=s, -XX:TieredStopAtLevel=n, -XX:{+|-}EnableJVMCI, XX:{+|-}UseJVMCICompiler.
23-12-2021