-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: None
-
Component/s: hotspot
Flags passed via a settings file, either the default .hotspotrc or an explicit -XX:Flags argument, do not have the -XX: prefix when returned by JVM_GetVmArguments. This is problematic for anyone wanting to understand or use those flags, how does a user know which are -XX: flags and which aren't? One use-case would be to pass the JVM flags of the current JVM to a child process, but JVM_GetVmArguments cannot be passed as-is because of the missing prefix.
```flags.txt
-UseParallelGC
MaxHeapSize=1000000000
```
```Test.java
void main() {
IO.println(java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments());
}
```
```
java -XX:Flags=flags.txt -XX:+UseG1GC Test.java
[-UseParallelGC, MaxHeapSize=1000000000, -XX:Flags=flags.txt, -XX:+UseG1GC, --add-modules=ALL-DEFAULT]
```
The flags from flags.txt do not have -XX: prefix, but are mixed in with the command-line args which are prefixed. We should add the prefix in JVM_GetVmArguments, for user convenience.
This breaks:
JMH (tries to fork a VM passing the getInputArguments() result as command-line args to the child)
CDS static_dump - https://github.com/openjdk/jdk/blob/63f00fff921ed4ac0f595a0a013d399700433a2c/src/java.base/share/classes/jdk/internal/misc/CDS.java#L329-L338
```flags.txt
-UseParallelGC
MaxHeapSize=1000000000
```
```Test.java
void main() {
IO.println(java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments());
}
```
```
java -XX:Flags=flags.txt -XX:+UseG1GC Test.java
[-UseParallelGC, MaxHeapSize=1000000000, -XX:Flags=flags.txt, -XX:+UseG1GC, --add-modules=ALL-DEFAULT]
```
The flags from flags.txt do not have -XX: prefix, but are mixed in with the command-line args which are prefixed. We should add the prefix in JVM_GetVmArguments, for user convenience.
This breaks:
JMH (tries to fork a VM passing the getInputArguments() result as command-line args to the child)
CDS static_dump - https://github.com/openjdk/jdk/blob/63f00fff921ed4ac0f595a0a013d399700433a2c/src/java.base/share/classes/jdk/internal/misc/CDS.java#L329-L338
- links to
-
Review(master)
openjdk/jdk/29793