You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/RunOnJDK.md
+16-35Lines changed: 16 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,60 +10,41 @@ GraalVM JavaScript is optimized for execution as part of GraalVM, or in an embed
10
10
This guarantees best possible performance by using the [GraalVM compiler](https://github.com/oracle/graal) as the optimizing compiler, and potentially [Native Image](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/README.md) to ahead-of-time compile the engine into a native binary.
11
11
12
12
As GraalVM JavaScript is a Java application, it is possible to execute it on a stock Java VM like OpenJDK.
13
-
When executed without the GraalVM compiler, JavaScript performance will be significantly worse.
13
+
When executed without the Graal Compiler, JavaScript performance will be significantly worse.
14
14
While the JIT compilers available on stock JVMs can execute and JIT-compile the GraalVM JavaScript codebase, they cannot optimize it to its full performance potential.
15
15
This document describes how to run GraalVM JavaScript on stock Java VMs, and shows how you can use the GraalVM compiler as a JIT compiler to guarantee the best possible performance.
16
16
17
17
## GraalVM JavaScript on Maven Central
18
18
GraalVM JavaScript is open source and regularly pushed to Maven Central Repository by the community.
19
-
You can find it as package [org.graalvm.js](https://mvnrepository.com/artifact/org.graalvm.js/js).
19
+
You can find it as pom artifact [org.graalvm.polyglot:js](https://mvnrepository.com/artifact/org.graalvm.polyglot/js).
20
20
21
-
There is an example Maven project for GraalVM JavaScript on JDK11 (or later) using the GraalVM compiler at [graal-js-jdk11-maven-demo](https://github.com/graalvm/graal-js-jdk11-maven-demo).
22
-
The example contains a Maven project for a JavaScript benchmark (a prime number generator).
21
+
There are example Maven projects for GraalVM JavaScript on JDK21 (or later) using the Graal compiler:
This example contains a Maven project for a JavaScript benchmark (a prime number generator).
23
26
It allows a user to compare the performance of GraalVM JavaScript running with or without the GraalVM compiler as the optimizing compiler.
24
-
Running with the GraalVM compiler will siginificantly improve the execution performance of any relatively large JavaScript codebase.
27
+
Running with the GraalVM compiler will significantly improve the execution performance of any relatively large JavaScript codebase.
25
28
26
-
In essence, the example POM file activates JVMCI to install additional JIT compilers, and configures the JIT compiler to be the GraalVM compiler by providing it on `--module-path` and `--upgrade-module-path`.
27
-
28
-
## GraalVM JavaScript on JDK 11+
29
-
The Maven example given above is the preferred way to start on JDK 11 (or newer).
30
-
Working without Maven, you can provide the JAR files manually to the `java` command.
31
-
Using `--upgrade-module-path` executes GraalVM JavaScript with the GraalVM compiler, guaranteeing the best performance.
32
-
The GraalVM JAR files can be downloaded from [org.graalvm at Maven](https://mvnrepository.com/artifact/org.graalvm), and the ICU4J library from [org.ibm.icu at Maven](https://mvnrepository.com/artifact/com.ibm.icu/icu4j).
To start a Java application instead and launch GraalVM JavaScript via GraalVM SDK's `Context` (encouraged) or a `ScriptEngine` (supported, but discouraged), _launcher-common-*.jar_ and _js-launcher-*.jar_ can be omitted.
29
+
In essence, the example `pom.xml` file activates JVMCI to install additional JIT compilers, and configures the JIT compiler to be the Graal Compiler by providing it on `--module-path` and `--upgrade-module-path`.
49
30
50
31
### ScriptEngine JSR 223
51
-
GraalVM JavaScript can be started via `ScriptEngine` when _js-scriptengine.jar_ is included on the classpath.
52
-
The engine registers under several different names, e.g.,`Graal.js`.
53
-
Note that the Nashorn engine might be available under its names as well, if available on the JDK.
32
+
GraalVM JavaScript can be started via `ScriptEngine` when _js-scriptengine.jar_ is included on the module path.
33
+
The engine registers under several different names, including`Graal.js`, `js`, `JavaScript`, and `javascript`.
34
+
Note that the Nashorn engine might be available under its names as well, if on the module path.
54
35
55
36
To start GraalVM JavaScript from `ScriptEngine`, the following code can be used:
0 commit comments