TruffleRuby is a high-performance implementation of the Ruby programming language.
TruffleRuby aims to be fully compatible with the standard implementation of Ruby, MRI, version 2.6.6.
More information is available on the GraalVM website: http://www.graalvm.org/docs/reference-manual/ruby/
Changelog
20.2.0
New features:
- Updated to Ruby 2.6.6.
- Use
InteropLibrary#toDisplayString()
to better display objects from other languages. - Implement writing to the top scope for global variables (#2024).
foreign_object.to_s
now usesInteropLibrary#toDisplayString()
(and stillasString()
ifisString()
).foreign_object.inspect
has been improved to be more useful (include the language and meta object).foreign_object.class
now callsgetMetaObject()
(except for Java classes, same as before).- Add basic support for Linux ARM64.
foreign_object.name = value
will now callInteroplibrary#writeMember("name", value)
instead ofinvokeMember("name=", value)
.- Always show the Ruby core library files in backtraces (#1414).
- The Java stacktrace is now shown when sending SIGQUIT to the process, also on TruffleRuby Native, see Debugging for details (#2041).
- Calls to foreign objects with a block argument will now pass the block as the last argument.
foreign.name
will now useinvokeMember
if invocable and if not usereadMember
, seedoc/contrib/interop_implicit_api.md
for details.foreign.to_f
andforeign.to_i
will now attempt to convert to RubyFloat
andInteger
(#2038).foreign.equal?(other)
now usesInteropLibrary#isIdentical(other)
andforeign.object_id/__id__
now usesInteropLibrary#identityHashCode()
.
Bug fixes:
- Fix
#class_exec
,#module_exec
,#instance_eval
, andinstance_exec
to use activated refinements (#1988, @ssnickolay). - Fixed missing method error for FFI calls with
blocking: true
when interrupted. - Use upgraded default gems when installed (#1956).
- Fixed
NameError
when requiring an autoload path that does not define the autoload constant (#1905). - Thread local IO buffers are now allocated using a stack to ensure safe operating if a signal handler uses one during an IO operation.
- Fixed
TracePoint
thread-safety by storing the state on the RubyThread
(like MRI) instead of inside theTracePoint
instance. - Make
require 'rubygems/package'
succeed and defineGem::Deprecate
correctly (#2014). - Fix
MBCLEN_CHARFOUND_P
error. - Fix
rb_enc_str_new
whenNULL
encoding is given with a constant string. - Fixed
rb_enc_precise_mbclen
to handle more inputs. - The output for
--engine.TraceCompilation
is now significantly easier to read, by having shorter method names and source names (oracle/graal#2052). - Fix indentation for squiggly heredoc with single quotes (#1564).
- Only print members which are readable for foreign
#inspect
(#2027). - Fixed the return value of the first call to
Kernel#srand
in a Thread (#2028). - Fix missing flushing when printing an exception at top-level with a custom backtrace, which caused no output being shown (#1750, #1895).
- Use the mode of the given
IO
forIO#reopen(IO)
which is important for the 3 standard IOs (#2034). - Fix potential deadlock when running finalizers (#2041).
- Let
require 'rubygems/specification'
work beforerequire 'rubygems'
.
Compatibility:
- Implement
UnboundMethod#bind_call
. - Implemented
ObjectSpace::WeakMap
(#1385, #1958). - Implemented
strtod
andruby_strtod
(#2007). - Fix detection of
#find_type
in FFI to ignoreMakeMakefile#find_type
frommkmf
(#1896, #2010). - Implemented
rb_uv_to_utf8
(#1998, @skateman). - Implemented
rb_str_cat_cstr
. - Implemented
rb_fstring
. - Support
#refine
for Module (#2021, @ssnickolay). - Implemented
rb_ident_hash_new
. - Improved the compatibility of
Symbol.all_symbols
(#2022, @chrisseaton). - Implemented
rb_enc_str_buf_cat
. - Implemented
rb_int_positive_pow
. - Implemented
rb_usascii_str_new_lit
. - Define
#getch
and#getpass
onStringIO
whenio/console
is required. - Implemented
rb_uv_to_utf8
(#1998). - Single character IDs now behave more like those in MRI to improve C extension compatibility, so
rb_funcall(a, '+', b)
will now do the same thing as in MRI. - Removed extra public methods on
String
. - Implemented
rb_array_sort
andrb_array_sort_bang
. - Do not create a finalizers
Thread
if there are other public languages, which is helpful for polyglot cases (#2035). - Implemented
rb_enc_isalnum
andrb_enc_isspace
. RUBY_REVISION
is now the full commit hash used to build TruffleRuby, similar to MRI 2.7+.- Implemented
rb_enc_mbc_to_codepoint
. - Changed the lookup methods to achieve Refinements specification (#2033, @ssnickolay)
- Implemented
Digest::Instance#new
(#2040). - Implemented
ONIGENC_MBC_CASE_FOLD
. - Fixed
Thread#raise
to call the exception class' constructor with no arguments when given no message (#2045). - Fixed
refine + super
compatibility (#2039, #2048, @ssnickolay) - Make the top-level exception handler more compatible with MRI (#2047).
- Implemented
rb_enc_codelen
. - Implemented
Ripper
by using the C extension (#1585).
Changes:
- RubyGems gem commands updated to use the
--no-document
option by default.
Performance:
- Enable lazy translation from the parser AST to the Truffle AST for user code by default. This should improve application startup time (#1992).
instance variable ... not initialized
and similar warnings are now optimized to have no peak performance impact if they are not printed (depends on$VERBOSE
).- Implement integer modular exponentiation using
BigInteger#mod_pow
(#1999, @skateman) - Fixed a performance issue when computing many substrings of a given non-leaf
String
with non-US-ASCII characters. - Speedup native handle to Ruby object lookup for C extensions.