Skip to content

Commit

Permalink
Merge pull request #1470 from Sreekala-Gopakumar/1392XXMergeCompil
Browse files Browse the repository at this point in the history
Updated the documentation for -XX:+MergeCompilerOptions
  • Loading branch information
mpirvu authored Jan 14, 2025
2 parents 2e4e14c + 6c966a5 commit 8eeb8bc
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions docs/xxmergecompileroptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ This option enables or disables the merging of multiple `-Xjit` or `-Xaot` optio

## Explanation

By default, if you specify `-Xjit` option (or `-Xaot` option) multiple times, only the last option takes effect. Therefore, on adding an `-Xjit` option, the resultant behavior might not be as expected, if any instance of this option already exists. It is time-consuming to find the existing instances and try combining them manually so that the system behaves as required.
By default, if you specify `-Xjit` option (or `-Xaot` option) multiple times, only the last option takes effect. Therefore, on adding an `-Xjit` option, the resultant behavior might not be as expected, if any instance of this option already exists. It is time-consuming to find the existing instances and try combining them manually so that the system behaves as required.

You can use the `-XX:+MergeCompilerOptions` option to merge all the existing instances of the `-Xjit` options logically. To retain the default behavior, whereby only the last option takes effect, you can use the `-XX:-MergeCompilerOptions` option.
You can use the `-XX:+MergeCompilerOptions` option to merge all the existing instances of the `-Xjit` options (or `-Xaot` options) logically. To retain the default behavior, whereby only the last option takes effect, you can use the `-XX:-MergeCompilerOptions` option.

If both `-Xjit` and `-Xaot` options exist and you use the `-XX:+MergeCompilerOptions` option, then multiple `-Xjit` options are merged into a single `-Xjit` option and multiple `-Xaot` options are merged into a single `-Xaot` option.
If both `-Xjit` and `-Xaot` options exist and you use the `-XX:+MergeCompilerOptions` option, then multiple `-Xjit` options are merged into a single `-Xjit` option and multiple `-Xaot` options are merged into a single `-Xaot` option.

Typically, `-Xjit` and `-Xaot` options are ignored if these options are followed by `-Xint` or `-Xnojit` or `-Xnoaot` options:

- `-Xint` option overrides any `-Xjit` and `-Xaot` options
- `-Xnojit` option overrides `-Xjit` options
- `-Xnoaot` option overrides `-Xaot` options

However, with `-XX:+MergeCompilerOptions` all `-Xjit` and `-Xaot` options are merged, even if those options are followed by `-Xint`, `-Xnojit`, or `-Xnoaot` options. At least one `-Xjit` or `-Xaot` option must be specified after these options.

## Examples

Expand Down Expand Up @@ -90,7 +98,24 @@ java -XX:+MergeCompilerOptions -XX:-MergeCompilerOptions -Xshareclasses:none '-X
```
java -XX:-MergeCompilerOptions -XX:+MergeCompilerOptions -Xshareclasses:none '-Xjit:verbose={compilePerformance},vlog=vlog' -Xjit:version -version
```
`-Xjit` options that are applied - `{compilePerformance}`,`vlog=vlog`,`version`
`-Xjit` options that are applied - `verbose={compilePerformance}`,`vlog=vlog`,`version`

### `-Xnojit`, `-Xnoaot`, or `-Xint` options with and without `-XX:+MergeCompilerOptions`

```
java -Xshareclasses:none -Xjit:version -Xnojit -version
```
No `-Xjit` option is applied

```
java -XX:+MergeCompilerOptions -Xshareclasses:none -Xjit:verbose={compilePerformance} -Xjit:vlog=vlog -Xint -Xjit:version -version
```
`-Xjit` options that are applied - `verbose={compilePerformance}`,`vlog=vlog`,`version`

```
java -XX:+MergeCompilerOptions -Xshareclasses:none -Xjit:version -Xnojit -version
```
No `-Xjit` option is applied because no `-Xjit` option is specified after the `-Xnojit` option

## See also

Expand Down

0 comments on commit 8eeb8bc

Please sign in to comment.