Minimal example for Truffle?
Stefan Fehrenbach
stefan.fehrenbach at gmail.com
Wed Apr 9 17:34:13 UTC 2014
Hello Truffle folks,
I am working on a very simple language to get acquainted with
Truffle. My ultimate goal is to write a JIT-compiled
parser/grammar interpreter, as I mentioned to Thomas Würthinger
at SPLASH'13.
My question: is there a simple stand-alone example that shows
Truffle/Graal actually doing "its thing"?
In the FAQ it says: "When you run with --vm server, Truffle is
fairly talkative and will tell you when methods are (Truffle)
compiled and when they are deoptimized. If it doesn't tell you
it's compiling anything, then nothing is getting compiled."
When I run my own language [1] it does not print anything.
When I run the "simple language" with one of the test files, it
prints something, but nothing like machine code, see below:
/home/stefan/opt/graalvm-jdk1.8.0/bin/java
-G:+TraceTruffleCompilationDetails -G:TruffleCompilationThreshold=1
-Didea.launcher.port=7532
-Didea.launcher.bin.path=/usr/share/intellijidea-ce/bin
-Dfile.encoding=UTF-8 -classpath
/home/stefan/opt/graalvm-jdk1.8.0/lib/dt.jar:/home/stefan/opt/graalvm-jdk1.8.0/lib/tools.jar:/home/stefan/opt/graalvm-jdk1.8.0/lib/jconsole.jar:/home/stefan/opt/graalvm-jdk1.8.0/lib/sa-jdi.jar:/home/stefan/src/sl/out/production/sl:/home/stefan/src/sl/truffle-0.2.jar:/usr/share/intellijidea-ce/lib/idea_rt.jar
com.intellij.rt.execution.application.AppMain
com.oracle.truffle.sl.SLMain /home/stefan/src/sl/LoopCall.sl
== running on Graal Truffle Runtime
[truffle] opt queued root add <split>
|ASTSize 11 (0/0) |C/T 11/ 3 |L/T
11/ 11 |Inval#/Replace# 0/ 5
[truffle] opt start root add <split>
|ASTSize 11 (0/0) |C/T 30/ 3 |L/T
32/ 11 |Inval#/Replace# 0/ 5
[truffle] opt queued root add <split>
|ASTSize 11 (0/0) |C/T 11/ 3 |L/T
11/ 11 |Inval#/Replace# 0/ 5
[truffle] opt queued root loop <split>
|ASTSize 32 (0/0) |C/T 3/ 4 |L/T
2003/ 2013 |Inval#/Replace# 0/ 11
1000
Is this all I can expect, and if so, how do I make it compile things
and show me the results?
And is there something I need to do to make Truffle print these
compilation details for my own project or should this just work,
meaning there is something wrong with my use of Truffle in
general?
Anyways, great work. What I have seen of Truffle so far is very
promising and great fun to play with. :)
Best,
Stefan
[1] https://github.com/fehrenbach/tuber-basic
(This currently has some severe issues with frames and variables, but
it runs interpreted.)
More information about the graal-dev
mailing list