Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gluon-bot committed Sep 18, 2023
2 parents e2e34b9 + a095b07 commit d054719
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 23 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![GraalVM downloads][badge-dl]][downloads] [![GraalVM docs][badge-docs]][docs] [![GraalVM on Slack][badge-slack]][slack] [![GraalVM on Twitter][badge-twitter]][twitter] [![GraalVM on YouTube][badge-yt]][youtube] [![GraalVM Gate][badge-gate]][gate] [![License][badge-license]](#license)

GraalVM is a high-performance JDK distribution designed to accelerate the execution of applications written in Java and other JVM languages along with support for JavaScript, Ruby, Python, and a number of other popular languages.
GraalVM is a high-performance JDK distribution that compiles your Java applications ahead of time into standalone binaries. These binaries start instantly, provide peak performance with no warmup, and use fewer resources.
You can use GraalVM just like any other Java Development Kit in your IDE.

The project website at [https://www.graalvm.org/][website] describes how to [get started][getting-started], how to [stay connected][community], and how to [contribute][contributors].

Expand Down Expand Up @@ -51,7 +52,6 @@ Name | Description
[SimpleLanguage] | A simple example language built with the Truffle framework.
[SimpleTool] | A simple example tool built with the Truffle framework.
[TruffleRuby] | Implementation of the Ruby language.
[VS Code Extensions][vscode-extensions] | VS Code extensions for GraalVM.

## License

Expand Down Expand Up @@ -98,6 +98,5 @@ Component(s) | License
[truffle]: https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/
[truffleruby]: https://github.com/oracle/truffleruby
[twitter]: https://twitter.com/graalvm
[vscode-extensions]: https://github.com/graalvm/vscode-extensions
[website]: https://www.graalvm.org/
[youtube]: https://www.youtube.com/graalvm
29 changes: 14 additions & 15 deletions docs/reference-manual/embedding/embed-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ Here is an example Maven dependency setup that you can put into your project:
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>23.1</version>
<version>23.1.0</version>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<!-- select included language -->
<artifactId>js|ruby|python|java|llvm|wasm|languages</artifactId>
<version>23.1</version>
<!-- Select language: js, ruby, python, java, llvm, wasm, languages-->
<artifactId>js</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
<!-- add additional languages if needed -->
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<!-- select included tools -->
<artifactId>profiler|inspect|coverage|dap|tools</artifactId>
<version>23.1</version>
<!-- Select tools: profiler, inspect, coverage, dap, tools -->
<artifactId>tools</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
<!-- add additional tools if needed -->
Expand Down Expand Up @@ -706,13 +706,13 @@ For example, a dependency on isolated JavaScript can be configured by adding a M
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>23.1</version>
<version>23.1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-isolate</artifactId>
<version>23.1</version>
<version>23.1.0</version>
<type>pom</type>
</dependency>
```
Expand Down Expand Up @@ -959,15 +959,15 @@ To use it, include a `META-INF/services/javax.script.ScriptEngineFactory` file i
This will allow the default `javax.script.ScriptEngineManager` to discover the language automatically.
Alternatively, the factory can be registerd via `javax.script.ScriptEngineManager#registerEngineName` or instantiated and used directly.
It is best practice to close the `ScriptEngine` when no longer used rather than relying on finalizers.
The best practice is to close the `ScriptEngine` when no longer used rather than relying on finalizers.
To close it, use `((AutoCloseable) scriptEngine).close();` since `ScriptEngine` does not have a `close()` method.
Note that [Graal.js](../js/) provides [a ScriptEngine implementation](../js/ScriptEngine/) for users migrating from the Nashorn JavaScript engine that was deprecated in JDK 11, so this method here is not needed.
<details>
<summary>A ScriptEngineFactory for Truffle languages in a single file</summary>
<summary>Expand to see the <code>ScriptEngineFactory</code> implementation for Truffle languages in a single file.</summary>
```java
<pre class="language-java"><code>
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -1564,6 +1564,5 @@ public final class CHANGE_NAME_EngineFactory implements ScriptEngineFactory {
}
}
}
```
</details>
</code></pre>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
@AlwaysByReference(type = Context.class, startPointClass = NativeContext.class)
@AlwaysByReference(type = LanguageAPI.class, startPointClass = NativeCustomLanguageDispatch.class)
@AlwaysByReference(type = Record.class, startPointClass = NativeRecord.class)
@AlwaysByReference(type = Handler.class, startPointClass = HSHandler.class)
abstract class HSAlwaysByReferenceHandler extends HSObject implements Handler {
HSAlwaysByReferenceHandler(JNIEnv env, JObject handle) {
super(env, handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ abstract class HSHandler extends HSObject implements Handler {
public abstract void publish(@ByReference(NativeCustomLanguageDispatch.class) LanguageAPI language,
@ByReference(NativeRecord.class) Record record);

@Override
@ByReference(HSHandler.class)
public abstract Handler combine(@ByReference(HSHandler.class) Handler h1, @ByReference(HSHandler.class) Handler... others);

@Override
@ByReference(NativeContext.class)
public abstract Context getContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ interface Handler {

void publish(LanguageAPI language, Record record);

Handler combine(Handler h1, Handler... others);

Context getContext();
}
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,7 @@ private MarshallerData lookupMarshaller(ExecutableElement method, TypeMirror typ
} else {
AnnotationMirror annotationMirror;
DeclaredType endPointClass = null;
if ((annotationMirror = findByReference(annotationMirrors)) != null ||
(type.getKind() == TypeKind.DECLARED && (endPointClass = alwaysByReference.get(Utilities.getQualifiedName(type))) != null)) {
if ((annotationMirror = findByReference(annotationMirrors)) != null || (endPointClass = resolveAlwaysByReference(type, alwaysByReference)) != null) {
DeclaredType referenceType = annotationMirror != null ? (DeclaredType) getAnnotationValue(annotationMirror, "value") : endPointClass;
TypeElement referenceElement = (TypeElement) referenceType.asElement();
boolean useCustomReceiverAccessor = annotationMirror != null && (boolean) getAnnotationValueWithDefaults(annotationMirror, "useCustomReceiverAccessor");
Expand Down Expand Up @@ -673,6 +672,17 @@ private MarshallerData lookupMarshaller(ExecutableElement method, TypeMirror typ
return res;
}

private static DeclaredType resolveAlwaysByReference(TypeMirror type, Map<String, DeclaredType> alwaysByReference) {
TypeMirror useType = type;
if (useType.getKind() == TypeKind.ARRAY) {
useType = ((ArrayType) useType).getComponentType();
}
if (useType.getKind() == TypeKind.DECLARED) {
return alwaysByReference.get(Utilities.getQualifiedName(useType));
}
return null;
}

private List<? extends AnnotationMirror> filterMarshallerAnnotations(List<? extends AnnotationMirror> annotationMirrors,
Collection<? extends DeclaredType> ignoredAnnotations) {
List<AnnotationMirror> result = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,17 @@ private Object checkImageHeapInstance(Object obj) {
});

if (ClassInitializationOptions.StrictImageHeap.getValue()) {
msg += System.lineSeparator();
msg += """
If you are seeing this message after enabling %s, this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
To fix this, include %s in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
Please address this problem to be prepared for future releases of GraalVM.
"""
.replaceAll("\n", System.lineSeparator())
.formatted(
SubstrateOptionsParser.commandArgument(ClassInitializationOptions.StrictImageHeap, typeName, "strict-image-heap", true, false),
SubstrateOptionsParser.commandArgument(ClassInitializationOptions.ClassInitialization, typeName, "initialize-at-build-time", true, false));
SubstrateOptionsParser.commandArgument(ClassInitializationOptions.StrictImageHeap, "+", "strict-image-heap", true, false),
SubstrateOptionsParser.commandArgument(ClassInitializationOptions.ClassInitialization, proxyOrLambda ? proxyLambdaInterfaceCSV : typeName,
"initialize-at-build-time", true, false));
}

msg += System.lineSeparator() + "The following detailed trace displays from which field in the code the object was reached.";
Expand Down
2 changes: 1 addition & 1 deletion vm/mx.vm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"name": "graalpython",
"version": "b5c8bc2afded6408e82674d18d649c0b98fa6cc8",
"version": "be997b710049d26ee407feb09ab41ec001e65d39",
"dynamic": True,
"urls": [
{"url": "https://github.com/graalvm/graalpython.git", "kind": "git"},
Expand Down

0 comments on commit d054719

Please sign in to comment.