TruffleRuby - GraalVM Community Edition 22.1.0
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:
- Foreign exceptions are now fully integrated and have most methods of
Exception(@eregon). - Foreign exceptions can now be rescued with
rescue Polyglot::ForeignExceptionorrescue foreign_meta_object(#2544, @eregon).
Bug fixes:
- Guard against unterminated ranges in file matching patterns (#2556, @aardvark179).
- Fixed
rb_proc_newto return a proc that will pass all required arguments to C (#2556, @aardvark179). - Fixed
String#splitto return empty array when splitting all whitespace on whitespace (#2565, @bjfish). - Raise
RangeErrorforTime.at(bignum)(#2580, @eregon). - Fix
Integer#{<<,>>}with RHS bignum and long (@eregon). - Fix a resource leak from allocators defined in C extensions (@aardvark179).
SIGINT/Interrupt/Ctrl+Cnow shows the backtrace and exits as signaled, like CRuby (@eregon).- Update patch feature finding to prefer the longest matching load path (#2605, @bjfish).
- Fix
Hash#{to_s,inspect}for keys whose#inspectreturn a frozen String (#2613, @eregon). - Fix
Array#packwithx*to not output null characters (#2614, @bjfish). - Fix
Random#randnot returning random floats when given float ranges (#2612, @bjfish). - Fix
Array#samplefor[]when called withoutnand aRandomis given (#2612, @bjfish). - Fix
Module#const_getto raise aNameErrorwhen nested modules do not exist (#2610, @bjfish). - Ensure native
VALUEs returned from C are unwrapped before the objects can be collected (@aardvark179). - Fix
Enumerator::Lazy#with_indexto start with new index for multiple enumerations (@bjfish). - Fix
rb_id2nameto ensure the native string will have the same lifetime as the id (#2630, @aardvark179). - Fix
MatchData#[]exception when passing a length argument larger than the number of match values (#2636, @nirvdrum). - Fix
MatchData#[]exception when supplying a large negative index along with a length argument (@nirvdrum). - Fix
Integer#fdivandRational#to_ffor largeIntegervalues (#2631, @bjfish).
Compatibility:
- Implement full Ruby 3 keyword arguments semantics (#2453, @eregon, @chrisseaton).
- Implement
ruby_native_thread_pfor compatibility (#2556, @aardvark179). - Add
rb_argv0for thetkgem. (#2556, @aardvark179). - Implement more correct conversion of array elements by
Array#pack(#2503, #2504, @aardvark179). - Implement
Pathname#{empty?, glob}(#2559, @bjfish) - Fixed
Rational('')to raise error like MRI (#2566, @aardvark179). - Freeze instances of
Rangebut not subclasses, like CRuby (#2570, @MattAlp). - When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. (#2532, @gogainda).
- Use
#to_afor convertinglistinrescue *list(#2572, @eregon). - Implement 'rb_str_buf_append' (@bjfish).
- Add patch for
digestso that TruffleRuby implementation is not overridden (@bjfish). - Handle encoding conversion errors when reading directory entries (@aardvark179).
- Follow symlinks when processing
*/directory glob patterns. (#2589, @aardvark179). - Set
@gem_prelude_indexvariable on the default load paths (#2586 , @bjfish) - Do not call
IO#flushdynamically fromIO#close(#2594, @gogainda). - Implement
rb_str_new_staticfor C extensions that use it (@aardvark179). - Rewrote
ArrayEachIteratorNodeand re-introducedeachspecs for MRI parity when mutating arrays whilst iterating, rather than crashing (#2587, @MattAlp) - Update
String#rindexto only acceptRegexpor objects convertable toStringas the first parameter (#2608, @bjfish). - Update
String#<<to require one argument (#2609, @bjfish). - Update
String#splitto raiseTypeErrorwhen false is given (#2606, @bjfish). - Update
String#lstrip!to remove leading null characters (#2607, @bjfish). - Update
File.utimeto return the number of file names in the arguments (#2616, @bjfish). - Update
Dir.foreachto accept anencodingparameter (#2627, @bjfish). - Update
IO.readlinesto ignore negative limit parameters (#2625 , @bjfish). - Update
Math.sqrtto raise aMath::DomainErrorfor negative numbers (#2621, @bjfish). - Update
Enumerable#injectto raise anArgumentErrorif no block or symbol are given (#2626, @bjfish). - Fix
Marshal.dumpto raise an error when an object has singleton methods (@bjfish).
Performance:
- Increase dispatch limit for string library to handle mutable, immutable and non-strings (@aardvark179)
- Switch to
Arrays.mismatch()in string comparison for better performance (@aardvark179). - Removed extra array allocations for method calls in the interpreter to improve warmup performance (@aardvark179).
- Optimize
Dir[]by sorting entries as they are found and grouping syscalls (#2092, @aardvark179). - Reduce memory footprint by tracking
VALUEs created during C extension init separately (@aardvark179). - Rewrote
ArrayEachIteratorNodeto optimize performance for a constant-sized array and reduce specializations to 1 general case (#2587, @MattAlp) - Reduce conversion of
VALUEs to native handle during common operations in C extensions (@aardvark179). - Improved performance of regex boolean matches (e.g.,
Regexp#match?) by avoiding match data allocation in TRegex (#2588, @nirvdrum). - Remove overhead when getting using
RDATA_PTR(@aardvark179). - Additional copy operations have been reduced when performing IO (#2536, @aardvark179).
Changes:
- Foreign exceptions are no longer translated to
RuntimeErrorbut instead remain as foreign exceptions, see the documentation for how to rescue them (@eregon).