Polyglot


The Polyglot engine of the GraalVM allows the execution and interoperability of language interpreters for additional programming languages. This release of the GraalVM contains language interpreters for three well-known languages (JavaScript, Ruby, and R), and a teaching language (SimpleLanguage).

JavaScript: Graal.js


Graal.js is an ECMAScript (ECMA-262) version 2017 compliant JavaScript engine. It is based on the Polyglot engine and uses Graal as compiler, guaranteeing high performance and language interoperability with other Truffle-based language engines.


What are the key benefits of Graal.js?

  • Peak Performance: JavaScript applications executed with Graal.js and compiled with Graal reach a peak performance competitive to the leading JavaScript engines.
  • Server-Side JavaScript: Graal.js includes the ability to run server-side Node.js applications. It provides support for a wide range of Node.js applications, including npm modules implemented in native C/C++.
  • Language Interoperability: Providing interoperability to other Polyglot languages and to Java without sacrificing performance is another goal of Graal.js.

How can I execute JavaScript applications with Graal.js?

This release provides an execution system for JavaScript applications. You can execute ECMAScript 6 compliant JavaScript programs on the command-line shell using the js command included in the release:
 

# js mySourceFile.js

Take care to actually use the js command of this release, e.g. by adding the bin directory to the path:
 
# export PATH=/path/to/GraalVM/bin:$PATH
 

How can I execute Node.js applications with Graal.js?

You can also use the node executable to execute Node.js applications. Several example applications can be found in the example/node directory of the release:
 
# node myNodeApplication.js

For more details, see the README file in the release.

 

 

Ruby: TruffleRuby


TruffleRuby is high performance implementation of the Ruby programming language, compatible with MRI 2.3.

TruffleRuby is progressing fast but is currently probably not ready for you to try running your full Ruby application on. Support for critical C extensions such as OpenSSL and Nokogiri is missing. TruffleRuby is ready for experimentation and curious end-users to try on their gems and smaller applications.
 

What are the key benefits of TruffleRuby?

  • Peak Performance: Using the Graal compiler, TruffleRuby achieves performance on benchmarks and real application code that is well beyond anything possible with current implementations of Ruby.
  • Fast Metaprogramming: TruffleRuby is designed to optimise Ruby as it is actually used - metaprogramming included. Operations like dynamic sends, dynamically defined methods, bindings and eval are all fast.

How can I execute Ruby applications with TruffleRuby?


# ruby my_source_file.rb
  

How can I use RubyGems or Bundler?

TruffleRuby currently cannot run gem install out of the box because of incomplete support for OpenSSL and Nokogiri. However there is a workaround which can be used to get both gem install and bundler install working.
  

ruby -r bundler-workarounds -S gem install bundler
ruby -r bundler-workarounds -S bundle install
ruby -r bundler-workarounds -S bundle update

`bundle exec` does not need the `bundler-workarounds` module loaded.
  

ruby -S bundle exec bin/rails server

 
 

FastR


FastR is an Graal based implementation of the R language. It uses the latest Graal technology to achieve high performance but also tries to not compromise on compatibility with GNUR.


What are the key benefits of FastR?

Peak Performance: R applications executed with FastR and compiled with Graal outperform existing R execution engines.
Compatiblity: R aims to be fully compatible with GNUR. Existing applications developed with the R reference implementations should run without changes.
Language Interoperability: Providing interoperability to other Graal-based languages like Java, Ruby or JavaScript without sacrificing performance.
 

How can I run R applications with FastR?

The R language shell can be started with:
 
# ./bin/R

R scripts can be run with the following command:
 
# ./bin/RScript mySourceFile.js


How complete is FastR?

FastR is still in an experimental stage. Please expect rough edges and non-working language features: