TruffleRuby is a high-performance implementation of the Ruby programming language.
TruffleRuby aims to be fully compatible with the standard implementation of Ruby, MRI.
The Ruby language component can be added to GraalVM using the gu
utility.
More information is available on the website: http://www.graalvm.org/ruby/
Changelog
New features:
- New
TruffleRuby::ConcurrentMap
data structure for use inconcurrent-ruby
(#2339, @wildmaples).
Bug fixes:
- Fix of different values of self in different scopes.
Truffle::POSIX.select
was being redefined repeatedly (#2332, @eregon).- Fix the
--backtraces-raise
and--backtraces-rescue
options in JVM mode (#2335). - Fix
File.{atime, mtime, ctime}
to include nanoseconds (#2337). - Fix
Array#[a, b] = "frozen string literal".freeze
(#2355). rb_funcall()
now releases the C-extension lock (similar to MRI).- Fix
rb_str_modify_expand
to preserve existing bytes (#2392). - Fix
Marshal.load
of multipleSymbols
with an explicit encoding (#1624). - Fix
String#scrub
when replacement is frozen (#2398, @LillianZ).
Compatibility:
- Updated to Ruby 2.7.3. The
resolv
stdlib was not updated (resolv
in 2.7.3 has bugs). - Make interpolated strings frozen for compatibility with Ruby 2.7 (#2304, @kirs).
require 'socket'
now also requires'io/wait'
like CRuby (#2326).- Support precision when formatting strings (#2281, @kirs).
- Make rpartition compatible with Ruby 2.7 (#2320, @gogainda).
- Include the type name in exception messages from
rb_check_type
(#2307). - Fix
Hash#rehash
to remove duplicate keys after modifications (#2266, @MattAlp) - Only fail
rb_check_type
for typed data, not wrapped untyped structs (#2331, @aardvark179). - Decide the visibility in
Module#define_method
based onself
and the default definee (#2334). - Configure
mandir
value inRbConfig::CONFIG
andRbConfig::MAKEFILE_CONFIG
(#2315, @bjfish). - TruffleRuby now supports the Truffle polyglot Hash interop API (@norswap).
- Implement
Fiber#raise
(#2338). - Update
File.basename
to return newString
instances (#2343). - Allow
Fiber#raise
afterFiber#transfer
like Ruby 3.0 (#2342). - Fix
ObjectSpace._id2ref
for Symbols and frozen String literals (#2358). - Implemented
Enumerator::Lazy#filter_map
(#2356). - Fix LLVM toolchain issue on macOS 11.3 (#2352, oracle/graal#3383).
- Implement
IO#set_encoding_by_bom
(#2372, pawandubey). - Implemented
Enumerator::Lazy#with_index
(#2356). - Implement
rb_backref_set
. - Fix
Float#<=>
when comparingInfinity
to other#infinite?
values. - Implement
date
library as a C extension to improve compatibility (#2344). - Update
rb_str_modify
andrb_str_modify_expand
to raise aFrozenError
when given a frozen string (#2392).
Performance:
- Make
#dig
iterative to make it faster and compile better for calls with 3+ arguments (#2301, @chrisseaton, @jantnovi). - Make
Struct#dig
faster in interpreter by avoiding exceptions (#2306, @kirs). - Reduce the number of AST nodes created for methods and blocks (#2261).
- Fiber-local variables are much faster now by using less synchronization.
- Improved the performance of the exceptional case of
String#chr
(#2318, @chrisseaton). - Improved the performance of
IO#read_nonblock
when no data is available to be read. TruffleSafepoint
is now used instead of custom logic, which no longer invalidates JITed code for guest safepoints (e.g.,Thread#{backtrace,raise,kill}
,ObjectSpace
, etc)- Significantly improved performance of
Time#strftime
for common formats (#2361, @wildmaples, @chrisseaton). - Faster solution for lazy integer length (#2365, @lemire, @chrisseaton).
- Speedup
rb_funcallv*()
by directly unwrapping the C arguments array instead of going through a RubyArray
(#2089).
Changes:
rb_iterate()
(deprecated since 1.9) no longer magically passes the block torb_funcall()
, userb_block_call()
instead.
Security:
- Updated to Ruby 2.7.3 to fix CVE-2021-28965 and CVE-2021-28966.