TruffleSOM: A Smalltalk implemented with Truffle
java at stefan-marr.de
Wed Jul 10 07:17:31 PDT 2013
On 28 Jun 2013, at 15:23, Stefan Marr <java at stefan-marr.de> wrote:
> In order to get to know the Truffle framework better, I ported SOM, a little
> Smalltalk bytecode interpreter written in Java, to Truffle.
As a brief followup, with the help of Thomas and Michael, I corrected the implementation to use packed and materialized frames where appropriate.
With these changes it is possible to run TruffleSOM on the Graal VM.
The tests run, the benchmarks however, don't complete yet. Looks to me like the optimization phase trips over something that is not quite right yet and sees a null where a proper object should be. Will look into that later.
Currently more interesting to me is the general question whether Truffle is supposed to support non-local returns or similar language features.
When moving from purely using VirtualFrames to the different Frame types Truffle is expecting, I had to find an ad hoc solution, and I am not sure whether that is the best way of doing things.
Implementing non-local returns with when just using VirtualFrames is straight forward, because I can check the frames for their identity and know when I found the correct frame.
When using the proper frame classes however, I am using an extra frame slot, which contains a marker object that I can check when unwinding the stack with a control flow exception.
Not sure whether that is the ideal solution, especially with respect to performance.
For SOM/Smalltalk, the functionally that would be necessary includes the ability to determine the target frame for a non-local return, as well as to be able to check whether the frame is actually still on the stack in order to forbid non-local returns from blocks/lambdas that have escaped their activation context.
Thanks and best regards
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
Phone: +32 2 629 2974
Fax: +32 2 629 3525
More information about the graal-dev