Skip to content

The Mate Reflective VM implemented in top of the TruffleSOM VM.

License

Notifications You must be signed in to change notification settings

tobini/TruffleMATE

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TruffleMate - A Reflective Execution Environment implemented using Oracle's Truffle Framework

Introduction

Mate is an approach for building Virtual Machines that expose their whole structure and behavior to the language level Mate. A MOP then enables to adapt reflectively the Virtual Machine behavior at run time. TruffleMate is an implementation of the Mate approach in Truffle that started as a branch from the TruffleSOM VM.

This repository contains an extension to the Truffle-based implementation of SOM, including SOM's standard library, a number of examples and the Mate v1 Metaobject protocol.

Moreover, TruffleMATE implements an optimization model for making the VM not only reflective, but also efficient, presenting similar performance results than standard VMs when considering peak performance.

Obtaining and Running TruffleMate

To checkout the code:

git clone https://github.com/charig/TruffleMate.git

Then, TruffleMate can be build with Ant:

ant jar or ant compile

Afterwards, the tests can be executed with:

./som -G -cp Smalltalk:TestSuite TestHarness

A simple Hello World program is executed with:

./som -G -cp Smalltalk:Examples Hello

The --mate -activateMate options runs the system with the Mate MOP enabled. Note that the classpath must be also extended with the MOP classes found under Smalltalk/MATE. The -G runs TruffleMATE in interpreter mode. For running in combination with GRAAL install graal and remove the -G option.

When working on TruffleMate, for instance in Eclipse, it is helpful to download the source files for Truffle as well:

ant develop

Information on previous authors are included in the AUTHORS file. This code is distributed under the MIT License. Please see the LICENSE file for details.

TruffleMate Implementation

TruffleSOM implements a file-based Smalltalk with most of the language features common to other Smalltalks. This includes support for objects, classes, methods, closures/blocks/lambdas, non-local returns, and typical reflective operations, e.g., method invocation or object field access.

The implementation of TruffleSOM is about 3500 lines of code in size and is a concise but comprehensive example for how to use the Truffle framework to implement standard language features.

Its parser creates a custom AST that is geared towards representing the executable semantics. Thus, we did not include AST nodes that have structural purpose only. Instead, we concentrated on the AST nodes that are relevant to express Smalltalk language semantics.

Currently TruffleSOM demonstrates for instance:

Build Status

Thanks to Travis CI, all commits of this repository are tested. The current build status is: Build Status

About

The Mate Reflective VM implemented in top of the TruffleSOM VM.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.7%
  • Python 1.3%