TruffleRuby - GraalVM Community Edition 1.0 RC6
Pre-release
Pre-release
TruffleRuby is high performance implementation of the Ruby programming language, compatible with MRI 2.4.4.
TruffleRuby is progressing fast but is currently probably not ready for you to try running your full Ruby application on. However it is ready for experimentation and curious end-users to try on their gems and smaller applications.
TruffleRuby runs Rails, and passes the majority of the Rails test suite. But it is missing support for Nokogiri and ActiveRecord database drivers which makes it not practical to run real Rails applications at the moment.
The Ruby language components can be installed in GraalVM using the gu utility.
Release Notes
New features:
Polyglot.exportcan now be used with primitives, and will now convert
strings to Java, and.importwill convert them from Java.- Implemented
--encoding,--external-encoding,--internal-encoding. rb_object_taintedand similar C functions have been implemented.rb_struct_define_underhas been implemented.RbConfig::CONFIG['sysconfdir']has been implemented.Etchas been implemented (#1403).- The
-Xcexts=falseoption disables C extensions. - Instrumentation such as the CPUSampler reports methods in a clearer way like
Foo#bar,Gem::Specification.each_spec,block in Foo#barinstead of just
bar,each_spec,block in bar(which is what MRI displays in backtraces). - TruffleRuby is now usable as a JSR 223 (
javax.script) language. - A migration guide from JRuby (
doc/user/jruby-migration.md) is now included. kind_of?works as an alias foris_a?on foreign objects.- Boxed foreign strings unbox on
to_s,to_str, andinspect.
Bug fixes:
- Fix false-positive circular warning during autoload.
- Fix Truffle::AtomicReference for
concurrent-ruby. - Correctly look up
llvm-linkalongclangandoptso it is no longer
needed to add LLVM toPATHon macOS for Homebrew and MacPorts. - Fix
aliasto work when in a refinement module (#1394). Array#reject!no longer truncates the array if the block raises an
exception for an element.- WeakRef now has the same inheritance and methods as MRI's version.
- Support
-Wllinker argument for C extensions. Fixes compilation ofmysql2
andpg. - Using
Module#const_getwith a scoped argument will now correctly
autoload the constant if needed. - Loaded files are read as raw bytes, rather than as a UTF-8 string and then
converted back into bytes. - Return 'DEFAULT' for
Signal.trap(:INT) {}. Avoids a backtrace when quitting
a Sinatra server with Ctrl+C. - Support
Signal.trap('PIPE', 'SYSTEM_DEFAULT'), used by the gemrouge
(#1411). - Fix arity checks and handling of arity
-2forrb_define_method(). - Setting
$SAFEto a negative value now raises aSecurityError. - The offset of
DATAis now correct in the presence of heredocs. - Fix double-loading of the
jsongem, which led to duplicate constant
definition warnings. - Fix definition of
RB_NIL_Pto be early enough. Fixes compilation of
msgpack. - Fix compilation of megamorphic interop calls.
Kernel#singleton_methodsnow correctly ignores prepended modules of
non-singleton classes. Fixes loadingsasswhenactivesupportis loaded.- Object identity numbers should never be negative.
Performance:
- Optimize keyword rest arguments (
def foo(**kwrest)). - Optimize rejected (non-Symbol keys) keyword arguments.
- Source
SecureRandom.random_bytesfrom/dev/urandomrather than OpenSSL. - C extension bitcode is no longer encoded as Base64 to pass it to Sulong.
- Faster
String#==using vectorization.
Changes:
- Clarified that all sources that come in from the Polyglot API
evalmethod
will be treated as UTF-8, and cannot be re-interpreted as another encoding
using a magic comment. - The
-Xembeddedoption can now be set set on the launcher command line. - The
-Xplatform.native=falseoption can now load the core library, by
enabling-Xpolyglot.stdio. $SAFEandThread#safe_levelnow cannot be set to1- raising an error
rather than warning as before.-Xsafeallows it to be set, but there are
still no checks.- Foreign objects are now printed as
#<Foreign:system-identity-hash-code>,
except for foreign arrays which are now printed as#<Foreign [elements...]>. - Foreign objects
to_snow callsinspectrather than Java'stoString. - The embedded configuration (
-Xembedded) now warns about features which may
not work well embedded, such as signals. - The
-Xsync.stdiooption has been removed - use standard Ruby
STDOUT.sync = truein your program instead.