Skip to content

TruffleRuby - GraalVM Community Edition 21.3.0

Compare
Choose a tag to compare
@ezzarghili ezzarghili released this 19 Oct 14:21
· 6313 commits to master since this release

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 of Array (#2149, @eregon and @rbotafogo).
  • Foreign hashes now have all methods of Ruby Enumerable and many methods of Hash (#2149).
  • Foreign iterables (InteropLibrary#hasIterator) now have all methods of Ruby Enumerable (#2149).
  • Foreign objects now implement #instance_variables (readable non-invocable members) and #methods (invocable members + Ruby methods).

Bug fixes:

  • Fix Marshal.load of multiple Symbols 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 for Pathname paths (#2397).
  • BasicSocket#*_nonblock(exception: false) now only return :wait_readable/:wait_writable for EAGAIN/EWOULDBLOCK like MRI (#2400).
  • Fix issue with strspn used in the date 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 and redo in define_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 and rb_str_modify_expand to raise a FrozenError 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 and StringScanner#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 the string_byte_index primitive (#2380, @nirvdrum).
  • Improved String#index performance by adding a fast path for the string_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* and rb_lastline*functions from C extensions.

Changes:

  • foreign_object.class on foreign objects is no longer special and uses Kernel#class (it used to return the java.lang.Class object for a Java type or getMetaObject(), 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, use foreign_object.instance_variables or foreign_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: