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
GraalVM is an open ecosystem and allows users to implement a custom language or tool on top of it with the [Truffle language implementation framework](truffle/README.md) which offers APIs for writing interpreters for programming languages in the form of Java programs.
11
+
GraalVM is an open ecosystem and allows users to implement a custom language or tool on top of it with the [Truffle language implementation framework](../../truffle/docs/README.md) which offers APIs for writing interpreters for programming languages in the form of Java programs.
12
12
13
13
GraalVM loads and runs the Truffle framework, which itself is a Java program -- a collection of JAR files -- together with interpreters.
14
14
These get optimized at runtime into efficient machine code for executing loaded programs.
15
15
16
-
Learn more about this framework from its [reference documentation](truffle/README.md).
16
+
Learn more about this framework from its [reference documentation](../../truffle/docs/README.md).
Copy file name to clipboardExpand all lines: docs/graalvm-as-a-platform/implement-instrument.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ These are [onCreate](https://github.com/graalvm/simpletool/blob/master/src/main/
46
46
The `onCreate` and `onDispose` methods are self-explanatory: they are called by the framework when the instrument is created and disposed.
47
47
We will discuss their implementations later, but first let us discuss the remaining one: `getOptionDescriptors`.
48
48
49
-
The [Truffle language implementation framework](/graalvm-as-a-platform/language-implementation-framework/) comes with its own system for specifying command-line options.
49
+
The [Truffle language implementation framework](../../truffle/docs/README.md) comes with its own system for specifying command-line options.
50
50
These options allow tool users to control the tool either from the command line or when creating [polyglot contexts](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/Context.html).
51
51
It is annotation-based, and examples for such options are the [ENABLED](https://github.com/graalvm/simpletool/blob/master/src/main/java/com/oracle/truffle/st/SimpleCoverageInstrument.java#L91) and [PRINT_COVERAGE](https://github.com/graalvm/simpletool/blob/master/src/main/java/com/oracle/truffle/st/SimpleCoverageInstrument.java#L97) fields of `SimpleCoverageInstrument`.
52
52
Both of these are static final fields of the type [OptionKey](https://www.graalvm.org/truffle/javadoc/org/graalvm/options/OptionKey.html) annotated with [Option](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/Option.html) which, similar to the `Registration` annotation, provides some metadata for the option.
@@ -128,7 +128,7 @@ As mentioned before, Simple Tool is a Maven project.
128
128
Setting `JAVA_HOME` to a GraalVM installation and running `mvn package` produces a `target/simpletool-<version>.jar`.
129
129
This is the Simple Tool distribution form.
130
130
131
-
The [Truffle framework](truffle/README.md) offers a clear separation between the language/tooling code and the application code.
131
+
The [Truffle framework](../../truffle/docs/README.md) offers a clear separation between the language/tooling code and the application code.
132
132
For this reason, putting the JAR on the class path will not result in the framework realizing a new tool is needed.
133
133
To achieve this we use `--vm.Dtruffle.class.path.append=/path/to/simpletool-<version>.jar` as is illustrated in a [launcher script for our simple tool](https://github.com/graalvm/simpletool/blob/master/simpletool).
134
134
This script also shows we can [set the CLI options](https://github.com/graalvm/simpletool/blob/master/simpletool#L19) we specified for Simple Tool.
We have found that the easiest way to get started with implementing your own language is by extending an existing language such as SimpleLanguage.
12
12
[SimpleLanguage](https://github.com/graalvm/simplelanguage) is a demonstration language built using the [Language API](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/package-summary.html).
13
13
The SimpleLanguage project provides a showcase on how to use the Language APIs for writing your own language.
14
-
It aims to use most of the available [Truffle language implementation framework](truffle/README.md) (henceforth "Truffle") features, and documents their use extensively with inline source documentation.
14
+
It aims to use most of the available [Truffle language implementation framework](../../truffle/docs/README.md) (henceforth "Truffle") features, and documents their use extensively with inline source documentation.
15
15
16
16
To start, ensure [Maven3](https://maven.apache.org/download.cgi) and GraalVM are available in your system.
17
17
@@ -48,7 +48,7 @@ The SimpleLanguage demonstration language is licensed under the [Universal Permi
48
48
49
49
## IDE Setup
50
50
51
-
The [Truffle framework](truffle/README.md) provides language-agnostic infrastructure to realize standard IDE features by providing additional APIs.
51
+
The [Truffle framework](../../truffle/docs/README.md) provides language-agnostic infrastructure to realize standard IDE features by providing additional APIs.
52
52
If you would like to experiment with your language and get the benefits of an IDE, consider importing SimpleLanguage as an example.
53
53
54
54
### Eclipse
@@ -248,7 +248,7 @@ A sample POM using `--upgrade-module-path` to export Language API packages can b
248
248
249
249
### Other JVM Implementations
250
250
251
-
Unlike GraalVM, which includes all the dependencies needed to run a language implemented with [Truffle](truffle/README.md), other JVM implementations need additional JARs to be present on the class path.
251
+
Unlike GraalVM, which includes all the dependencies needed to run a language implemented with [Truffle](../../truffle/docs/README.md), other JVM implementations need additional JARs to be present on the class path.
252
252
These are the Language API and GraalVM SDK JARs available from Maven Central.
253
253
254
254
Assuming `JAVA_HOME` points to a stock JDK installation, and that the current working directory is the `simplelanguage` directory and the Language API and GraalVM SDK JARs are present in that directory, one can execute SimpleLanguage with the following command:
Copy file name to clipboardExpand all lines: docs/reference-manual/java-on-truffle/ImplementationDetails.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Java on Truffle is a minified Java VM that implements all core components of a V
21
21
* Java Debug Wire Protocol (JDWP)
22
22
23
23
Java on Truffle reuses all JARs and native libraries from GraalVM.
24
-
All native libraries and methods are loaded/accessed/called via [Truffle Native Function Interface (JNI)](../../graalvm-as-a-platform/truffle/NFI.md).
24
+
All native libraries and methods are loaded/accessed/called via [Truffle Native Function Interface (JNI)](../../../truffle/docs/NFI.md).
25
25
JNI handles are implemented in Java on Truffle, e.g., all Truffle NFI methods only receive and return primitives.
26
26
Some methods are substituted for performance, e.g., `Math.sqrt`, `System.arraycopy`, avoiding the expensive transition to native.
27
27
@@ -33,7 +33,7 @@ This mode is not used when running in a native image since there will be no conf
33
33
34
34
* Java on Truffle does not implement the [JVM Tool Interface (JVMTI)](https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html). As a result, it does not support the `-agentlib`, or `-agentpath` VM options.
35
35
* Java on Truffle does not implement the `java.lang.instrument` interface. As a result it does not support the `-javaagent` VM option.
36
-
* Java on Truffle currently uses the standard native libraries from the Java core library. This requires allowing a polyglot `Context` native access. Because of the way these libraries are loaded (via [Truffle NFI](../../graalvm-as-a-platform/truffle/NFI.md)), running on top of HotSpot only works on Linux (with `glibc`). Running as part of a native image works on Linux, Windows, and macOS but it currently limited to one context.
36
+
* Java on Truffle currently uses the standard native libraries from the Java core library. This requires allowing a polyglot `Context` native access. Because of the way these libraries are loaded (via [Truffle NFI](../../../truffle/docs/NFI.md)), running on top of HotSpot only works on Linux (with `glibc`). Running as part of a native image works on Linux, Windows, and macOS but it currently limited to one context.
37
37
* Support for [Java Management Extensions (JMX)](https://docs.oracle.com/javase/tutorial/jmx/index.html) is partial and some methods might return partial data.
38
38
* The [Debugger Protocol Implementation (JDWP)](https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html) lacks some capabilities compared to HotSpot. It will correctly report the supported [capabilities](https://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_VirtualMachine_Capabilities). In particular actions that require to enumerate all Java objects are not supported. However it does support a few hot reloading cases that HotSpot does not. See [Enhanced HotSwap Capabilities with Java on Truffle](Demos.md#enhanced-hotswap-capabilities-with-java-on-truffle).
39
39
* When the `java.MultiThreaded` option is set to "false", [reference processing](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ref/package-summary.html) will not happen. Depending on the application, this could create resource leaks. Note that this option is set to "false" automatically if Java on Truffle runs in a context where a single-threaded language is enabled (e.g., JavaScript).
*[Passing Options Using JVM Arguments](#passing-options-using-jvm-arguments)
16
16
17
-
GraalVM allows users to write polyglot applications that seamlessly pass values from one language to another by means of the [Truffle language implementation framework](../../../truffle/docs/README.md) (henceforth "Truffle").
17
+
GraalVM allows users to write polyglot applications that seamlessly pass values from one language to another by means of the [Truffle language implementation framework](../../truffle/docs/README.md) (henceforth "Truffle").
18
18
19
19
Truffle is a Java library for building programming languages implementations as interpreters for self-modifying Abstract Syntax Trees.
20
20
When writing a language interpreter with Truffle, it will automatically use the GraalVM compiler as a just-in-time compiler for the language.
0 commit comments