From 016ee7ac562e210aeca419f9d835664b800f8bbb Mon Sep 17 00:00:00 2001 From: Marouane el hallaoui Date: Thu, 13 Jan 2022 16:16:18 +0100 Subject: [PATCH 01/12] patched builds for CE 11 --- common.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.json b/common.json index cd15bec3bcaa..48a248136e1a 100644 --- a/common.json +++ b/common.json @@ -8,8 +8,8 @@ "openjdk11": {"name": "openjdk", "version": "11.0.11+9", "platformspecific": true }, "oraclejdk11": {"name": "oraclejdk", "version": "11.0.11+9", "platformspecific": true }, - "labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.14+8-jvmci-22.0-b03", "platformspecific": true }, - "labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.14+8-jvmci-22.0-b03-sulong", "platformspecific": true }, + "labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04-20211228204229-me_GR_34639-master-bb74398a05_70cd4b3d2f", "platformspecific": true }, + "labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04-20211228204229-me_GR_34639-master-bb74398a05_70cd4b3d2f-sulong", "platformspecific": true }, "labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.14+8-jvmci-22.0-b03", "platformspecific": true }, "labsjdk-ee-11-llvm": {"name": "labsjdk", "version": "ee-11.0.14+8-jvmci-22.0-b03-sulong", "platformspecific": true }, From a62b0a8b558a7d50679e07fae76c3c9c66eb1e05 Mon Sep 17 00:00:00 2001 From: Marouane el hallaoui Date: Fri, 14 Jan 2022 14:52:27 +0100 Subject: [PATCH 02/12] promot ce 11 patched builds --- common.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.json b/common.json index 48a248136e1a..c6f36b3950b3 100644 --- a/common.json +++ b/common.json @@ -8,8 +8,8 @@ "openjdk11": {"name": "openjdk", "version": "11.0.11+9", "platformspecific": true }, "oraclejdk11": {"name": "oraclejdk", "version": "11.0.11+9", "platformspecific": true }, - "labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04-20211228204229-me_GR_34639-master-bb74398a05_70cd4b3d2f", "platformspecific": true }, - "labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04-20211228204229-me_GR_34639-master-bb74398a05_70cd4b3d2f-sulong", "platformspecific": true }, + "labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04", "platformspecific": true }, + "labsjdk-ce-11-llvm": {"name": "labsjdk", "version": "ce-11.0.14+9-jvmci-22.0-b04-sulong", "platformspecific": true }, "labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.14+8-jvmci-22.0-b03", "platformspecific": true }, "labsjdk-ee-11-llvm": {"name": "labsjdk", "version": "ee-11.0.14+8-jvmci-22.0-b03-sulong", "platformspecific": true }, From 8f9922887536ae951d382968b4ebfa1eb050e281 Mon Sep 17 00:00:00 2001 From: Olga Gupalo Date: Fri, 14 Jan 2022 18:04:48 +0200 Subject: [PATCH 03/12] Backport Text and versions updates for 22.0 release PR to this branch --- .../architecture-overview.md | 20 +- docs/examples/java-kotlin-aot.md | 21 +- docs/examples/java-performance-examples.md | 12 +- docs/examples/java-simple-stream-benchmark.md | 8 +- .../graalvm-ce-container-images.md | 50 +- .../get-started-graalvm-community.md | 38 +- .../graalvm-community/linux.md | 4 +- .../graalvm-community/macos.md | 4 +- .../get-started-graalvm-enterprise.md | 60 +- .../installation-linux-aarch64.md | 4 +- .../graalvm-enterprise/installation-linux.md | 6 +- .../graalvm-enterprise/installation-macos.md | 6 +- .../installation-windows.md | 4 +- .../implement-instrument.md | 2 +- .../implement-language.md | 6 +- docs/guides/guides.md | 2 +- docs/introduction.md | 14 +- .../embedding/embed-languages.md | 93 +- docs/reference-manual/graalvm-updater.md | 22 +- .../reference-manual/java-on-truffle/Demos.md | 41 +- .../java-on-truffle/README.md | 9 +- docs/reference-manual/java/Operations.md | 20 +- docs/reference-manual/java/Options.md | 14 +- docs/reference-manual/java/README.md | 15 +- docs/reference-manual/{ => java}/compiler.md | 47 +- docs/reference-manual/languages.md | 1 - docs/reference-manual/llvm/Compatibility.md | 6 +- docs/reference-manual/llvm/README.md | 2 +- docs/reference-manual/native-image/Agent.md | 2 +- .../native-image/DynamicProxy.md | 15 +- .../native-image/HostedvsRuntimeOptions.md | 2 +- .../native-image/LLVMBackend.md | 4 +- docs/reference-manual/polyglot-programming.md | 16 +- docs/reference-manual/reference-manuals.md | 5 +- docs/reference-manual/wasm/README.md | 4 +- docs/tools/insight/Insight-Embedding.md | 135 +++ docs/tools/insight/Insight-Manual.md | 817 ++++++++++++++++++ docs/tools/insight/Insight-Tracing.md | 178 ++++ docs/tools/insight/Insight.md | 65 ++ .../{graalvm-insight.md => insight/README.md} | 35 +- .../tools/insight/img/Insight-HeapInspect.png | Bin 0 -> 55054 bytes docs/tools/insight/img/Insight-HeapStack.png | Bin 0 -> 10183 bytes docs/tools/insight/img/Insight-Jaeger.png | Bin 0 -> 460133 bytes docs/tools/tools.md | 10 +- docs/tools/vscode/graalvm/README.md | 2 +- 45 files changed, 1569 insertions(+), 252 deletions(-) rename docs/reference-manual/{ => java}/compiler.md (64%) create mode 100644 docs/tools/insight/Insight-Embedding.md create mode 100644 docs/tools/insight/Insight-Manual.md create mode 100644 docs/tools/insight/Insight-Tracing.md create mode 100644 docs/tools/insight/Insight.md rename docs/tools/{graalvm-insight.md => insight/README.md} (80%) create mode 100644 docs/tools/insight/img/Insight-HeapInspect.png create mode 100644 docs/tools/insight/img/Insight-HeapStack.png create mode 100644 docs/tools/insight/img/Insight-Jaeger.png diff --git a/docs/enterprise-overview/architecture-overview.md b/docs/enterprise-overview/architecture-overview.md index 098b15a99810..9bf960ae98e8 100644 --- a/docs/enterprise-overview/architecture-overview.md +++ b/docs/enterprise-overview/architecture-overview.md @@ -29,7 +29,7 @@ The conceptual overview and advantages of GraalVM Enterprise are described on th The preceding diagram illustrates a complete high-level architecture of GraalVM Enterprise. -GraalVM adds an [advanced just-in-time (JIT) optimizing compiler](../reference-manual/compiler.md), which is written in Java, to the HotSpot Java Virtual Machine. +GraalVM adds an [advanced just-in-time (JIT) optimizing compiler](../reference-manual/java/compiler.md), which is written in Java, to the HotSpot Java Virtual Machine. In addition to running Java and JVM-based languages, [GraalVM's language implementation framework (Truffle)](../../truffle/docs/README.md), makes it possible to run JavaScript, Ruby, Python, and a number of other popular languages on the JVM. With Truffle, Java and other supported languages can directly interoperate with each other and pass data back and forth in the same memory space. @@ -39,7 +39,7 @@ With Truffle, Java and other supported languages can directly interoperate with GraalVM Enterprise is unique as a runtime environment offering several modes of operation: JVM runtime mode, Native Image, Java on Truffle (the same Java applications can be run on either). #### JVM Runtime Mode -When running programs on the HotSpot JVM, GraalVM defaults to the [GraalVM compiler](../reference-manual/compiler.md) as the top-tier JIT compiler. +When running programs on the HotSpot JVM, GraalVM defaults to the [Graal compiler](../reference-manual/java/compiler.md) as the top-tier JIT compiler. At runtime, an application is loaded and executed normally on the JVM. The JVM passes bytecodes for Java or any other JVM-native language to the compiler, which compiles that to the machine code and returns it to the JVM. Interpreters for supported languages, written on top of the [Truffle framework](../../truffle/docs/README.md), are themselves Java programs that run on the JVM. @@ -52,11 +52,10 @@ A generated self-contained native executable is specific to each individual oper #### Java on Truffle [Java on Truffle](../reference-manual/java-on-truffle/README.md) is an implementation of the Java Virtual Machine Specification, built with the [Truffle framework](../../truffle/docs/README.md). It is a complete Java VM that includes all core components, implements the same API as the Java Runtime Environment library, and reuses all JARs and native libraries from GraalVM. -Java on Trufle is an experimental technology in GraalVM, available as of version 21.0.0. ## Available Distributions -GraalVM Enterprise distributions are based on Oracle JDK 8, 11, and 17. +GraalVM Enterprise distributions are based on Oracle JDK 11 and 17. GraalVM Enterprise releases include all Oracle Java critical patch updates (CPUs), which are released on a regular schedule to remedy defects and known vulnerabilities. GraalVM Enterprise is available for Linux, macOS, and Windows platforms on x86 64-bit systems, and for Linux on ARM 64-bit system. @@ -64,7 +63,7 @@ Depending on the platform, the distributions are shipped as *.tar.gz* or *.zip* ## Certified Platforms -The following are the certified platforms for GraalVM Enterprise 21: +The following are the certified platforms for GraalVM Enterprise 22: | Operating System | Version | Architecture | Installation Guide | |------------------------------------ |-------------- |-------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -103,9 +102,9 @@ Tools/Utilities: Runtimes: * [Java on Truffle](../reference-manual/java-on-truffle/README.md) -- a JVM implementation built upon the [Truffle framework](../../truffle/docs/README.md) to run Java via a Java bytecode interpreter. -* [Node.js](../reference-manual/js/README.md) -- the Node.js 14.17.6 runtime for JavaScript +* [Node.js](../reference-manual/js/README.md) -- the Node.js 14.18.1 runtime for JavaScript * [Python](../reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](../reference-manual/ruby/README.md) -- Ruby 2.7.3 compatible +* [Ruby](../reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](../reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [GraalWasm](../reference-manual/wasm/README.md) -- WebAssembly (Wasm) @@ -116,10 +115,9 @@ Oracle GraalVM Enterprise Edition is licensed under the [Oracle Technology Netwo For production use, GraalVM Enterprise is available as part of the [Oracle Java SE Subscription](https://www.oracle.com/uk/java/java-se-subscription/) which includes 24x7x365 [Oracle premier support](https://www.oracle.com/support/premier/) and the access to [My Oracle Support (MOS)](https://www.oracle.com/support/). GraalVM Enterprise focuses on support for Java LTS releases for production deployments. -GraalVM Enterprise Edition 21.3 is announced a Long-Term-Support (LTS) release. See [Versions Roadmap of Oracle GraalVM Enterprise Edition](../../release-notes/enterprise/graalvm-enterprise-version-roadmap.md) for more information. -Please note, that while Oracle JDK 17 is available under the new [Oracle No-Fee Terms and Conditions (NFTC) license](https://www.oracle.com/downloads/licenses/no-fee-license.html) which allows commercial and production use for 2 years, GraalVM Enterprise Edition license remains unchanged. +Please note, that while Oracle JDK 17 is available under the new [Oracle No-Fee Terms and Conditions (NFTC) license](https://www.oracle.com/downloads/licenses/no-fee-license.html) which allows commercial and production use for 2 years, GraalVM Enterprise Edition license remains unchanged. ## Experimental and Early Adopter Features @@ -131,7 +129,7 @@ The development team welcomes feedback on experimental features, but users shoul For more information, check the [Oracle Technology Network License Agreement for GraalVM Enterprise Edition](https://www.oracle.com/downloads/licenses/graalvm-otn-license.html). -The following table lists supported and experimental features in GraalVM Enterprise Edition 21 by platform. +The following table lists supported and experimental features in GraalVM Enterprise Edition 22 by platform. | Feature | Linux AMD64 | Linux ARM64 | macOS | Windows | |--------------------|---------------|---------------|---------------| @@ -140,7 +138,7 @@ The following table lists supported and experimental features in GraalVM Enterpr | LLVM toolchain | supported | supported | supported | not available | | JavaScript | supported | supported | supported | supported | | Node.js | supported | supported | supported | supported | -| Java on Truffle | experimental | experimental | experimental | experimental | +| Java on Truffle | supported | experimental | experimental | experimental | | Python | experimental | not available | experimental | not available | | Ruby | experimental | experimental | experimental | not available | | R | experimental | not available | experimental | not available | diff --git a/docs/examples/java-kotlin-aot.md b/docs/examples/java-kotlin-aot.md index 547f3815dabd..9eb50d9b9ceb 100644 --- a/docs/examples/java-kotlin-aot.md +++ b/docs/examples/java-kotlin-aot.md @@ -57,15 +57,18 @@ It should have produced the executable file, `helloworld`. ## Running the Application To run the application, you need to execute the JAR file in the `target` directory. -You can run it as a normal Java application using `java`. -Or, since we have a native executable prepared, you can run that directly. -The `run.sh` file executes both, and times them with the `time` utility: +You can run it as a normal Java application using `java`: ```shell java -cp ./target/mixed-code-hello-world-1.0-SNAPSHOT-jar-with-dependencies.jar hello.JavaHello +``` + +Or, since we have a native executable prepared, you can run that directly. +```shell ./helloworld ``` +The `run.sh` file executes both, and times them with the `time` utility. An output close to the following should be produced: ```shell → ./run.sh @@ -73,16 +76,16 @@ An output close to the following should be produced: Hello from Kotlin! Hello from Java! -real 0m0.129s -user 0m0.094s -sys 0m0.034s +real 0m0.589s +user 0m0.155s +sys 0m0.072s + ./helloworld Hello from Kotlin! Hello from Java! -real 0m0.010s -user 0m0.003s -sys 0m0.004s +real 0m0.053s +user 0m0.006s +sys 0m0.006s ``` The performance gain of the native version is largely due to the faster startup. diff --git a/docs/examples/java-performance-examples.md b/docs/examples/java-performance-examples.md index fac22c279137..f4e32aca58f9 100644 --- a/docs/examples/java-performance-examples.md +++ b/docs/examples/java-performance-examples.md @@ -7,7 +7,7 @@ permalink: /examples/java-performance-examples/ # Java Performance Examples -The GraalVM compiler achieves excellent performance, especially for highly abstracted programs, due to its versatile optimization techniques. +The [Graal compiler](../reference-manual/java/compiler.md) achieves excellent performance, especially for highly abstracted programs, due to its versatile optimization techniques. Code using more abstraction and modern Java features like Streams or Lambdas will see greater speedups. The examples below demonstrate this. @@ -15,7 +15,7 @@ The examples below demonstrate this. ### Streams API Example -A simple example based on the [Streams API](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html) is used here to demonstrate performance gains when using the GraalVM compiler. +A simple example based on the [Streams API](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html) is used here to demonstrate performance gains when using the Graal compiler. This example counts the number of uppercase characters in a body of text. To simulate a large load, the same sentence is processed 10 million times: @@ -46,7 +46,7 @@ public class CountUppercase { 2. Compile it and run as follows: ```shell javac CountUppercase.java -java CountUppercase In 2021 I would like to run ALL languages in one VM. +java CountUppercase This year I would like to run ALL languages in one VM. 1 (319 ms) 2 (275 ms) 3 (164 ms) @@ -64,14 +64,14 @@ If the performance profile of `CountUppercase` on your machine does not match th 3. Add the `-Dgraal.PrintCompilation=true` option to see statistics for the compilations: ```shell -java -Dgraal.PrintCompilation=true CountUppercase In 2021 I would like to run ALL languages in one VM. +java -Dgraal.PrintCompilation=true CountUppercase This year I would like to run ALL languages in one VM. ``` This option prints a line after each compilation that shows the method compiled, time taken, bytecodes processed (including inlined methods), size of machine code produced, and amount of memory allocated during compilation. 4. Use the `-XX:-UseJVMCICompiler` option to disable the GraalVM compiler and use the native top tier compiler in the VM to compare performance: ```shell -java -XX:-UseJVMCICompiler CountUppercase In 2021 I would like to run ALL languages in one VM. +java -XX:-UseJVMCICompiler CountUppercase This year I would like to run ALL languages in one VM. 1 (492 ms) 2 (441 ms) 3 (443 ms) @@ -187,7 +187,7 @@ If you would like to check how it would behave when using GraalVM Community, use java -Dgraal.CompilerConfiguration=community Blender ``` -3. Use the `-XX:-UseJVMCICompiler` option to disable the GraalVM compiler and run with the default HotSpot JIT compiler: +3. Use the `-XX:-UseJVMCICompiler` option to disable the Graal compiler and run with the default HotSpot JIT compiler: ```shell java -XX:-UseJVMCICompiler Blender 2546 ms diff --git a/docs/examples/java-simple-stream-benchmark.md b/docs/examples/java-simple-stream-benchmark.md index 67a0502e3318..ec68a9940875 100644 --- a/docs/examples/java-simple-stream-benchmark.md +++ b/docs/examples/java-simple-stream-benchmark.md @@ -7,11 +7,11 @@ permalink: /examples/java-simple-stream-benchmark/ # Simple Java Stream Benchmark -This application is a small benchmark of the Java Stream API. It demonstrates how the GraalVM compiler can achieve better performance for highly abstracted programs like those using Streams, Lambdas, or other Java features. +This application is a small benchmark of the Java Stream API. It demonstrates how the Graal compiler can achieve better performance for highly abstracted programs like those using Streams, Lambdas, or other Java features. ## Preparation -1. [Download GraalVM](https://www.graalvm.org/downloads/), unzip the archive, export the GraalVM home directory as the `$JAVA_HOME` and add `$JAVA_HOME/bin` to the `PATH` environment variable: +1. [Download GraalVM](https://www.graalvm.org/downloads/), unzip the archive, export the GraalVM Home directory as the `$JAVA_HOME` and add `$JAVA_HOME/bin` to the `PATH` environment variable: On Linux: ```bash export JAVA_HOME=/home/${current_user}/path/to/graalvm @@ -49,12 +49,12 @@ You can run it with the following command: java -jar target/benchmarks.jar ``` If you would like to run the benchmark on a different JVM, you can run it with whatever `java` you have. -However, if you just want to run it on the same JVM, but without the GraalVM compiler, you may add the `-XX:-UseJVMCICompiler` option into the same command: +However, if you just want to run it on the same JVM, but without the Graal compiler, you may add the `-XX:-UseJVMCICompiler` option into the same command: ```shell java -XX:-UseJVMCICompiler -jar target/benchmarks.jar ``` -This way, the GraalVM compiler will not be used as the JVMCI compiler and the JVM will use its default one. +This way, the Graal compiler will not be used as the JVMCI compiler and the JVM will use its default one. ### Note about Results diff --git a/docs/getting-started/graalvm-community/container-images/graalvm-ce-container-images.md b/docs/getting-started/graalvm-community/container-images/graalvm-ce-container-images.md index d16d16acd800..bdc1d46feedf 100644 --- a/docs/getting-started/graalvm-community/container-images/graalvm-ce-container-images.md +++ b/docs/getting-started/graalvm-community/container-images/graalvm-ce-container-images.md @@ -11,52 +11,58 @@ Containers can simplify application deployment and development. To support container-based development, GraalVM Community container images for each release are published in the [GitHub Container Registry](https://github.com/orgs/graalvm/packages/container/package/graalvm-ce). Learn here how to start using GraalVM Community images for Docker containers. -1. Having the Docker daemon running, pull the image from GitHub with `docker pull`: +You can pull a package by name or by name and version tag. To install GraalVM JDK from the command line, use: ```shell -docker pull ghcr.io/graalvm/graalvm-ce:latest +docker pull ghcr.io/graalvm/jdk:java17- ``` -2. Alternatively, use as the base image in [Dockerfile](https://docs.docker.com/engine/reference/builder/): + +Alternatively, use GraalVM JDK as base image in [Dockerfile](https://docs.docker.com/engine/reference/builder/): ```shell -FROM ghcr.io/graalvm/graalvm-ce:latest +FROM ghcr.io/graalvm/jdk:java17- ``` There are different GraalVM Community container images provided depending on the architecture and the Java version. GraalVM binaries are built for Linux, macOS, and Windows platforms on x86 64-bit systems, and for Linux on ARM 64-bit systems. -The images are multi-arch (`aarch64` or `amd64` will be pulled depending on Docker host architecture), and named per a _platform-jdk-version_ naming scheme, for example, `ghcr.io/graalvm/graalvm-ce:latest:ol8-java11-21.3.0`. -A complete list can be found on the [All versions](https://github.com/orgs/graalvm/packages/container/graalvm-ce/versions) page. +The images are multi-arch (`aarch64` or `amd64` will be pulled depending on Docker host architecture), and tagged with the format `ghcr.io/graalvm/IMAGE_NAME:version`. +The version tag defines the level of specificity. +It is recommended that the most specific tag be used, e.g., `java17-21.3.0` or `java17-21.3.0-b1`, where the `-b1` means the image required a patch and this specific build will never change. +See what types of container images are available [here](https://github.com/graalvm/container). The images are based on Oracle Linux and has GraalVM Community downloaded, unzipped and made available. -It means that Java, JavaScript, Node.js and the LLVM runtime are available out of the box. +It means that Java, JavaScript, and the LLVM runtime are available out of the box. You can start a container and enter the `bash` session with the following run command: ```shell -docker run -it --rm ghcr.io/graalvm/graalvm-ce:21.3.0 bash +docker run -it --rm ghcr.io/graalvm/jdk:java17-22.0.0 bash ``` + Check that `java`, `js` and other commands work as expected. ```shell -→ docker run -it --rm ghcr.io/graalvm/graalvm-ce:21.3.0 bash +→ docker run -it --rm ghcr.io/graalvm/jdk:java17-22.0.0 bash bash-4.4# java -version -openjdk version "17" 2021-09-14 -OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17+35-jvmci-21.3-b03) -OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17+35-jvmci-21.3-b03, mixed mode, sharing) +openjdk 17.0.2 2022-01-18 +OpenJDK Runtime Environment GraalVM CE 22.0.0 (build 17.0.2+5-jvmci-22.0-b02) +OpenJDK 64-Bit Server VM GraalVM CE 22.0.0 (build 17.0.2+5-jvmci-22.0-b02, mixed mode, sharing) bash-4.4# js -version -GraalVM JavaScript (GraalVM CE Native 21.3.0) +GraalVM JavaScript (GraalVM CE Native 22.0.0) > 1 + 1 2 > quit() > bash-4.4# lli --version -LLVM 12.0.1 (GraalVM CE Native 21.3.0) +LLVM 12.0.1 (GraalVM CE Native 22.0.0) ``` -Please note that the image contains only the components immediately available in the GraalVM Community core download. -However, the [GraalVM Updater, `gu`](../../../reference-manual/graalvm-updater.md), utility is included in the container image and may be used to install additional languages and runtimes like Node.js, Ruby, R, Python or WebAssembly. +You have pulled a size compact GraalVM Community container image with the GraalVM JDK pre-installed. +JavaScript and `lli` are the components immediately available at the GraalVM Community image core. +However, the [GraalVM Updater, `gu`, utility](../../../reference-manual/graalvm-updater.md) is also included and may be used to install additional languages and runtimes like Node.js, Ruby, R, Python or WebAssembly. +Check what other configuration types of container images are available [here](https://github.com/graalvm/container). -For example, the following command installs the Ruby support (the output below is truncated for brevity): +To add the Ruby support, run the following command (the output below is truncated for brevity): ```shell -docker run -it --rm ghcr.io/graalvm/graalvm-ce:21.3.0 bash +docker run -it --rm ghcr.io/graalvm/jdk:java17-22.0.0 bash bash-4.4# gu install ruby Downloading: Component catalog Processing component archive: Component ruby @@ -68,13 +74,13 @@ Downloading: Component ruby Here is a sample command that maps the `/absolute/path/to/directory/no/trailing/slash` directory from the host system to the `/path/inside/container` inside the container. ```shell -docker run -it --rm -v /absolute/path/to/directory/no/trailing/slash:/path/inside/container ghcr.io/graalvm/graalvm-ce:21.3.0 bash +docker run -it --rm -v /absolute/path/to/directory/no/trailing/slash:/path/inside/container ghcr.io/graalvm/jdk:java17-22.0.0 bash ``` -If you want to create Docker images that contain GraalVM with Ruby, R, or Python, you can use a Dockerfile like the example below, which uses `ghcr.io/graalvm/graalvm-ce:21.3.0` as the base image, installs the Ruby support using the `gu` utility, then creates and runs a sample Ruby program. +If you want to create Docker images that contain GraalVM with Ruby, R, or Python, you can use a Dockerfile like the example below, which uses `ghcr.io/graalvm/jdk:java17-22.0.0` as the base image, installs the Ruby support using the `gu` utility, then creates and runs a sample Ruby program. ```shell -FROM ghcr.io/graalvm/graalvm-ce:21.3.0 +FROM ghcr.io/graalvm/jdk:java17-22.0.0 RUN gu install ruby WORKDIR /workdir RUN echo 'puts "Hello from Ruby!\nVersion: #{RUBY_DESCRIPTION}"' > app.rb @@ -88,5 +94,5 @@ docker build -t ruby-demo . ... docker run -it --rm ruby-demo Hello from Ruby! -Version: truffleruby 21.3.0, like ruby 2.7.4, GraalVM CE Native [x86_64-darwin] +Version: truffleruby 22.0.0, like ruby 3.0.2, GraalVM CE Native [x86_64-darwin] ``` diff --git a/docs/getting-started/graalvm-community/get-started-graalvm-community.md b/docs/getting-started/graalvm-community/get-started-graalvm-community.md index ca70038a5ee2..7616249234d7 100644 --- a/docs/getting-started/graalvm-community/get-started-graalvm-community.md +++ b/docs/getting-started/graalvm-community/get-started-graalvm-community.md @@ -26,10 +26,11 @@ Choose the operating system and proceed to the installation steps: * [Linux AArch64](linux-aarch64.md) * [macOS](macos.md) * [Windows](windows.md) +* [Docker Container](container-images/graalvm-ce-container-images.md) ## Start Running Applications -For demonstration purposes here, we will use GraalVM Community Edition based on OpenJDK 11. +For demonstration purposes here, we will use GraalVM Community Edition based on OpenJDK 17. The core distribution of GraalVM includes the JVM, the GraalVM compiler, the LLVM runtime, and JavaScript runtime. Having downloaded and installed GraalVM, you can already run Java, JavaScript, and LLVM-based applications. @@ -42,15 +43,15 @@ GraalVM's `/bin` directory is similar to that of a standard JDK, but includes a Check the versions of the runtimes provided by default: ```shell java -version -openjdk version "17" 2021-09-14 -OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17+35-jvmci-21.3-b03) -OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17+35-jvmci-21.3-b03, mixed mode, sharing) +openjdk version "17.0.2" 2022-01-18 +OpenJDK Runtime Environment GraalVM CE 22.0.0 (build 17.0.2+5-jvmci-22.0-b02) +OpenJDK 64-Bit Server VM GraalVM CE 22.0.0 (build 17.0.2+5-jvmci-22.0-b02, mixed mode, sharing) js -version -GraalVM JavaScript (GraalVM CE Native 21.3.0) +GraalVM JavaScript (GraalVM CE Native 22.0.0) lli --version -LLVM 12.0.1 (GraalVM CE Native 21.3.0) +LLVM 12.0.1 (GraalVM CE Native 22.0.0) ``` Further below you will find information on how to add other optionally available GraalVM runtimes including Node.js, Ruby, R, Python, and WebAssembly. @@ -76,14 +77,14 @@ Hello World! You can find a collection of larger Java examples on the [Examples Applications](../../examples/examples.md) page. For more information on the GraalVM -compiler, go to [Compiler](../../reference-manual/compiler.md). +compiler, go to [Compiler](../../reference-manual/java/compiler.md). For more extensive documentation on running Java, proceed to [JVM Languages](../../reference-manual/java/README.md). ## Run JavaScript and Node.js GraalVM can execute plain JavaScript code, both in REPL mode and by executing script files directly: ```shell -js +$JAVA_HOME/bin/js > 1 + 2 3 ``` @@ -95,7 +96,7 @@ gu install nodejs ``` ```shell $JAVA_HOME/bin/node -v -v14.17.6 +v14.18.1 ``` More than 100,000 npm packages are regularly tested and are compatible with GraalVM, including modules like express, react, async, request, browserify, grunt, mocha, and underscore. @@ -167,9 +168,13 @@ The support is not available by default, but you can quickly add it to GraalVM u gu install python ``` -Once it is installed, you can run Python programs: +It installs the `graalpython` launcher. Check the version, and you can already run Python programs: ```shell -graalpython +$JAVA_HOME/bin/graalpython --version +``` + +```shell +$JAVA_HOME/bin/graalpython ... >>> 1 + 2 3 @@ -188,15 +193,14 @@ gu install ruby Once it is installed, Ruby launchers like `ruby`, `gem`, `irb`, `rake`, `rdoc`, and `ri` become available to run Ruby programs: ```shell -ruby [options] program.rb +$JAVA_HOME/bin/ruby [options] program.rb ``` -GraalVM Ruby runtime environment uses the -[same options as the standard implementation of Ruby](../../reference-manual/ruby/options.md), -with some additions. For example: +GraalVM runtime for Ruby uses the [same options as the standard implementation of Ruby](../../reference-manual/ruby/options.md), with some additions. +For example: ```shell gem install chunky_png -ruby -r chunky_png -e "puts ChunkyPNG::Color.to_hex(ChunkyPNG::Color('mintcream @ 0.5'))" +$JAVA_HOME/bin/ruby -r chunky_png -e "puts ChunkyPNG::Color.to_hex(ChunkyPNG::Color('mintcream @ 0.5'))" #f5fffa80 ``` @@ -256,7 +260,7 @@ emcc -o floyd.wasm floyd.c Then you can run the compiled WebAssembly binary on GraalVM as follows: ```shell -wasm --Builtins=wasi_snapshot_preview1 floyd.wasm +$JAVA_HOME/bin/wasm --Builtins=wasi_snapshot_preview1 floyd.wasm ``` More details can be found in the [WebAssembly reference manual](../../reference-manual/wasm/README.md). diff --git a/docs/getting-started/graalvm-community/linux.md b/docs/getting-started/graalvm-community/linux.md index 2ac721ed2b99..52585d15c28c 100644 --- a/docs/getting-started/graalvm-community/linux.md +++ b/docs/getting-started/graalvm-community/linux.md @@ -41,9 +41,9 @@ Tools/Utilities: Runtimes: * [Java on Truffle](../../reference-manual/java-on-truffle/README.md) -- a Java Virtual Machine implementation based on a Truffle interpreter for GraalVM -* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.17.6 compatible +* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.18.1 compatible * [Python](../../reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 2.7.2 compatible +* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](/../../reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [Wasm](../../reference-manual/wasm/README.md) -- WebAssembly (Wasm) ​ diff --git a/docs/getting-started/graalvm-community/macos.md b/docs/getting-started/graalvm-community/macos.md index 3a83017b0165..ce40ba4d7c94 100644 --- a/docs/getting-started/graalvm-community/macos.md +++ b/docs/getting-started/graalvm-community/macos.md @@ -70,9 +70,9 @@ Tools/Utilities: Runtimes: * [Java on Truffle](../../reference-manual/java-on-truffle/README.md) -- a Java Virtual Machine implementation based on a Truffle interpreter for GraalVM -* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.17.6 compatible +* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.18.1 compatible * [Python](../../reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 2.7.2 compatible +* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](/../../reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [Wasm](../../reference-manual/wasm/README.md) -- WebAssembly (Wasm) ​ diff --git a/docs/getting-started/graalvm-enterprise/get-started-graalvm-enterprise.md b/docs/getting-started/graalvm-enterprise/get-started-graalvm-enterprise.md index d96d8bbaab89..dbef9c208a54 100644 --- a/docs/getting-started/graalvm-enterprise/get-started-graalvm-enterprise.md +++ b/docs/getting-started/graalvm-enterprise/get-started-graalvm-enterprise.md @@ -33,7 +33,7 @@ Choose your operating system and proceed to the installation steps for your spec ## Start Running Applications -For demonstration purposes here, we will use GraalVM Enterprise based on Java 11. +For demonstration purposes here, we will use GraalVM Enterprise based on Java 17. The core distribution of GraalVM Enterprise includes the JVM, the GraalVM compiler, the LLVM runtime, and JavaScript runtime. Having downloaded and installed GraalVM Enterprise, you can already run Java, JavaScript, and LLVM-based applications. @@ -45,15 +45,15 @@ GraalVM Enterprise's `/bin` directory is similar to that of a standard JDK, but Check the versions of the runtimes provided by default: ```shell -java version "11.0.13" 2021-10-19 LTS -Java(TM) SE Runtime Environment GraalVM EE 21.3.0 (build 11.0.13+9-LTS-jvmci-21.3-b03) -Java HotSpot(TM) 64-Bit Server VM GraalVM EE 21.3.0 (build 11.0.13+9-LTS-jvmci-21.3-b03, mixed mode, sharing) +java version "17.0.2" 2022-01-18 LTS +Java(TM) SE Runtime Environment GraalVM EE 22.0.0 (build 17.0.2+5-LTS-jvmci-22.0-b02) +Java HotSpot(TM) 64-Bit Server VM GraalVM EE 22.0.0 (build 17.0.2+5-LTS-jvmci-22.0-b02, mixed mode, sharing) js -version -GraalVM JavaScript (GraalVM EE Native 21.3.0) +GraalVM JavaScript (GraalVM EE Native 22.0.0) lli --version -LLVM 12.0.1 (GraalVM EE Native 21.3.0) +LLVM 12.0.1 (GraalVM EE Native 22.0.0) ``` Further below you will find information on how to add other optionally available GraalVM Enterprise runtimes including Node.js, Ruby, R, Python, and WebAssembly. @@ -79,25 +79,26 @@ Hello World! ``` You can find a collection of larger Java examples on the [Examples Applications](../../examples/examples.md) page. -For more information on the GraalVM compiler, go to [Compiler](../../reference-manual/compiler.md). +For more information on the GraalVM compiler, go to the [Graal compiler](../../reference-manual/java/compiler.md). For more extensive documentation on running Java, proceed to [JVM Languages](../../reference-manual/java/README.md). ### JavaScript and Node.js + GraalVM Enterprise can execute plain JavaScript code, both in REPL mode and by executing script files directly: ```shell -js +$JAVA_HOME/bin/js > 1 + 2 3 ``` -GraalVM Enterprise also supports running Node.js applications. +GraalVM also supports running Node.js applications. Node.js support is not installed by default, but can be easily added with GraalVM Updater: ```shell gu install nodejs ``` ```shell $JAVA_HOME/bin/node -v -v14.17.6 +v14.18.1 ``` More than 100,000 npm packages are regularly tested and are compatible with GraalVM Enterprise, including modules like express, react, async, request, browserify, grunt, mocha, and underscore. @@ -173,13 +174,17 @@ The support is not available by default, but you can quickly add it to GraalVM u gu install python ``` -Once it is installed, you can run Python programs: +It installs the `graalpython` launcher. Check the version, and you can already run Python programs: +```shell +$JAVA_HOME/bin/graalpython --version +``` + ```shell -graalpython +$JAVA_HOME/bin/graalpython ... >>> 1 + 2 3 ->>> exit() +>>> quit() ``` More examples and additional information on Python support in GraalVM can be found in the [Python reference manual](../../reference-manual/python/README.md). @@ -194,15 +199,14 @@ gu install ruby Once it is installed, Ruby launchers like `ruby`, `gem`, `irb`, `rake`, `rdoc`, and `ri` become available to run Ruby programs: ```shell -ruby [options] program.rb +$JAVA_HOME/bin/ruby [options] program.rb ``` -GraalVM Ruby runtime environment uses the -[same options as the standard implementation of Ruby](../../reference-manual/ruby/options.md), -with some additions. For example: +GraalVM runtime for Ruby uses the [same options as the standard implementation of Ruby](../../reference-manual/ruby/options.md), with some additions. +For example: ```shell gem install chunky_png -ruby -r chunky_png -e "puts ChunkyPNG::Color.to_hex(ChunkyPNG::Color('mintcream @ 0.5'))" +$JAVA_HOME/bin/ruby -r chunky_png -e "puts ChunkyPNG::Color.to_hex(ChunkyPNG::Color('mintcream @ 0.5'))" #f5fffa80 ``` @@ -264,14 +268,14 @@ emcc -o floyd.wasm floyd.c Then you can run the compiled WebAssembly binary on GraalVM as follows: ```shell -wasm --Builtins=wasi_snapshot_preview1 floyd.wasm +$JAVA_HOME/bin/wasm --Builtins=wasi_snapshot_preview1 floyd.wasm ``` More details can be found in the [WebAssembly reference manual](../../reference-manual/wasm/README.md). ## Native Images -With GraalVM Enterprise you can compile Java bytecode into a platform-specific, self-contained, native executable - a native image - to achieve faster startup and a smaller footprint for your application. +With GraalVM Enterprise you can compile Java bytecode into a platform-specific, self-contained binary - a native image - to achieve faster startup and a smaller footprint for your application. The [Native Image](../../reference-manual/native-image/README.md) functionality is not available by default, but can be easily installed with the [GraalVM Updater](../../reference-manual/graalvm-updater.md) tool: ```shell gu install native-image @@ -373,15 +377,15 @@ Here is the JSON output from the native executable: The native image runs much faster than running the same code on the JVM directly: ```shell -time bin/java PrettyPrintJSON < test.json > /dev/null -real 0m1.101s -user 0m2.471s -sys 0m0.237s +time java PrettyPrintJSON < test.json > /dev/null +real 0m1.806s +user 0m3.651s +sys 0m0.341s time ./prettyprintjson < test.json > /dev/null -real 0m0.037s -user 0m0.015s -sys 0m0.016s +real 0m0.041s +user 0m0.011s +sys 0m0.013s ``` ## Combine Languages @@ -411,4 +415,4 @@ If you are looking for the tooling support GraalVM Enterprise offers, proceed to If you are considering GraalVM Enterprise as a platform for your future language or tool implementation, go to [GraalVM Enterprise as a Platform](../../../truffle/docs/README.md). -You can find information on GraalVM Enterprise's security model in the [Security Guide](/security-guide/), and rich API documentation in [GraalVM SDK Javadoc](https://docs.oracle.com/en/graalvm/enterprise/21/sdk/index.html). +You can find information on GraalVM Enterprise's security model in the [Security Guide](../../security/security-guide.md), and rich API documentation in [GraalVM SDK Javadoc](https://docs.oracle.com/en/graalvm/enterprise/22/sdk/index.html). diff --git a/docs/getting-started/graalvm-enterprise/installation-linux-aarch64.md b/docs/getting-started/graalvm-enterprise/installation-linux-aarch64.md index 9e21e0b69611..d0fd883ad667 100644 --- a/docs/getting-started/graalvm-enterprise/installation-linux-aarch64.md +++ b/docs/getting-started/graalvm-enterprise/installation-linux-aarch64.md @@ -14,11 +14,11 @@ This allows you to install GraalVM for the current user into any location, witho 1. Navigate to [Oracle GraalVM Downloads](https://www.oracle.com/downloads/graalvm-downloads.html?selected_tab=21). 2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **11** or **17** for the Java version, **Linux** for the operating system, and **aarch64** for the architecture. 3. Click on the **GraalVM Enterprise Core** download link. Before you download a file, you must accept the [Oracle License Agreement](https://www.oracle.com/downloads/licenses/graalvm-otn-license.html) in the popup window. -4. When the download button becomes active, press it to start downloading **graalvm-ee-java11-linux-aarch64-.tar.gz**. +4. When the download button becomes active, press it to start downloading **graalvm-ee-java-linux-aarch64-.tar.gz**. 5. Change the directory to the location where you want to install GraalVM Enterprise, then move the _.tar.gz_ archive to it. 6. Unzip the archive: ```shell -tar -xzf graalvm-ee-java11-linux-aarch64-.tar.gz +tar -xzf graalvm-ee-java-linux-aarch64-.tar.gz ``` 7. There can be multiple JDKs installed on the machine. The next step is to configure the runtime environment: - Point the `PATH` environment variable to the GraalVM Enterprise `bin` directory: diff --git a/docs/getting-started/graalvm-enterprise/installation-linux.md b/docs/getting-started/graalvm-enterprise/installation-linux.md index e40d026bc347..ff698fd1fa1b 100644 --- a/docs/getting-started/graalvm-enterprise/installation-linux.md +++ b/docs/getting-started/graalvm-enterprise/installation-linux.md @@ -8,7 +8,7 @@ permalink: /getting-started/installation-linux/ Follow these steps to install Oracle GraalVM Enterprise Edition on the Linux operating system: 1. Navigate to [Oracle GraalVM Downloads](https://www.oracle.com/downloads/graalvm-downloads.html?selected_tab=21). -2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **8**, **11**, or **17** for the Java version, **Linux** for the operating system, and **amd64** for the architecture. +2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **11** or **17** for the Java version, **Linux** for the operating system, and **amd64** for the architecture. 3. Click on the **GraalVM Enterprise Core** download link. Before you download a file, you must accept the [Oracle License Agreement](https://www.oracle.com/downloads/licenses/graalvm-otn-license.html) in the popup window. 4. When the download button becomes active, press it to start downloading **graalvm-ee-java-linux-amd64-.tar.gz**. 5. Change the directory to the location where you want to install GraalVM Enterprise, then move the _.tar.gz_ archive to it. @@ -40,9 +40,9 @@ Tools/Utilities: Runtimes: * [Java on Truffle](../../reference-manual/java-on-truffle/README.md) -- a Java Virtual Machine implementation based on a Truffle interpreter for GraalVM -* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.17.6 compatible +* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.18.1 compatible * [Python](../../reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 2.7.2 compatible +* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](/../../reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [Wasm](../../reference-manual/wasm/README.md) -- WebAssembly (Wasm) ​ diff --git a/docs/getting-started/graalvm-enterprise/installation-macos.md b/docs/getting-started/graalvm-enterprise/installation-macos.md index 6c751d28aace..20eeb46deafa 100644 --- a/docs/getting-started/graalvm-enterprise/installation-macos.md +++ b/docs/getting-started/graalvm-enterprise/installation-macos.md @@ -13,7 +13,7 @@ Note that in macOS, the JDK installation path is: `/Library/Java/JavaVirtualMach Follow these steps to install Oracle GraalVM Enterprise Edition on the macOS operating system: 1. Navigate to[ Oracle GraalVM Downloads](https://www.oracle.com/downloads/graalvm-downloads.html). -2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **8**, **11**, or **17** for the Java version, and **macOS** for the operating system. +2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **11** or **17** for the Java version, and **macOS** for the operating system. 3. Click on the **GraalVM Enterprise Core** download link. Before you download a file, you must accept the [Oracle License Agreement](https://www.oracle.com/downloads/licenses/graalvm-otn-license.html) in the popup window. 4. When the download button becomes active, press it to start downloading **graalvm-ee-java-darvin-amd64-.tar.gz**. 5. Unzip the archive: @@ -67,9 +67,9 @@ Tools/Utilities: Runtimes: * [Java on Truffle](../../reference-manual/java-on-truffle/README.md) -- a Java Virtual Machine implementation based on a Truffle interpreter for GraalVM -* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.17.6 compatible +* [Node.js](../../reference-manual/js/README.md) -- Node.js v14.18.1 compatible * [Python](../../reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 2.7.2 compatible +* [Ruby](../../reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](/../../reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [Wasm](../../reference-manual/wasm/README.md) -- WebAssembly (Wasm) ​ diff --git a/docs/getting-started/graalvm-enterprise/installation-windows.md b/docs/getting-started/graalvm-enterprise/installation-windows.md index e5909a4a8433..ac46a2bc48a1 100644 --- a/docs/getting-started/graalvm-enterprise/installation-windows.md +++ b/docs/getting-started/graalvm-enterprise/installation-windows.md @@ -9,12 +9,12 @@ You can install Oracle GraalVM Enterprise Edition on the Windows operating syste Follow these steps: 1. Navigate to [Oracle GraalVM Downloads](https://www.oracle.com/downloads/graalvm-downloads.html). -2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **8**, **11**, or **17** for the Java version, and **Windows** for the operating system. +2. Select the preferable GraalVM Enterprise version in the Release Version dropdown, **11** or **17** for the Java version, and **Windows** for the operating system. 3. Click on the **GraalVM Enterprise Core** download link. Before you download a file, you must accept the [Oracle License Agreement](https://www.oracle.com/downloads/licenses/graalvm-otn-license.html) in the popup window. 4. When the download button becomes active, press it to start downloading graalvm-ee-java-windows-amd64-.zip. 5. Change the directory to the location where you want to install GraalVM Enterprise, then move the _.zip_ archive to it. 6. Unzip the archive to your file system. -7. There can be multiple JDKs installed on the machine. The next step is to configure the runtime environment. Setting environment variables via the command line will work the same way for Windows 7, 8 and 10. +7. There can be multiple JDKs installed on the machine. The next step is to configure the runtime environment. Setting environment variables via the command line work the same way for Windows 8 and 10. - Point the `PATH` environment variable to the GraalVM Enterprise `bin` directory: ```shell setx /M PATH "C:\Progra~1\Java\\bin;%PATH%" diff --git a/docs/graalvm-as-a-platform/implement-instrument.md b/docs/graalvm-as-a-platform/implement-instrument.md index 9e67cbce0381..1f46d212053c 100644 --- a/docs/graalvm-as-a-platform/implement-instrument.md +++ b/docs/graalvm-as-a-platform/implement-instrument.md @@ -346,7 +346,7 @@ public ExecutionEventNode create(final EventContext ec) { As the above code shows, an `ExecutionEventNode` is a valid AST node. This implies that the instrumentation code will be optimized by the GraalVM runtime together with the instrumented application, resulting in minimal instrumentation overhead. Furthermore, this allows instrument developers to use the [Truffle framework compiler directives](http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/CompilerDirectives.html) directly from instrumentation nodes. -In the example, compiler directives are used to inform the GraalVM compiler that `visited` can be considered compilation-final. +In the example, compiler directives are used to inform the Graal compiler that `visited` can be considered compilation-final. Each instrumentation node is bound to a specific code location. Such locations can be accessed by the agent using the provided [`EventContext`](http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/instrumentation/EventContext.html) object. The context object gives instrumentation nodes access to a variety of information about the current AST nodes being executed. diff --git a/docs/graalvm-as-a-platform/implement-language.md b/docs/graalvm-as-a-platform/implement-language.md index 892242057919..15ec6b0ae032 100644 --- a/docs/graalvm-as-a-platform/implement-language.md +++ b/docs/graalvm-as-a-platform/implement-language.md @@ -166,7 +166,7 @@ Skipping the native image build because SL_BUILD_NATIVE is set to false. ## Run SimpleLanguage with the Newest (Developement) version of the Compiler -To run SimpleLanguage with the development version of the GraalVM compiler we must build a GraalVM with that compiler. +To run SimpleLanguage with the development version of the Graal compiler we must build a GraalVM with that compiler. Clone the `graal` repository (https://github.com/oracle/graal) and follow the instructions in the `vm/README.md` file to build a GraalVM. Once that's done, point `JAVA_HOME` to the newly built GraalVM and proceed with normal building and running of SimpleLanguage. @@ -182,7 +182,7 @@ Assuming `JAVA_HOME` points to the GraalVM installation and that the current wor ```shell $JAVA_HOME/bin/java \ - -cp launcher/target/launcher-21.3.0-SNAPSHOT.jar \ + -cp launcher/target/launcher-22.0.0-SNAPSHOT.jar \ -Dtruffle.class.path.append=language/target/simplelanguage.jar \ com.oracle.truffle.sl.launcher.SLMain language/tests/Add.sl ``` @@ -217,6 +217,6 @@ Assuming `JAVA_HOME` points to a stock JDK installation, and that the current wo ```shell $JAVA_HOME/bin/java \ - -cp graal-sdk-21.3.0.jar:truffle-api-21.3.0.jar:launcher/target/launcher-21.3.0-SNAPSHOT.jar:language/target/simplelanguage.jar \ + -cp graal-sdk-22.0.0.jar:truffle-api-22.0.0.jar:launcher/target/launcher-22.0.0-SNAPSHOT.jar:language/target/simplelanguage.jar \ com.oracle.truffle.sl.launcher.SLMain language/tests/Add.sl ``` diff --git a/docs/guides/guides.md b/docs/guides/guides.md index ee499535af58..f09c640541cb 100644 --- a/docs/guides/guides.md +++ b/docs/guides/guides.md @@ -15,7 +15,7 @@ Here you will find information about how to: ## Run Java Applications on GraalVM from the CLI Any application that runs on a Java Virtual Machine (JVM) can run on GraalVM. -GraalVM includes a JDK based on the Java HotSpot VM, and integrates an optimizing, just-in-time (JIT) compiler, written in Java: [the GraalVM compiler](../reference-manual/compiler.md). +GraalVM includes a JDK based on the Java HotSpot VM, and integrates an optimizing, just-in-time (JIT) compiler, written in Java: [the GraalVM compiler](../reference-manual/java/compiler.md). At runtime, an application is loaded and executed normally by the JVM. In order to follow the steps in this guide, you must have GraalVM installed. diff --git a/docs/introduction.md b/docs/introduction.md index b8af73d11e14..bc42695d1762 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -1,7 +1,7 @@ --- layout: docs toc_group: docs -title: GraalVM Documentation +title: Architecture Overview permalink: /docs/introduction/ --- @@ -34,7 +34,7 @@ With GraalVM Truffle, Java and other supported languages can directly interopera GraalVM is unique as a runtime environment offering several modes of operation: JVM runtime mode, Native Image, Java on Truffle (the same Java applications can be run on either). #### JVM Runtime Mode -When running programs on the HotSpot JVM, GraalVM defaults to the [GraalVM compiler](reference-manual/compiler.md) as the top-tier JIT compiler. +When running programs on the HotSpot JVM, GraalVM defaults to the [GraalVM compiler](reference-manual/java/compiler.md) as the top-tier JIT compiler. At runtime, an application is loaded and executed normally on the JVM. The JVM passes bytecodes for Java or any other JVM-native language to the compiler, which compiles that to the machine code and returns it to the JVM. Interpreters for supported languages, written on top of the [Truffle framework](../truffle/docs/README.md), are themselves Java programs that run on the JVM. @@ -47,15 +47,13 @@ A generated self-contained native executable is specific to each individual oper #### Java on Truffle [Java on Truffle](reference-manual/java-on-truffle/README.md) is an implementation of the Java Virtual Machine Specification, built with the [Truffle language implementation framework](../truffle/docs/README.md). It is a complete Java VM that includes all core components, implements the same API as the Java Runtime Environment library, and reuses all JARs and native libraries from GraalVM. -Java on Trufle is an experimental technology in GraalVM, available as of version 21.0.0. ## Available Distributions -GraalVM is available as **GraalVM Enterprise** and **GraalVM Community** editions and includes support for Java 8, Java 11 and Java 16. +GraalVM is available as **GraalVM Enterprise** and **GraalVM Community** editions and includes support for Java 11 and Java 17. GraalVM Enterprise is based on Oracle JDK while GraalVM Community is based on OpenJDK. GraalVM is available for Linux, macOS, and Windows platforms on x86 64-bit systems, and for Linux on ARM 64-bit system. -The GraalVM distribution based on Oracle JDK 17 is experimental with [several known limitations](https://www.graalvm.org/release-notes/known-issues/). Depending on the platform, the distributions are shipped as *.tar.gz* or *.zip* archives. See the [Getting Started guide](getting-started/graalvm-community/get-started-graalvm-community.md) for installation instructions. @@ -86,13 +84,13 @@ Tools/Utilities: * [Native Image](reference-manual/native-image/README.md) -- a technology to compile an application ahead-of-time into a native executable. * [LLVM toolchain](reference-manual/llvm/README.md) -- a set of tools and APIs for compiling native programs to bitcode that can be executed with on the GraalVM runtime. -* [Java on Truffle](reference-manual/java-on-truffle/README.md) -- a JVM implementation built upon the [Truffle framework](../truffle/docs/README.md) to run Java via a Java bytecode interpreter. Runtimes: -* [Node.js](reference-manual/js/README.md) -- the Node.js 14.17.6 runtime for JavaScript +* [Java on Truffle](reference-manual/java-on-truffle/README.md) -- a JVM implementation built upon the [Truffle framework](../truffle/docs/README.md) to run Java via a Java bytecode interpreter. +* [Node.js](reference-manual/js/README.md) -- the Node.js 14.18.1 runtime for JavaScript * [Python](reference-manual/python/README.md) -- Python 3.8.5 compatible -* [Ruby](reference-manual/ruby/README.md) -- Ruby 2.7.3 compatible +* [Ruby](reference-manual/ruby/README.md) -- Ruby 3.0.2 compatible * [R](reference-manual/r/README.md) -- GNU R 4.0.3 compatible * [GraalWasm](reference-manual/wasm/README.md) -- WebAssembly (Wasm) diff --git a/docs/reference-manual/embedding/embed-languages.md b/docs/reference-manual/embedding/embed-languages.md index 16ad4a649167..373344a9d64f 100644 --- a/docs/reference-manual/embedding/embed-languages.md +++ b/docs/reference-manual/embedding/embed-languages.md @@ -392,7 +392,7 @@ native-image --language:js --initialize-at-build-time -cp . HelloPolyglot It should be mentioned that you can also include a guest language into the native image, but exclude the JIT compiler by passing the `-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime` option to the builder. Be aware, the flag `-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime` has to placed *after* all the Truffle language/tool options, so that it will override the default settings. -You can build the above example again but this time the created image will only contain the Truffle language interpreter (the GraalVM compiler will not be included in the image) by running: +You can build the above example again but this time the created image will only contain the Truffle language interpreter (the Graal compiler will not be included in the image) by running: ```shell native-image --language:js -Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime --initialize-at-build-time -cp . HelloPolyglotInterpreter ``` @@ -613,7 +613,96 @@ In this code: {% include_relative sandbox-options.md %} -## Dependency setup +## Polyglot Isolates + +On GraalVM Enterprise, a Polyglot engine can be configured to run in a dedicated native image isolate. +This experimental feature is enabled with the `--engine.SpawnIsolate` option. +An engine running in this mode executes within a VM-level fault domain with its own garbage collector and JIT compiler. +The fact that an engine runs within an isolate is completely transparent with respect to the Polyglot API and interoperability: + +```java +import org.graalvm.polyglot.*; + +public class PolyglotIsolate { + public static void main(String[] args) { + Context context = Context.newBuilder("js") + .allowHostAccess(HostAccess.SCOPED) + .allowExperimentalOptions(true) + .option("engine.SpawnIsolate", "true").build(); + Value function = context.eval("js", "x => x+1") + assert function.canExecute(); + int x = function.execute(41).asInt(); + assert x == 42; + } +} +``` + +Since the host's GC and the isolate's GC are not aware of one another, cyclic references between objects on both heaps may occur. +We thus strongly recommend to use [scoped parameters for host callbacks](#controlling-host-callback-parameter-scoping) to avoid cyclic references. + +Multiple contexts can be spawned in the same isolated engine by [sharing engines](#code-caching-across-multiple-contexts): + +```java +public class PolyglotIsolateMultipleContexts { + public static void main(String[] args) { + try (Engine engine = Engine.newBuilder() + .allowExperimentalOptions(true) + .option("engine.SpawnIsolate", "js").build()) { + Source source = Source.create("js", "21 + 21"); + try (Context context = Context.newBuilder() + .engine(engine) + .build()) { + int v = context.eval(source).asInt(); + assert v == 42; + } + try (Context context = Context.newBuilder() + .engine(engine) + .build()) { + int v = context.eval(source).asInt(); + assert v == 42; + } + } + } +} +``` + +Note how we need to specify the language for the isolated engine as a parameter to `--engine.SpawnIsolate` in this case. +The reason is that an isolated engine needs to know which set of languages should be available. +Behind the scenes, GraalVM will then locate the corresponding native image language library. +If only a single language is selected, then the library for the language will be loaded. +If multiple languages are selected, then `libpolyglot`, the library containing all Truffle languages shipped with GraalVM, will be loaded. +If a matching library is not available, creation of the engine will fail. + +Only one language library can be loaded during GraalVM's lifetime. +This means that the first isolated engine that is created sets the default for the remainder of the execution: if an isolated engine with solely Javascript was created first, only Javascript will be available in isolated languages. + +### Passing Native Image Runtime Options +Engines running in an isolate can make use of [native image runtime options](../native-image/HostedvsRuntimeOptions/) by passing `--engine.IsolateOption.