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/examples/examples.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -20,5 +20,5 @@ Here you can also find an even more sophisticated example of polyglot native exe
20
20
21
21
The [Java/Kotlin Native Image Example](java-kotlin-aot.md) demonstrates how to compile a Java and Kotlin application ahead-of-time, and illustrates the performance gain.
22
22
23
-
The [Oracle Database Example](examples/mle-oracle.md) contains instructions on how to run the Oracle Database Multilingual Engine (MLE) which is the integration of GraalVM in the Oracle
23
+
The [Oracle Database Example](mle-oracle.md) contains instructions on how to run the Oracle Database Multilingual Engine (MLE) which is the integration of GraalVM in the Oracle
Copy file name to clipboardExpand all lines: docs/reference-manual/java/README.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -33,5 +33,5 @@ This mode allows you to [debug the GraalVM compiler with a Java debugger](Operat
33
33
34
34
## Interoperability
35
35
36
-
In addition to running JVM-based languages on GraalVM, you can also call any other language implemented with the [Truffle language implementation framework](../truffle-framework/README.md) directly from Java.
37
-
See the [Polyglot Programming](../polyglot-programming.md) and [Embedding Languages](../embed-languages.md) guides for more information about interoperability with other programming languages.
36
+
In addition to running JVM-based languages on GraalVM, you can also call any other language implemented with the [Truffle language implementation framework](../../../truffle/docs/README.md) directly from Java.
37
+
See the [Polyglot Programming](../polyglot-programming.md) and [Embedding Languages](../embedding/embed-languages.md) guides for more information about interoperability with other programming languages.
Copy file name to clipboardExpand all lines: docs/tools/graalvm-insight.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -146,7 +146,7 @@ Hello from GraalVM Ruby!
146
146
It is necessary to start the Ruby launcher with the `--polyglot` parameter, as the _source-tracing.js_ script remains written in JavaScript.
147
147
148
148
A user can instrument any language on top of GraalVM, but also the Insight scripts can be
149
-
written in any of the GraalVM supported languages (implemented with the [Truffle language implementation framework](../graalvm-as-a-platform/truffle-framework/README.md)).
149
+
written in any of the GraalVM supported languages (implemented with the [Truffle language implementation framework](../../truffle/docs/README.md)).
Copy file name to clipboardExpand all lines: docs/tools/vscode/micronaut/README.md
-2Lines changed: 0 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -112,8 +112,6 @@ For more details, continue reading to the [Micronaut documentation](https://guid
112
112
The Micronaut support in VSCode also allows to build and deploy Docker image to a Docker Registry.
113
113
Use action View > Command Palette > Micronaut: Deploy... and select **dockerPush** to deploy dockerized Micronaut application or **dockerPushNative** to build and push docker with a native executable of Micronaut application.
Besides that, you can also push a Micronaut application or a native executable to a Docker Registry from the VS Code terminal window. A particular Docker Registry can be configured in the build, see the [Micronaut Deploying Application](https://micronaut-projects.github.io/micronaut-maven-plugin/latest/examples/deploy.html) documentation.
Copy file name to clipboardExpand all lines: truffle/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Software of the Johannes Kepler University Linz.
17
17
18
18
## Using Truffle
19
19
20
-
If you are looking for documentation on how to use Truffle, please consult the documentation [here](../docs/truffle-framework/README.md) or [on the website](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/).
20
+
If you are looking for documentation on how to use Truffle, please consult the documentation [here](docs/README.md) or [on the website](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/).
Different Truffle (guest) languages may use different mechanisms for exiting. This is not optimal as a Truffle language has no way to detect and handle an exit triggered by a different language.
4
11
5
-
As of 22.0 Truffle has support for polyglot context hard explicit exit triggered by guest languages using [TruffleContext.closeExited(Node,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleContext.html#closeExited-com.oracle.truffle.api.nodes.Node-int-).
12
+
As of 22.0 Truffle has support for polyglot context hard explicit exit triggered by guest languages using [TruffleContext.closeExited(Node,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleContext.html#closeExited-com.oracle.truffle.api.nodes.Node-int-).
6
13
It provides a unified way for languages to trigger the exit of the underlying polyglot context. When triggered, all initialized
7
14
guest languages are first notified using [TruffleLanguage.exitContext(C,ExitMode,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html#exitContext-C-com.oracle.truffle.api.TruffleLanguage.ExitMode-int), then all context threads are stopped, and finally, the context is closed.
8
-
The hard explicit exit is simply referred to as "hard exit".
15
+
The hard explicit exit is simply referred to as "hard exit".
9
16
10
-
The hard exit is only one of the three types of exit in Truffle. There are the following types of exit.
17
+
The hard exit is only one of the three types of exit in Truffle. There are the following types of exit.
11
18
12
19
* The new hard exit introduced above
13
20
* Hard exit notifications are executed with `ExitMode.HARD` as the second parameter of `TruffleLanguage.exitContext(C,ExitMode,int)`.
@@ -19,9 +26,9 @@ The hard exit is only one of the three types of exit in Truffle. There are the f
19
26
* Explicit exit triggered by throwing a Truffle exception of the exception type `ExceptionType.EXIT`.
20
27
* The exception is not automatically thrown in other threads by Truffle and it does not trigger exit notifications or context close on its own.
21
28
* The context is still fully usable after a soft exit and the soft exit can be followed by either the natural or the hard exit.
22
-
29
+
23
30
For completeness, a polyglot context can be also closed by cancelling it using `Context.close(true)`, `TruffleContext.closeCancelled(Node,String)`, or `TruffleContext.closeResourceExhausted(Node,String)`.
24
-
The cancel operation leads to immediate stopping of all context threads and closing the context without any exit notifications.
31
+
The cancel operation leads to immediate stopping of all context threads and closing the context without any exit notifications.
25
32
26
33
## Soft exit
27
34
@@ -44,7 +51,7 @@ The natural exit occurs during a normal context close triggered by `Context.clos
44
51
3. All initialized languages are finalized.
45
52
*`TruffleLanguage.finalizeContext(C)` is called for all initalized languages.
46
53
* Guest code runs normally during finalization.
47
-
54
+
48
55
4. All languages are disposed.
49
56
*`TruffleLanguage.disposeContext(C)` is called for all languages.
50
57
@@ -66,42 +73,42 @@ a special `ThreadDeath` cancel exception depending on whether the hard exit or t
66
73
2. Exit notifications for all initialized languages are executed - [TruffleLanguage.exitContext(C,ExitMode,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html#exitContext-C-com.oracle.truffle.api.TruffleLanguage.ExitMode-int), where `ExitMode.HARD` is used as the `ExitMode` parameter.
67
74
* Guest code runs normally during exit notifications.
68
75
* If the context is not cancelled during exit notifications (during step 2a) and reaches step 2b, the exit process proceeds with the next step. Otherwise, the exit notifications are interrupted and the context is immediately cancelled.
69
-
76
+
70
77
3. All context threads are forced to stop by throwing a special `ThreadDeath` exit exception from Truffle safepoints.
71
78
* To exit threads reliably, languages need to ensure that `ThreadDeath` is always immediately rethrown and guest language exception handlers and finally blocks are not run.
72
79
* The embedder threads eventually throw a `PolyglotException` to the host with `PolyglotException.isExit() == true` and `PolyglotException.getExitStatus()`
73
80
being equal to the exit code originally specified as the second parameter to the first call to`TruffleContext.closeExited(Node,int)`.
74
81
* Note that from step 3 the exit process is similar to the cancelling process as indicated by the figure, but the cancelling process uses a special `ThreadDeath` cancel exception
75
-
and the `PolyglotException` thrown to the host has `PolyglotException.isCancelled() == true` instead of `PolyglotException.isExit() == true`.
82
+
and the `PolyglotException` thrown to the host has `PolyglotException.isCancelled() == true` instead of `PolyglotException.isExit() == true`.
76
83
77
84
4. All initialized languages are finalized.
78
85
*`TruffleLanguage.finalizeContext(C)` is called for all initalized languages.
79
86
* Running any guest code in `TruffleLanguage.finalizeContext(C)` will throw the special `ThreadDeath` exit exception from the first Truffle safepoint.
80
87
* Languages should skip any finalization that would require running guest code. A language can find out if it can run guest code in `TruffleLanguage.finalizeContext(C)` by checking if `TruffleLanguage.exitContext(C,ExitMode,int)` was previously called with ExitMode.NATURAL,
81
88
or by checking that `TruffleContext.isClosed()` returns `false`.
82
89
83
-
90
+
84
91
5. All languages are disposed.
85
92
*`TruffleLanguage.disposeContext(C)` is called for all languages.
86
-
93
+
87
94
6. The context is closed.
88
95
89
96
### Behavior if useSystemExit is enabled
90
97
91
98
1. The exit is triggered by [TruffleContext.closeExited(Node,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleContext.html#closeExited-com.oracle.truffle.api.nodes.Node-int-).
92
99
* Same as with system exit disabled.
93
-
100
+
94
101
2. Exit notifications for all initialized languages are executed - [TruffleLanguage.exitContext(C,ExitMode,int)](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html#exitContext-C-com.oracle.truffle.api.TruffleLanguage.ExitMode-int), where `ExitMode.HARD` is used as the `ExitMode` parameter.
95
102
* Same as with system exit disabled.
96
-
103
+
97
104
3.`System.exit(int)` is called to terminate the whole host application providing the fastest exit possible.
98
105
* The exit code passed to `System.exit(int)`
99
-
is the one originally specified as the second parameter to the first call to`TruffleContext.closeExited(Node,int)`.
106
+
is the one originally specified as the second parameter to the first call to`TruffleContext.closeExited(Node,int)`.
100
107
101
108
## Example Usage
102
109
103
110
The [SimpleLanguage](https://github.com/graalvm/simplelanguage) demonstrates the usage of the hard context exit. The following aspects are demonstrated.
104
111
105
112
*[SLExitBuiltin](https://github.com/graalvm/simplelanguage/blob/master/language/src/main/java/com/oracle/truffle/sl/builtins/SLExitBuiltin.java) demonstrates triggering the context exit.
106
113
*[SLRegisterShutdownHookBuiltin](https://github.com/graalvm/simplelanguage/blob/master/language/src/main/java/com/oracle/truffle/sl/builtins/SLRegisterShutdownHookBuiltin.java) demonstrates registration of shutdown hooks that are executed during the exit notification defined in [SLLanguage](https://github.com/graalvm/simplelanguage/blob/master/language/src/main/java/com/oracle/truffle/sl/SLLanguage.java).
107
-
*[SLExitTest](https://github.com/graalvm/simplelanguage/blob/master/language/src/test/java/com/oracle/truffle/sl/test/SLExitTest.java) demonstrates the usage of the builtins defined above.
114
+
*[SLExitTest](https://github.com/graalvm/simplelanguage/blob/master/language/src/test/java/com/oracle/truffle/sl/test/SLExitTest.java) demonstrates the usage of the builtins defined above.
0 commit comments