TruffleRuby - GraalVM Community Edition 21.3.0
TruffleRuby is a high-performance implementation of the Ruby programming language.
TruffleRuby aims to be fully compatible with the standard implementation of Ruby 2.7.3, MRI.
The Ruby support is not available in GraalVM by default and should be installed: gu install ruby
.
More information is available on the website: http://www.graalvm.org/ruby/
Changelog
New features:
- TRegex is now used by default, which provides large speedups for matching regular expressions (@jirkamarsik).
- Add
Polyglot.languages
to expose the list of available languages. - Add
Polyglot::InnerContext
to eval code in any available language in an inner isolated context (#2169, @eregon). - Foreign objects now have a dynamically-generated class based on their interop traits like
ForeignArray
and are better integrated with Ruby objects (#2149, @eregon and @rbotafogo). - Foreign arrays now have all methods of Ruby
Enumerable
and many methods ofArray
(#2149, @eregon and @rbotafogo). - Foreign hashes now have all methods of Ruby
Enumerable
and many methods ofHash
(#2149). - Foreign iterables (
InteropLibrary#hasIterator
) now have all methods of RubyEnumerable
(#2149). - Foreign objects now implement
#instance_variables
(readable non-invocable members) and#methods
(invocable members + Ruby methods).
Bug fixes:
- Fix
Marshal.load
of multipleSymbols
with an explicit encoding (#1624). - Fix
rb_str_modify_expand
to preserve existing bytes (#2392, @bjfish). - Fix
String#scrub
when replacement is frozen (#2398, @LillianZ). - Fix
Dir.mkdir
error handling forPathname
paths (#2397). BasicSocket#*_nonblock(exception: false)
now only return:wait_readable/:wait_writable
forEAGAIN
/EWOULDBLOCK
like MRI (#2400).- Fix issue with
strspn
used in thedate
C extension compiled as a macro on older glibc and then missing the__strspn_c1
symbol on newer glibc (#2406). - Fix constant lookup when loading the same file multiple times (#2408).
- Fix handling of
break
,next
andredo
indefine_method(name, &block)
methods (#2418). - Fix handling of incompatible types in
Float#<=>
(#2432, @chrisseaton). - Fix issue with escaping curly braces for
Dir.glob
(#2425). - Fix
base64
decoding issue with missing output (#2435). - Fix
StringIO#ungetbyte
to treat a byte as a byte, not a code point (#2436, @aardvark179). - Fix
defined?(yield)
when used inside a block (#2446). - Fix a couple issues related to native memory allocation and release.
- Capture the intercepted feature path during patching to reuse during patch require (#2441).
Compatibility:
- Implement
Process::Status.wait
(#2378). - Update
rb_str_modify
andrb_str_modify_expand
to raise aFrozenError
when given a frozen string (#2392). - Implement
rb_fiber_*
functions (#2402). - Implement
rb_str_vcatf
. - Add support for tracing allocations from C functions (#2403, @chrisseaton).
- Implement
rb_str_catf
. - Search the executable in the passed env
PATH
for subprocesses (#2419). - Accept a string as the pattern argument to
StringScanner#scan
andStringScanner#check
(#2423).
Performance:
- Moved most of
MonitorMixin
to primitives to deal with interrupts more efficiently (#2375). - Improved the performance of
rb_enc_from_index
by adding cached lookups (#2379, @nirvdrum). - Improved the performance of many
MatchData
operations (#2384, @nirvdrum). - Significantly improved performance of TRegex calls by allowing Truffle splitting (#2389, @nirvdrum).
- Improved
String#gsub
performance by adding a fast path for thestring_byte_index
primitive (#2380, @nirvdrum). - Improved
String#index
performance by adding a fast path for thestring_character_index
primitive (#2383, @LillianZ). - Optimized conversion of strings to integers if the string contained a numeric value (#2401, @nirvdrum).
- Use Truffle's
ContextThreadLocal
to speedup access to thread-local data. - Provide a new fast path for
rb_backref*
andrb_lastline*
functions from C extensions.
Changes:
foreign_object.class
on foreign objects is no longer special and usesKernel#class
(it used to return thejava.lang.Class
object for a Java type orgetMetaObject()
, but that is too incompatible with Ruby code).Java.import name
imports a Java class in the enclosing module instead of always as a top-level constant.foreign_object.keys
no longer returns members, useforeign_object.instance_variables
orforeign_object.methods
instead.foreign_object.respond_to?(:class)
is now always true (before it was only for Java classes), since the method is always defined.
Security:
- Updated to Ruby 2.7.4 to fix CVE-2021-31810, CVE-2021-32066 and CVE-2021-31799.