Fixes + addition of existing configuration state
This commit is contained in:
parent
2f66877cbc
commit
efd3a526aa
1 changed files with 124 additions and 19 deletions
143
Runtimes.md
143
Runtimes.md
|
@ -9,17 +9,17 @@ The complete shape of the system is undecided at this point.
|
|||
Format decisions should aim for future extensibility - don't close doors that don't need to be closed forever.
|
||||
|
||||
## Runtime references
|
||||
Runtime references are used in version metadata files
|
||||
Runtime references would be used in version metadata files.
|
||||
Along those, a hierarchy of options / variable defaults
|
||||
|
||||
Currently, vanilla hardcodes these for `x86`:
|
||||
```
|
||||
-Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
|
||||
-Xmx800M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M
|
||||
```
|
||||
|
||||
And these for `amd64`:
|
||||
```
|
||||
-Xmx800M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M
|
||||
-Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
|
||||
```
|
||||
|
||||
### Runtime reference in version metadata
|
||||
|
@ -137,9 +137,9 @@ On launch, we would load the piston index and runtime metadata files from local
|
|||
{
|
||||
"majorVersion": 7,
|
||||
"managedArgs": {
|
||||
"minHeap": "-Xms ${value}m",
|
||||
"maxHeap": "-Xmx ${value}m",
|
||||
"minStack": "-Xss ${value}m",
|
||||
"minHeap": "-Xms${value}m",
|
||||
"maxHeap": "-Xmx${value}m",
|
||||
"minStack": "-Xss${value}m",
|
||||
"permSize": "-XX:PermSize=${value}m",
|
||||
"startOnFirstThread": "-XstartOnFirstThread"
|
||||
},
|
||||
|
@ -155,9 +155,9 @@ On launch, we would load the piston index and runtime metadata files from local
|
|||
"majorVersion": 8,
|
||||
"pistonComponent": "jre-legacy",
|
||||
"managedArgs": {
|
||||
"minHeap": "-Xms ${value}M",
|
||||
"maxHeap": "-Xmx ${value}M",
|
||||
"minStack": "-Xss ${value}M",
|
||||
"minHeap": "-Xms${value}M",
|
||||
"maxHeap": "-Xmx${value}M",
|
||||
"minStack": "-Xss${value}M",
|
||||
"startOnFirstThread": "-XstartOnFirstThread"
|
||||
},
|
||||
"hardArgs": [
|
||||
|
@ -172,9 +172,9 @@ On launch, we would load the piston index and runtime metadata files from local
|
|||
"majorVersion": 16,
|
||||
"pistonComponent": "java-runtime-alpha",
|
||||
"managedArgs": {
|
||||
"minHeap": "-Xms ${value}m",
|
||||
"maxHeap": "-Xmx ${value}m",
|
||||
"minStack": "-Xss ${value}m",
|
||||
"minHeap": "-Xms${value}m",
|
||||
"maxHeap": "-Xmx${value}m",
|
||||
"minStack": "-Xss${value}m",
|
||||
"startOnFirstThread": "-XstartOnFirstThread"
|
||||
},
|
||||
"hardArgs": [
|
||||
|
@ -185,9 +185,9 @@ On launch, we would load the piston index and runtime metadata files from local
|
|||
"majorVersion": 17,
|
||||
"pistonComponent": "java-runtime-beta",
|
||||
"managedArgs": {
|
||||
"minHeap": "-Xms ${value}m",
|
||||
"maxHeap": "-Xmx ${value}m",
|
||||
"minStack": "-Xss ${value}m",
|
||||
"minHeap": "-Xms${value}m",
|
||||
"maxHeap": "-Xmx${value}m",
|
||||
"minStack": "-Xss${value}m",
|
||||
"startOnFirstThread": "-XstartOnFirstThread"
|
||||
},
|
||||
"hardArgs": [
|
||||
|
@ -202,18 +202,123 @@ Args from a major version propagate to any higher version that lacks a definitio
|
|||
|
||||
So, for example, when JRE overrides are enabled:
|
||||
- User selects system Java 7.
|
||||
- Only hardcoded args are used.
|
||||
- Args from `7` are used.
|
||||
|
||||
- User selects system Java 11.
|
||||
- Args from `8` and hardcoded args are used.
|
||||
- Args from `8` are used.
|
||||
|
||||
- User selects system Java 18.
|
||||
- Args from `17` and hardcoded args are used.
|
||||
- Args from `17` are used.
|
||||
|
||||
`managedArgs` are managed by MultiMC and not directly visible to the user. They depend on the left hand side (variable by name) being set in order to be passed to Java. If there is no defined value of `minHeap`, `-Xms ${value}m` is not passed to the JRE.
|
||||
Java older than 7 will not be supported (Java code in MultiMC is built for Java 7 at the minimum). When detected, we will simply present an error.
|
||||
|
||||
`managedArgs` are managed by MultiMC and not directly visible to the user. They depend on the left hand side (variable by name) being set in order to be passed to Java. If there is no defined value of `minHeap`, `-Xms${value}m` is not passed to the JRE.
|
||||
|
||||
`startOnFirstThread` is then only specified on macOS, and replaces the current trait-based logic.
|
||||
|
||||
`hardArgs` are hardcoded, but do show up in the UI as 'default'/'ghost' and can be customized. Variables can be substituted into hardcoded args (like `heapRegionSize` for G1GC).
|
||||
|
||||
How the values for the variables are determined is internal to MultiMC and tuned to work well on all machines over time.
|
||||
|
||||
## Java settings in MultiMC
|
||||
|
||||
Existing Java settings in MultiMC have two layers -- global and per-instance.
|
||||
|
||||
The settings poorly accomodate resolving which Java to use, and/or determining the heap size and other java args dynamically.
|
||||
|
||||
For best user experience, the JRE settings should never have to be touched.
|
||||
|
||||
### Global settings
|
||||
|
||||
These affect every instance, unless overriden, and are present in `multimc.cfg`:
|
||||
```
|
||||
JavaArchitecture=64
|
||||
JavaPath=java
|
||||
JavaTimestamp=1635003862000
|
||||
JavaVersion=17.0.1
|
||||
JvmArgs=-verbose:gc
|
||||
LastHostname=peterix
|
||||
MaxMemAlloc=8192
|
||||
MinMemAlloc=4096
|
||||
PermGen=128
|
||||
```
|
||||
|
||||
This allows only selecting one version of Java tied to one specificy JRE binary.
|
||||
|
||||
**Caching:**
|
||||
When going between machines, or when the selected Java runtime disappears/changes, MultiMC asks you which Java to use again.
|
||||
|
||||
These variables stored in global settings are used to support that functionality.
|
||||
|
||||
- `JavaArchitecture` records the selected JRE's CPU architecture.
|
||||
- `JavaTimestamp` records the last changed timestamp of the selected JRE's binary.
|
||||
- `JavaVersion` records the selected JRE's version.
|
||||
- `LastHostname` is used as a factor to pop up the JRE selection wizard.
|
||||
|
||||
**Actual options:**
|
||||
- `JavaPath` is an absolute or relative path to the JRE binary. MultiMC can use a JRE stored in its data folder via the relative path, making it slightly more portable.
|
||||
- `JvmArgs` are extra args added to the JRE args, by default empty.
|
||||
- `MinMemAlloc` directly translates to minimum heap size (`-Xms${value}m` argument).
|
||||
- `MinMemAlloc` directly translates to maximum heap size (`-Xmx${value}m` argument).
|
||||
- `PermGen` directly translates to Java 7 and older 'Permanent Generation' size (`-Xmx${value}m` argument).
|
||||
|
||||
The default for PermGen in MultiMC is 128m.
|
||||
|
||||
```
|
||||
if (permgen != 64)
|
||||
{
|
||||
args << QString("-XX:PermSize=%1m").arg(permgen);
|
||||
}
|
||||
```
|
||||
|
||||
### Per-Instance settings
|
||||
|
||||
Per-instance settings mirror the global settings, but need to be toggled on with override settings.
|
||||
|
||||
With `OverrideLocation`, the instance uses its own Java runtime:
|
||||
```
|
||||
OverrideJavaLocation=true
|
||||
JavaPath=/usr/lib/jvm/java-17-openjdk/bin/java
|
||||
JavaArchitecture=64
|
||||
JavaTimestamp=1635003862000
|
||||
JavaVersion=17.0.1
|
||||
```
|
||||
|
||||
With `OverrideMemory`, the instance will start with different memory amounts than specified in global settings:
|
||||
```
|
||||
OverrideMemory=true
|
||||
MaxMemAlloc=8192
|
||||
MinMemAlloc=4096
|
||||
PermGen=128
|
||||
```
|
||||
|
||||
With `OverrideJavaArgs`, the instance has its own extra runtime arguments (they are **not combined** with global):
|
||||
```
|
||||
OverrideJavaArgs=true
|
||||
JvmArgs=-verbose:gc
|
||||
```
|
||||
|
||||
There is also a legacy setting that overrides both location and args, but not memory.
|
||||
|
||||
This:
|
||||
```
|
||||
OverrideJava=true
|
||||
JavaPath=/usr/lib/jvm/java-17-openjdk/bin/java
|
||||
JavaArchitecture=64
|
||||
JavaTimestamp=1635003862000
|
||||
JavaVersion=17.0.1
|
||||
JvmArgs=-verbose:gc
|
||||
```
|
||||
|
||||
Is equivalent to this:
|
||||
```
|
||||
OverrideJavaArgs=true
|
||||
OverrideJavaLocation=true
|
||||
JavaPath=/usr/lib/jvm/java-17-openjdk/bin/java
|
||||
JavaArchitecture=64
|
||||
JavaTimestamp=1635003862000
|
||||
JavaVersion=17.0.1
|
||||
JvmArgs=-verbose:gc
|
||||
```
|
||||
|
||||
The `OverrideJava` turns into `OverrideJavaArgs` and `OverrideJavaLocation` on instance settings save.
|
||||
|
|
Loading…
Reference in a new issue