Skip to content

Commit 2f1bffd

Browse files
author
Bernard Horan
committed
[GR-55211] Update graal JIT compiler docs
PullRequest: graal/18252
2 parents 39d29e6 + 084bdf4 commit 2f1bffd

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

docs/reference-manual/java/Operations.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ The first thing to confirm when measuring performance is that the Java Virtual M
1414

1515
GraalVM is configured to use the Graal JIT compiler as the top tier compiler by default.
1616

17-
To enable the Graal JIT compiler for use in the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/22/vm/java-virtual-machine-technology-overview.html), use the `-XX:+UseGraalJIT` option.
17+
To enable the Graal JIT compiler for use in the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/23/vm/java-virtual-machine-technology-overview.html){:target="_blank"}, use the [`-XX:+UseGraalJIT`](https://download.java.net/java/early_access/jdk23/docs/specs/man/java.html#enabling-the-graal-jit-compiler){:target="_blank"} option.
1818
(The `-XX:+UseGraalJIT` option has to be used together with the `-XX:+UnlockExperimentalVMOptions` option that unlocks this experimental integration.)
19+
1920
The following example runs the Java application `com.example.myapp` with the Graal JIT compiler enabled:
2021

2122
```shell
@@ -33,18 +34,18 @@ Using "Graal Enterprise compiler with Truffle extensions" loaded from a PGO opti
3334
3435
Optimizing a JVM-based application is a science in itself.
3536
Compilation may not even be a factor in the case of poor performance as the problem may lie in any other part of the JVM (I/O, garbage collection, threading, and so on), or in a poorly written application, or third-party library code.
36-
For this reason, it is worth employing the [JDK Mission Control](https://www.oracle.com/java/technologies/jdk-mission-control.html) tool chain to diagnose your application's behavior.
37+
For this reason, it is worth employing the [JDK Mission Control](https://www.oracle.com/java/technologies/jdk-mission-control.html){:target="_blank"} toolchain to diagnose your application's behavior.
3738

3839
You can also compare performance against the native top-tier compiler in the JVM by adding `-XX:-UseJVMCICompiler` to the command line.
3940

4041
If you observe a significant performance regression when using the Graal JIT compiler, please open an issue on GitHub.
4142
Attach a Java Flight Recorder log and instructions to reproduce the issue—this makes investigation easier and thus increases the chances of a fix.
42-
Even better is if you can submit a [JMH](http://openjdk.java.net/projects/code-tools/jmh/) benchmark that represents the hottest parts of your application (as identified by a profiler).
43+
Even better is if you can submit a [JMH](http://openjdk.java.net/projects/code-tools/jmh/){:target="_blank"} benchmark that represents the hottest parts of your application (as identified by a profiler).
4344
This allows us to quickly pinpoint absent optimization opportunities or to provide suggestions on how to restructure your code to avoid or reduce performance bottlenecks.
4445

4546
## Troubleshooting the Graal JIT Compiler
4647

47-
If you spot a security vulnerability, please do **not** report it via GitHub Issues or the public mailing lists, but via the process outlined in the [Reporting Vulnerabilities guide](https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html).
48+
If you spot a security vulnerability, please do **not** report it via GitHub Issues or the public mailing lists, but via the process outlined in the [Reporting Vulnerabilities guide](https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html){:target="_blank"}.
4849

4950
### Compilation Exceptions
5051

@@ -57,7 +58,7 @@ In this case, just before the JVM exits, all diagnostic output captured during r
5758
Graal diagnostic output saved in /Users/demo/graal-dumps/1499768882600/graal_diagnostics_64565.zip
5859
```
5960

60-
You can then attach the ZIP file to an issue on [GitHub](https://github.com/oracle/graal/issues).
61+
You can then attach the ZIP file to an issue on [GitHub](https://github.com/oracle/graal/issues){:target="_blank"}.
6162

6263
As well as `Silent` and `Diagnose`, the following values for `graal.CompilationFailureAction` are available:
6364
* `Print`: prints a message and stack trace to the console but does not perform recompilation.
@@ -85,22 +86,22 @@ jdk.graal.compiler.core.gen.NodeLIRBuilder.matchComplexExpressions(Ljava/util/Li
8586

8687
The next two frames in the stack were interpreted (`j`).
8788
The location of the crash is also often indicated near the top of the file with something like this:
88-
```s
89+
```
8990
# Problematic frame:
9091
# J 761 JVMCI jdk.graal.compiler.core.gen.NodeLIRBuilder.matchComplexExpressions(Ljava/util/List;)V (299 bytes) @ 0x0000000108a2fc01 [0x0000000108a2fac0+0x141] (null)
9192
```
9293

9394
In this example, there is probably an error in the code produced by the Graal JIT compiler for `NodeLIRBuilder.matchComplexExpressions`.
9495

95-
When filing an issue on [GitHub](https://github.com/oracle/graal/issues) for such a crash, you should first attempt to reproduce the crash with extra diagnostics enabled for the compilation of the problematic method.
96+
When filing an issue on [GitHub](https://github.com/oracle/graal/issues){:target="_blank"} for such a crash, you should first attempt to reproduce the crash with extra diagnostics enabled for the compilation of the problematic method.
9697
In this example, you would add the following options to your command line:
9798
```shell
9899
-Djdk.graal.MethodFilter=NodeLIRBuilder.matchComplexExpressions, -Djdk.graal.Dump=:2
99100
```
100101

101-
These options are described in more detail [here](https://github.com/oracle/graal/blob/master/compiler/docs/Debugging.md).
102+
These options are described in more detail in the [compiler debugging documentation](https://github.com/oracle/graal/blob/master/compiler/docs/Debugging.md){:target="_blank"}.
102103
In brief, these options tell the Graal JIT compiler to capture snapshots of its state at verbosity level 2 while compiling any method named `matchComplexExpressions` in a class with a simple name of `NodeLIRBuilder`.
103-
The complete format of the `MethodFilter` option is described in [MethodFilterHelp.txt](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/doc-files/MethodFilterHelp.txt).
104+
The complete format of the `MethodFilter` option is described in [MethodFilterHelp.txt](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/doc-files/MethodFilterHelp.txt){:target="_blank"}.
104105

105106
Quite often, the crash location does not exist directly in the problematic method mentioned in the crash log but comes from an inlined method.
106107

@@ -148,7 +149,7 @@ ls -l /Users/demo/graal-dumps/1499768882600
148149
-rw-r--r-- 1 demo staff 12600725 Jul 13 11:46 HotSpotCompilation-791[NodeLIRBuilder.matchComplexExpressions(List)].bgv
149150
-rw-r--r-- 1 demo staff 1727409 Jul 13 11:46 HotSpotCompilation-791[NodeLIRBuilder.matchComplexExpressions(List)].cfg
150151
```
151-
You should attach a ZIP file of this directory to an issue on [GitHub](https://github.com/oracle/graal/issues).
152+
You should attach a ZIP file of this directory to an issue on [GitHub](https://github.com/oracle/graal/issues){:target="_blank"}.
152153

153154
### Related Documentation
154155

docs/reference-manual/java/Options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ To see the available configurations, supply the value `help` to this option.
5454
### Performance Tuning Options
5555

5656
* `-Djdk.graal.Vectorization={ true | false }`: To disable the auto vectorization optimization (only available in Oracle GraalVM). (Default: `true`.)
57-
* `-Djdk.graal.OptDuplication={ true | false }`: To disable the [path duplication optimization](http://ssw.jku.at/General/Staff/Leopoldseder/DBDS_CGO18_Preprint.pdf) (only available in Oracle GraalVM). (Default: `true`.)
57+
* `-Djdk.graal.OptDuplication={ true | false }`: To disable the [path duplication optimization](http://ssw.jku.at/General/Staff/Leopoldseder/DBDS_CGO18_Preprint.pdf){:target="_blank"} (only available in Oracle GraalVM). (Default: `true`.)
5858
* `-Djdk.graal.TuneInlinerExploration=<value>`: To tune for better peak performance or faster warmup.
5959
It automatically adjusts values governing the effort spent during inlining. The value of the option is a float clamped between `-1` and `1` inclusive. Anything below `0` reduces inlining effort and anything above `0` increases inlining effort. In general, peak performance is improved with more inlining effort while less inlining effort improves warmup (albeit to a lower peak). Note that this option is only a heuristic and the optimal value can differ from application to application (only available in Oracle GraalVM).
6060

docs/reference-manual/java/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ permalink: /reference-manual/java/
77

88
# GraalVM as a Java Virtual Machine
99

10-
GraalVM is based on the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/22/vm/java-virtual-machine-technology-overview.html), so any application that runs on the Java HotSpot Virtual Machine will also on GraalVM.
10+
GraalVM is based on the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/23/vm/java-virtual-machine-technology-overview.html), so any application that runs on the Java HotSpot Virtual Machine will also on GraalVM.
1111

1212
GraalVM includes an advanced compiler written in Java, known as the _Graal compiler_.
1313
At runtime, just like any other Java Virtual Machine (JVM), GraalVM loads an application and analyzes its code to detect performance bottlenecks, or _hot spots_.
1414
GraalVM passes the performance-critical code to the Graal just-in-time (JIT) compiler, which compiles it to machine code and then returns it.
1515

1616
The Graal compiler can improve the efficiency and the speed of applications written in Java, Scala, Kotlin, or other JVM languages through its unique approaches to code analysis and optimization.
1717
For example, it assures performance advantages for highly-abstracted applications due to its ability to remove costly object allocations.
18-
For more information, see the [platform-independent compiler optimizations in GraalVM Community Edition](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/CEOptimization.java){:target="_blank"}.
18+
See the [`CEOptimization enum`](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/CEOptimization.java){:target="_blank"} in the GraalVM Community Edition GitHub repository for more information about platform-independent compiler optimizations.
1919

20-
> The Graal (JIT) compiler is now also integrated with the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/22/vm/java-virtual-machine-technology-overview.html).
21-
To find out more, see [Graal Compiler](compiler.md).
20+
> The Graal (JIT) compiler is now also integrated with the Java HotSpot Virtual Machine.
21+
To find out more, see the section [Graal Compiler](compiler.md).
2222

2323
## Interoperability
2424

2525
GraalVM also includes the [Truffle language implementation framework](../../../truffle/docs/README.md)&mdash;a library, written in Java&mdash;to build interpreters for programming languages, which then run on GraalVM.
2626
These "Graal languages" can consequently benefit from the optimization possibilities of the Graal compiler.
2727
The pipeline for such compilation is:
2828

29-
* The Truffle framework code and data (Abstract Syntax Trees) is partially evaluated to produce a compilation graph. When such an Abstract Syntax Tree (AST) is "hot" (that is, called many times), it is scheduled for compilation by the compiler.
30-
* The compilation graph is optimized by the Graal compiler to produce machine code.
31-
* JVMCI installs this machine code in the JVM's code cache.
32-
* The AST will automatically redirect execution to the installed machine code once it is available.
29+
1. The Truffle framework code and data represented by Abstract Syntax Trees (ASTs) are partially evaluated to produce a compilation graph. When such an AST is "hot" (that is, called many times), it is scheduled for compilation by the compiler.
30+
2. The compilation graph is optimized by the Graal compiler to produce machine code.
31+
3. JVMCI installs this machine code in the JVM's code cache.
32+
4. The AST will automatically redirect execution to the installed machine code once it is available.
3333

3434
See the [Polyglot Programming](../polyglot-programming.md) and [Embedding Languages](../embedding/embed-languages.md) guides for more information about interoperability with other programming languages.
3535

3636
## Ahead-of-time Compilation
3737

38-
Besides the Truffle framework, GraalVM incorporates its compiler into an advanced ahead-of-time (AOT) compilation technology&mdash;[Native Image](../native-image/README.md)&mdash;which translates Java and JVM-based code into a native platform executable.
38+
Besides the Truffle framework, GraalVM incorporates its compiler into an advanced ahead-of-time (AOT) compilation technology&mdash;Native Image&mdash;which translates Java and JVM-based code into a native platform executable.
3939
These native executables start nearly instantaneously, are smaller, and consume less resources than their JVM counterparts, making them ideal for cloud deployments and microservices.
4040
For more information about AOT compilation, see [Native Image](../native-image/README.md).
4141

@@ -45,3 +45,4 @@ For more information about AOT compilation, see [Native Image](../native-image/R
4545
- [Graal JIT Compiler Configuration](Options.md)
4646
- [Graal JIT Compiler Operations Manual](Operations.md)
4747
- [Native Image](../native-image/README.md)
48+
- [JDK tool reference](https://docs.oracle.com/pls/topic/lookup?ctx=javase23&id=java_tool_reference){:target="_blank"}

docs/reference-manual/java/compiler.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@ redirect_from: /reference-manual/compiler/
99
# Graal Compiler
1010

1111
The Graal compiler is a dynamic compiler, written in Java, that transforms bytecode into machine code.
12-
The Graal just-in-time (JIT) compiler is integrated with the [Java HotSpot Virtual Machine](https://docs.oracle.com/en/java/javase/22/vm/java-virtual-machine-technology-overview.html) and [GraalVM](README.md).
13-
(The open source code of the Graal JIT compiler is available on [GitHub](https://github.com/oracle/graal/tree/master/compiler).)
14-
12+
The Graal just-in-time (JIT) compiler is integrated with the Java HotSpot Virtual Machine and GraalVM.
13+
See [Java Virtual Machine Guide](https://docs.oracle.com/en/java/javase/23/vm/java-virtual-machine-technology-overview.html){:target="_blank"} and the section [GraalVM as a Virtual Machine](README.md) for more information.
14+
(The open source code of the Graal JIT compiler is available on [GitHub](https://github.com/oracle/graal/tree/master/compiler){:target="_blank"}.)
1515

1616
## Compiler Advantages
1717

1818
The Graal JIT compiler provides optimized performance for applications running on a Java Virtual Machine (JVM) through unique approaches to code analysis and optimization.
1919
It includes multiple optimization algorithms (called “Phases”), such as aggressive inlining, polymorphic inlining, and others.
2020

21-
<!--
22-
Add an anchor so that the JPG docs can link to a section on partial escape analysis.
23-
-->
2421
<a id="partial-escape-analysis"></a>
25-
The Graal compiler can bring performance advantages for highly-abstracted programs.
26-
For example, it includes a [partial-escape-analysis optimization](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/CEOptimization.java#L176){:target="_blank"} that can remove the costly allocations of certain objects.
22+
The Graal compiler can bring performance advantages for highly-abstracted programs.
23+
For example, it includes a partial-escape-analysis optimization that can remove the costly allocations of certain objects.
24+
See the value [`PartialEscapeAnalysis`](https://github.com/oracle/graal/blob/master/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/phases/CEOptimization.java#L176){:target="_blank"} in the `CEOptimization enum` in the GraalVM GitHub repository for more information.
2725
The optimization determines when a new object is accessible outside a compilation unit and only allocates it on paths that "escape" the compilation unit (for example, if the object is passed as a parameter, stored in a field, or returned from a method).
2826
This approach can greatly improve the performance of an application by reducing the number of heap allocations.
2927
Code that uses more modern Java features such as Streams or Lambdas will see greater improvements in performance as this type of code involves a significant number of such non- or partially-escaping objects.
@@ -32,7 +30,8 @@ For more information on performance tuning, refer to [Graal JIT Compiler Configu
3230

3331
## Graph Compilation
3432

35-
To run guest programming languages (namely JavaScript, Python, and Ruby) in the same runtime as the host JVM-based language, the compiler works with a language-independent intermediate graph representation between the source language and the machine code to be generated. (For more information on language interoperability, see [Interoperability](README.md#interoperability).)
33+
To run guest programming languages (namely JavaScript, Python, and Ruby) in the same runtime as the host JVM-based language, the compiler works with a language-independent intermediate graph representation between the source language and the machine code to be generated.
34+
(For more information on language interoperability, see [Interoperability](README.md#interoperability).)
3635

3736
The graph can represent similar statements of different languages in the same way, such as "if" statements or loops, which makes it possible to mix languages in the same application.
3837
The Graal compiler can then perform language-independent optimization and generate machine code on this graph.

0 commit comments

Comments
 (0)