Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Jun 19, 2024
2 parents b0dcbb4 + b33c897 commit 165fd6d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
41 changes: 35 additions & 6 deletions docs/reference-manual/embedding/embed-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ To summarize, the code cache can be controlled by keeping and maintaining strong

## Polyglot Isolates

On Oracle GraalVM, a Polyglot engine can be configured to run in a dedicated Native Image isolate.
On Oracle GraalVM, a polyglot engine can be configured to run in a dedicated Native Image isolate.
A polyglot engine in this mode executes within a VM-level fault domain with a dedicated garbage collector and JIT compiler.
Polyglot isolates are useful for [polyglot sandboxing](../../security/polyglot-sandbox.md).
Running languages in an isolate works with HotSpot and Native Image host virtual machines.
Expand All @@ -694,22 +694,50 @@ For example, a dependency on isolated JavaScript can be configured by adding a M
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>24.0.0</version>
<version>${graalvm.polyglot.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-isolate</artifactId>
<version>24.0.0</version>
<version>${graalvm.polyglot.version}</version>
<type>pom</type>
</dependency>
```

The downloaded dependency is platform-independent, which contains a native-image for each platform.
We plan to support downloading polyglot isolate native images for individual platforms in a future release.
Starting from the Polyglot API version 24.1.0, the polyglot engine supports polyglot isolates for individual platforms.
To download a polyglot isolate for a specific platform, append the operating system and
CPU architecture classifiers to the polyglot isolate Maven `artifactId`. For example,
to configure a dependency on isolated Python for Linux amd64, add the following Maven dependencies:

```xml
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>${graalvm.polyglot.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>python-isolate-linux-amd64</artifactId>
<version>${graalvm.polyglot.version}</version>
<type>pom</type>
</dependency>
```

Supported platform classifiers are:
* `linux-amd64`
* `linux-aarch64`
* `darwin-amd64`
* `darwin-aarch64`
* `windows-amd64`

For a complete Maven POM file that adds the polyglot isolate Native Image dependency for the current platform,
refer to the [Polyglot Embedding Demonstration](https://github.com/graalvm/polyglot-embedding-demo) on GitHub.


To enable isolate usage with the Polyglot API, the `--engine.SpawnIsolate=true` option must be passed to `Engine` or `Context` when constructed.
The option `engine.SpawnIsolate` may not be available if used on any other JDK than Oracle GraalVM.
The option `engine.SpawnIsolate` may not be available if used on any JDK other than Oracle GraalVM.

```java
import org.graalvm.polyglot.*;
Expand All @@ -734,6 +762,7 @@ Currently, the following languages are available as polyglot isolates:
| Language | Available from |
|-------------------------------|----------------|
| JavaScript (`js-isolate`) | 23.1 |
| Python (`python-isolate`) | 24.1 |

We plan to add support for more languages in future versions.

Expand Down
2 changes: 2 additions & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f
* GR-47956 Added the option `engine.InterpreterCallStackHeadRoom` to protect against stack overflow in the middle of a guest method execution in the interpreter. For the UNTRUSTED polyglot sandbox policy, the value for the option is computed automatically based on the value of the mandatory option `sandbox.MaxASTDepth`, the option `sandbox.MaxStackFrames` is no longer mandatory. The new option is available only in the AOT mode.
* GR-40931 Added experimental support for virtual threads on HotSpot. Not all languages are currently supported for use with virtual threads, please check the language changelog for further information. Truffle debugging, CPU time limits and some memory limits are currently not supported on virtual threads. The number of threads is currently limited to 65535 threads entered per context.
* GR-40931 Using virtual threads in a native-image will now emulate virtual threads using platform threads until Loom support for Truffle languages in native-image is implemented.
* GR-48481: It is now possible to depend on platform-specific Maven artifacts when using polyglot isolates. The `-isolate` Maven artifacts remain platform-independent. However, if platform specific builds are required, consider adding a platform specific suffix to the Maven artifact name, such as `-isolate-linux-amd64`. The reduced binary size of platform specific dependencies can improve build times and reduce the distribution size of your application. For more details, see [Embedding Languages](https://www.graalvm.org/latest/reference-manual/embed-languages/#polyglot-isolates).
* GR-48481: The Python language is now available as a polyglot isolate.

## Version 24.0.0
* (GR-49334) Deprecated the `FileSystems#allowLanguageHomeAccess()` method and introduced `FileSystem#allowInternalResourceAccess()` as a replacement. To ensure compatibility, both methods now provide support for language homes and internal resources.
Expand Down

0 comments on commit 165fd6d

Please sign in to comment.