Releases: oracle/truffleruby
TruffleRuby - GraalVM Community 23.0.0-preview1
TruffleRuby is a high-performance implementation of the Ruby programming language.
TruffleRuby aims to be fully compatible with the standard implementation of Ruby, MRI.
More information is available on the website: http://www.graalvm.org/ruby/
Changelog
New features:
- Updated to Ruby 3.1.3 (#2733, @andrykonchin, @eregon).
foreign_object.is_a?(foreign_meta_object)
is now supported (@eregon).- Foreign big integers are now supported and work with all
Numeric
operators (@eregon).
Bug fixes:
- Ensure every parse node has a source section and fix the source section for
ensure
(#2758, @eregon). - Fix
spawn(..., fd => fd)
on macOS, it did not work due to a macOS bug (@eregon). - Fix
rb_gc_register_address()
/rb_global_variable()
to read the latest value (#2721, #2734, #2720, @eregon). - Synchronize concurrent writes to the same StringIO (@eregon).
- Fix
StringIO#write(str)
whenstr
is of an incompatible encoding and position < buffer size (#2770, @eregon). - Fix
rb_thread_fd_select()
to correctly initialize fdset copies and handle the timeout (@eregon). - Fix
TracePoint#inspect
when it's called outside of a callback (@andrykonchin). - Fix
Signal.trap
when signal argument is not supported (#2774, @andrykonchin). - Fix
Dir.mkdir
and convert permissions argument toInteger
(#2781, @andrykonchin). - Fix
String#dump
and use\u{xxxx}
notation (with curly brackets) for characters that don't fit in\uxxxx
(#2794, @andrykonchin). - Fix
Marshal.dump
when big Integer (that cannot be expressed with 4 bytes) is serialized (#2790, @andrykonchin). - Fix
Array#pack
and acceptNumeric
values whenFloat
is expected (#2815, @andrykonchin). - Fix
\P{}
matching in regular expressions (#2798, @andrykonchin). - Fix constants lookup when
BasicObject#instance_eval
method is called with a String (#2810, @andrykonchin). - Don't trigger the
method_added
event when changing a method's visibility or callingmodule_function
(@paracycle, @nirvdrum). - Fix
rb_time_timespec_new
function to not callTime.at
method directly (@andrykonchin). - Fix
StringIO#write
to transcode strings with encodings that don't match theStringIO
'sexternal_encoding
. (#2839, @flavorjones) - Fix processing of proc rest arguments located at the beginning if there are no actual arguments (#2921, @andrykonchin).
- Fix
Monitor#exit
to raiseThreadError
when monitor not owned by the current thread (#2922, @andrykonchin). - Fix
MatchData#[]
to support negativelength
argument (#2929, @andrykonchin). - Fix
IO
line reading calls when using a multi-byte delimiter (IO#{each,gets,readline,readlines,etc.}
) (#2961, @vinistock, @nirvdrum). - Fix the exception type raised when type coercion raises a
NoMethodError
(#2903, @paracycle, @nirvdrum). - Fix
Method
andProc
#parameters
method to return_
parameter name without synthetic suffix when there are multiple_
parameters (@paracycle). - Fixed errors in IRB when attempting to navigate beyond bounds in singleline mode (@rwstauner).
Compatibility:
- Fix
MatchData#[]
when passed unbounded Range (#2755, @andrykonchin). - Updated
rb_define_class
,rb_define_class_under
, andrb_define_class_id_under
to allow class names that aren't valid in Ruby (#2739, @nirvdrum). - Fixed
rb_gv_get
so that it no longer implicitly creates global variables (#2748, @nirvdrum). - Added implementations of
rb_gvar_val_getter
andrb_define_virtual_variable
(#2750, @nirvdrum). - Implement
rb_warning_category_enabled_p
to support thesyntax_tree
gem (#2764, @andrykonchin). - Fix desctructuring of a single block argument that implements
#to_ary
dynamically (#2719, @andrykonchin). - Fix
Kernel#Complex
and raise exception when an argument is formatted incorrectly (#2765, @andrykonchin). - Add
#public?
,#private?
and#protected?
methods forMethod
andUnboundMethod
classes (@andrykonchin). - Add optional argument to
Thread::Queue.new
(@andrykonchin). - Support a module as the second argument of
Kernel#load
(@andrykonchin). - Improve argument validation in
Struct#valies_at
- raiseIndexError
orRangeError
when arguments are out of range (#2773, @andrykonchin). - Fix
MatchData#values_at
and handling indices that are out of range (#2783, @andrykonchin). - Add support for
%-z
(UTC for unknown local time offset, RFC 3339) toTime#strftime
(@andrykonchin). - Add support for
UTC
andA
-Z
utc offset values, as well as+/-HH
,+/-HHMM
,+/-HHMMSS
(without:
) (@andrykonchin). - Treat time with
UTC
,Z
and-00:00
utc offset as UTC time (@andrykonchin). - Raise
FrozenError
whenTime#localtime
,Time#utc
andTime#gmtime
is called on a frozen time object (@andrykonchin). - Validate a microseconds argument used to create a time object (@andrykonchin).
- Support accessing
dmark
anddfree
fields forRData
(#2771, @eregon). - Implement
rb_enc_nth()
(#2771, @eregon). - Support
offset
keyword argument forString#unpack
andString#unpack1
(@andrykonchin). - Fix
Process.detach
and castpid
argument toInteger
(#2782, @andrykonchin). rb_to_id()
should create a staticID
, used by RMagick (@eregon).- Resolve the current user home even when
$HOME
is not set (#2784, @eregon) - Fix
IO#lineno=
and convert argument toInteger
more strictly (#2786, @andrykonchin). - Fix argument implicit convertion in
IO#pos=
andIO#seek
methods (#2787, @andrykonchin). - Warn about unknown directive passed to
Array#pack
in verbose mode (#2791, @andrykonchin). - Added constants
IO::SEEK_DATE
andIO::SEEK_HOLE
(#2792, @andrykonchin). - Fix
StringIO.new
to accept keyword arguments (#2793, @andrykonchin). Process#spawn
should call#to_io
on non-IO file descriptor objects (#2809, @jcouball).- Add constants
IO::SEEK_DATE
andIO::SEEK_HOLE
(#2792, @andrykonchin). - Add
Class#subclasses
method (#2733, @andrykonchin). - Implement
Coverage.running?
method (@andrykonchin). - Fix arguments implicit type conversion for
Enumerable#zip
andArray#zip
(#2788, @andrykonchin). - Fix
Array#unshift
to not depend onArray#[]=
and allow overriding#[]=
in a subclass (#2772, @andrykonchin). - Fix syntactic check for
void value expression
(#2821, @eregon). - Fix
Range#step
with no block and non-Numeric
values (#2824, @eregon). - Fix execution order of
END
blocks andat_exit
callbacks (#2818, @andrykonchin). - Fix
String#casecmp?
for empty strings of different encodings (#2826, @eregon). - Implement
Enumerable#compact
andEnumerator::Lazy#compact
(#2733, @andrykonchin). - Implement
Array#intersect?
(#2831, @nirvdrum). - Record the source location in the constant for the
module
/class
keywords (#2833, @eregon). - Fix
File.open
and supportflags
option (#2820, @andrykonchin). - Support writing to
RData.dfree
for native extensions (#2830, #2732, #2165, @eregon). - Fix
IO#write
and support multiple arguments with different encodings (#2829, @andrykonchin). - Fix
Array
methodsreject
,reject!
,inject
,map
,select
,each_index
and handle a case when array is modified by a passed block like CRuby does (#2822, andrykonchin, @eregon). - Fix
EncodingError
exception message when Symbol has invalid encoding (#2850, @andrykonchin). - Raise
EncodingError
at parse time when Hash literal contains a Symbol key with invalid encoding (#2848, @andrykonchin). - Fix
Array
methodsreject
,reject!
,inject
,map
,select
,each_index
and handle a case when array is modified by a passed block like CRuby does (#2822, @andrykonchin, @eregon). - Fix
Array
methodsselect!
andkeep_if
and handle a case when exception is raised in a passed block properly (@andrykonchin). - Fix
Enumerable
methodseach_cons
andeach_slice
to return receiver (#2733, @horakivo) Module
methods#private
,#public
,#protected
,#module_function
now returns their arguments like in CRuby 3.1 (#2733, @horakivo)Kernel#exit!
, killing Fibers and internal errors do not run code inensure
clauses anymore, the same as CRuby (@eregon).- Implement
UnboundMethod#original_name
(@paracycle, @nirvdrum). - Implement
Thread#native_thread_id
method (#2733, @horakivo). - Modify
Struct#{inspect,to_s}
to match MRI when the struct is nested inside of an anonymous class or module (@st0012, @nirvdrum). Fiber.current
andFiber#transfer
are available withoutrequire 'fiber'
like in CRuby 3.1 (#2733, @eregon).- Add
freeze
keyword argument toMarshal.load
(#2733, @andrykonchin). - Add
Integer.try_convert
(#2733, @moste00, @eregon). - Support optional
:in
keyword argument forTime.now
andTime.new
(#2733, @andrykonchin). - Add optional
Hash
argument toEnumerable#tally
(#2733, @andrykonchin). - Update
$LOAD_PATH.resolve_feature_path
to returnnil
instead of raisingLoadError
when feature isn't found (#2733, @andrykonchin). - Add
objspace/trace
file (#2733, @andrykonchin). - Add
Process._fork
(#2733, @horakivo). - Update to JCodings 1.0.58 and Joni 2.1.44 (@eregon).
- Add
MatchData#match
andMatchData#match_length
(#2733, @horakivo). - Add
StructClass#keyword_init?
method (#2377, @moste00). - Support optional
level
argument forFile.dirname
method (#2733, @moste00). - Add
Thread::Backtrace.limit
method (#2733, @andrykonchin). - Deprecate
rb_gc_force_recycle
and make it a no-op function (#2733, @moste00). - Add
Refinement#import_methods
method and add deprecation warning forRefinement#include
andRefinement#prepend
(#2733, @horakivo). - Upgrading
UNICODE
version to 13.0.0 andEMOJI
version to 13.1 (#2733, @horakivo). - Add
rb_io_maybe_wait_readable
,rb_io_maybe_wait_writable
andrb_io_maybe_wait
functions (#2733, @andrykonchin). StringIO#set_encoding
should coerce the argument to an Encoding (#2954, @eregon).- Implement ch...
TruffleRuby - GraalVM Community Edition 22.3.1
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
Bug fixes:
- Fix rb_thread_fd_select() to correctly initialize fdset copies and handle the timeout (@eregon).
- Fix Marshal.dump when big Integer (that cannot be expressed with 4 bytes) is serialized (#2790, @andrykonchin).
TruffleRuby - GraalVM Community Edition 22.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, 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 strings now have all methods of Ruby
String
. They are treated as#frozen?
UTF-8 Ruby Strings (@eregon). - Add
Java.add_to_classpath
method to add jar paths at runtime (#2693, @bjfish). - Add support for Ruby 3.1's Hash shorthand/punning syntax (@nirvdrum).
- Add support for Ruby 3.1's anonymous block forwarding syntax (@nirvdrum).
- Added the following keyword arguments to
Polyglot::InnerContext.new
:languages, language_options, inherit_all_access, code_sharing
(@eregon).
Bug fixes:
- Fix
StringIO
to set position correctly after reading multi-byte characters (#2207, @aardvark179). - Update
Process
methods to usemodule_function
(@bjfish). - Fix
File::Stat
's#executable?
and#executable_real?
predicates that unconditionally returnedtrue
for a superuser (#2690, @andrykonchin). - The
strip
option--keep-section=.llvmbc
is not supported on macOS (#2697, @eregon). - Disallow the marshaling of polyglot exceptions since we can't properly reconstruct them (@nirvdrum).
- Fix
String#split
missing a value in its return array when called with a pattern of" "
and a limit value > 0 on a string with trailing whitespace where the limit hasn't been met (@nirvdrum). - Fix
Kernel#sleep
andMutex#sleep
for durations smaller than 1 millisecond (#2716, @eregon). - Fix
IO#{wait,wait_readable,wait_writable}
with a timeout > INT_MAX seconds (@eregon). - Use the compatible encoding for
String#{sub,gsub,index,rindex}
(#2749, @eregon).
Compatibility:
- Fix
Array#fill
to raiseTypeError
instead ofArgumentError
when the length argument is not numeric (#2652, @andrykonchin). - Warn when a global variable is not initialized (#2595, @andrykonchin).
- Fix escaping of
/
byRegexp#source
(#2569, @andrykonchin). - Range literals of integers are now created at parse time like in CRuby (#2622, @aardvark179).
- Fix
IO.pipe
- allow overridingIO.new
that is used to create new pipes (#2692, @andrykonchin). - Fix exception message when there are missing or extra keyword arguments - it contains all the missing/extra keywords now (#1522, @andrykonchin).
- Always terminate native strings with enough
\0
bytes (#2704, @eregon). - Support
#dup
and#clone
on foreign strings (@eregon). - Fix
Regexp.new
to coerce non-String arguments (#2705, @andrykonchin). - Fix
Kernel#sprintf
formatting for%c
when used non-ASCII encoding (#2369, @andrykonchin). - Fix
Kernel#sprintf
argument casting for%c
(@andrykonchin). - Implement the
rb_enc_strlen
function for use by native extensions (@nirvdrum). - Match tag values used by
rb_protect
andrb_jump_tag
for thetk
gem (#2556, @aardvark179). - Implement
rb_eval_cmd_kw
to support thetk
gem (#2556, @aardvark179). - Fix
rb_class2name
to callinspect
on anonymous classes like in CRuby (#2701, @aardvark179). - Implement
rb_ivar_foreach
to iterate over instance and class variables like in CRuby (#2701, @aardvark179). - Fix the absolute path of the main script after chdir (#2709, @eregon).
- Fix exception for
Fiddle::Handle.new
with a missing library (#2714, @eregon). - Fix arguments implicit type conversion for
BasicObject#instance_eval
,Module#class_eval
,Module#module_eval
,Module#define_method
(@andrykonchin). - Raise
ArgumentError
unconditionally whenProc.new
is called without a block argument (@andrykonchin). - Fix
UnboundMethod#hash
to not depend on a module it was retrieved from (#2728, @andrykonchin).
Performance:
- Replace a call of
-"string"
with frozen string literal at parse time (@andrykonchin). - Report polymorphism inside
Hash#[]
to recover performance (@aardvark179). - Improved interpreter performance by optimizing for better host inlining (@eregon).
- Use
poll
instead ofselect
for simple IO waiting to reduce overheads (#1584, @aardvark179). - TruffleString is now used to represent Ruby Strings which is faster can be shared with no overhead between languages (see details) (#2663, @eregon, @nirvdrum, @wildmaples, @andrykonchin).
Changes:
- No more conversion between Java Strings and Ruby Strings at the interop boundary (@eregon).
- Removed
Truffle::Interop.{import_without_conversion,export_without_conversion}
(usePolyglot.{import,export}
instead). - Removed
Truffle::Interop.members_without_conversion
(useTruffle::Interop.members
instead). - Refactored internals of
rb_sprintf
to simplify handling ofVALUE
s in common cases (@aardvark179). - Refactored sharing of array objects between threads using new
SharedArrayStorage
(@aardvark179).
Security:
- The native access permission is now properly checked before any native pointer (e.g.
Truffle::FFI::Pointer
) is created (@eregon).
TruffleRuby - GraalVM Community Edition 22.2.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:
- Add support for
darwin-aarch64
(Apple Silicon) (#2181, @lewurm, @chrisseaton, @eregon). - Add support for OpenSSL 3.0.0 by updating the openssl gem (@aardvark179, @eregon).
Bug fixes:
- Fix
rb_id2name
to 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 capacity computation for huge
Hash
(#2635, @eregon). - Fix aliased methods to return the correct owner when method is from a superclass (@bjfish).
- Fix
String#[Regexp, Integer]
when the capture group exists but is not matched (@eregon). - Fix
File.open
mode string parsing when binary option is the third character (@bjfish). - Fix
rb_scan_args_kw
macro to avoid shadowing variables (#2649, @aardvark179). - Fix
String#unpack("Z")
to not advance after the null byte, like CRuby (#2659, @aardvark179). - Fix
Float#round
to avoid losing precision during the rounding process (@aardvark179). - Fix
String#insert
to not call a subclassed string method (@bjfish). - Fix
rb_obj_call_init
to pass any block argument to theinitialize
method (#2675, @aardvark179). - Fix issue with feature loading not detecting a previously loaded feature (#2677, @bjfish).
- Fix
/#{...}/o
to evaluate only once per context when splitting happens (@eregon). - Fix
Kernel#sprintf
formatting of floats to be like CRuby (@aardvark179). - Fix
Process.egid=
to acceptString
s (#2615, @ngtban) - Fix optional assignment to only evaluate index arguments once (#2658, @aardvark179).
Compatibility:
- Updated to Ruby 3.0.3. The 3 CVEs did not affect TruffleRuby, this is to bring the stdlib and gem updates (@eregon).
- Fix
Marshal.dump
to raise an error when an object has singleton methods (@bjfish). Exception#full_message
now defaults the order to:top
like CRuby 3+ (@eregon).- Fix
Process.wait2
to returnnil
when theWNOHANG
flag is given and the child process is still running (@bjfish). - Disable most
nokogiri
C extension patches when system libraries are not being used (#2693, @aardvark179). - Implement
rb_gc_mark_maybe
andrb_global_variable
to ensureVALUE
stay live in C extensions (@aardvark179). - Implement
rb_imemo_tmpbuf
allocation forripper
(@aardvark179). - Implement
inherit
argument forModule#class_variables
(#2653, @bjfish). - Fix
Float#/
when dividing byRational
(@bjfish). Process.euid=
should accept String (#2615, @ngtban).- Fix
instance_variable_get
andinstance_variable_set
for immutable objects (@bjfish). Thread#raise(exc, message)
now callsexc.exception
in the target thread like CRuby (@eregon).- Define
Process::{CLOCK_BOOTTIME,CLOCK_BOOTTIME_ALARM,CLOCK_REALTIME_ALARM}
(#1480, @eregon). - Improve support of
:chomp
keyword argument inIO
andStringIO
methods (#2650, @andrykonchin). - Implement specializations for immutable ruby objects for ObjectSpace methods (@bjfish).
- Use
$PAGER
for--help
and--help*
, similar to CRuby (#2542, @Strech). - Ensure all headers are warnings-free (#2662, @eregon).
- All
IO
instances should haveT_FILE
as theirrb_type()
, not onlyFile
instances (#2662, @eregon). - Make
rb_fd_select
retry onEINTR
(#1584, @aardvark179).
Performance:
- Reimplement
Float#to_s
for better performance (#1584, @aardvark179). - Improve reference processing by making C object free functions and other finalizers more lightweight (@aardvark179).
- Improve performance of
RSTRING_PTR
for interned strings (@aardvark179). - Cache constant argument formats used with
rb_scan_args_kw
(@aardvark179).
Changes:
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::ForeignException
orrescue foreign_meta_object
(#2544, @eregon).
Bug fixes:
- Guard against unterminated ranges in file matching patterns (#2556, @aardvark179).
- Fixed
rb_proc_new
to return a proc that will pass all required arguments to C (#2556, @aardvark179). - Fixed
String#split
to return empty array when splitting all whitespace on whitespace (#2565, @bjfish). - Raise
RangeError
forTime.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+C
now 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#inspect
return a frozen String (#2613, @eregon). - Fix
Array#pack
withx*
to not output null characters (#2614, @bjfish). - Fix
Random#rand
not returning random floats when given float ranges (#2612, @bjfish). - Fix
Array#sample
for[]
when called withoutn
and aRandom
is given (#2612, @bjfish). - Fix
Module#const_get
to raise aNameError
when nested modules do not exist (#2610, @bjfish). - Ensure native
VALUE
s returned from C are unwrapped before the objects can be collected (@aardvark179). - Fix
Enumerator::Lazy#with_index
to start with new index for multiple enumerations (@bjfish). - Fix
rb_id2name
to 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#fdiv
andRational#to_f
for largeInteger
values (#2631, @bjfish).
Compatibility:
- Implement full Ruby 3 keyword arguments semantics (#2453, @eregon, @chrisseaton).
- Implement
ruby_native_thread_p
for compatibility (#2556, @aardvark179). - Add
rb_argv0
for thetk
gem. (#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
Range
but 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_a
for convertinglist
inrescue *list
(#2572, @eregon). - Implement 'rb_str_buf_append' (@bjfish).
- Add patch for
digest
so 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_index
variable on the default load paths (#2586 , @bjfish) - Do not call
IO#flush
dynamically fromIO#close
(#2594, @gogainda). - Implement
rb_str_new_static
for C extensions that use it (@aardvark179). - Rewrote
ArrayEachIteratorNode
and re-introducedeach
specs for MRI parity when mutating arrays whilst iterating, rather than crashing (#2587, @MattAlp) - Update
String#rindex
to only acceptRegexp
or objects convertable toString
as the first parameter (#2608, @bjfish). - Update
String#<<
to require one argument (#2609, @bjfish). - Update
String#split
to raiseTypeError
when false is given (#2606, @bjfish). - Update
String#lstrip!
to remove leading null characters (#2607, @bjfish). - Update
File.utime
to return the number of file names in the arguments (#2616, @bjfish). - Update
Dir.foreach
to accept anencoding
parameter (#2627, @bjfish). - Update
IO.readlines
to ignore negative limit parameters (#2625 , @bjfish). - Update
Math.sqrt
to raise aMath::DomainError
for negative numbers (#2621, @bjfish). - Update
Enumerable#inject
to raise anArgumentError
if no block or symbol are given (#2626, @bjfish). - Fix
Marshal.dump
to 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
VALUE
s created during C extension init separately (@aardvark179). - Rewrote
ArrayEachIteratorNode
to optimize performance for a constant-sized array and reduce specializations to 1 general case (#2587, @MattAlp) - Reduce conversion of
VALUE
s 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
RuntimeError
but instead remain as foreign exceptions, see the documentation for how to rescue them (@eregon).
TruffleRuby - GraalVM Community Edition 22.0.0.2
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:
Bug fixes:
- Fix File.utime to use nanoseconds (#2448, @bjfish).
- Capture the intercepted feature path during patching to reuse during patch require (#2441, @bjfish).
- Update Module#constants to filter invalid constant identifiers (#2452, @bjfish).
- Fixed -0.0 <=> 0.0 and -0.0 <=> 0 to return 0 like on CRuby (#1391, @eregon).
- Fixed Range#step to return correct class with begin-less range (@ccocchi, #2516).
- Fixed exception creation when an Errno is sub-classed (@bjfish, #2521).
- Fixed String#[]= to use the negotiated encoding (@bjfish, #2545).
Compatibility:
- Implement rb_sprintf in our format compiler to provide consistent formatting across C standard libraries (@eregon).
- Update defined? to return frozen strings (#2450, @bjfish).
- Use compensated summation for {Array,Enumerable}#sum when floating point values are included (@eregon).
- Module#attr_* methods now return an array of method names (#2498, @gogainda).
- Fixed Socket#(local|remote)_address to retrieve family and type from the file descriptor (#2444, @larskanis).
- Add Thread.ignore_deadlock accessor (#2453, @bjfish).
- Allow Hash#transform_keys to take a hash argument (@ccocchi, #2464).
- Add Enumerable#grep{_v} optimization for Regexp (#2453, @bjfish).
- Update IO#write to accept multiple arguments (#2501, @bjfish).
- Do not warn when uninitialized instance variable is accessed (#2502, @andrykonchin).
- Remove TRUE, FALSE, and NIL constants like CRuby 3.0 (#2505, @andrykonchin).
- Symbol#to_proc now returns a lambda like in Ruby 3 (#2508, @andrykonchin).
- Kernel#lambda now warns if called without a literal block (#2500, @andrykonchin).
- Implement Hash#except (#2463, @wildmaples).
- Remove special $SAFE global and related C API methods (#2453, @bjfish).
- Assigning to a numbered parameter raises SyntaxError (#2506, @andrykonchin).
- Implement --backtrace-limit option (#2453, @bjfish).
- Update String methods to return String instances when called on a subclass (#2453, @bjfish).
- Update String#encode to support the :fallback option (#1391, @aardvark179).
- Module#alias_method now returns the defined alias as a symbol(#2499, @gogainda).
- Implement Symbol#name (#2453, @bjfish).
- Update Module#{public, protected, private, public_class_method, private_class_method} and top-level private and public methods to accept single array argument with a list of method names (#2453, @bjfish).
- Constants deprecated by Module#deprecate_constant only warn if Warning[:deprecated] is true (@eregon).
- All Array methods now return Array instances and not subclasses (#2510, @Strech).
- Integer#zero? overrides Numeric#zero? for optimization (#2453, @bjfish).
- Default Kernel#eval source file and line to (eval):1 like CRuby 3 (#2453, @aardvark179).
- Add GC.auto_compact accessors for compatibility (#2453, @bjfish).
- Update accessing a class variable from the top-level scope to be a RuntimeError (#2453, @bjfish).
- Update interpolated strings to not be frozen (#2453, @bjfish).
- Add WERRORFLAG to RbConfig (#2519, @bjfish).
- Update MatchData methods to return String instances when called on a subclass (#2453, @bjfish).
- Implement Proc#{==,eql?} (#2453, @bjfish).
- Implement all StringScanner methods (#2520, @eregon).
- Handle Kernel#clone(freeze: true) (#2512, @andrykonchin).
- Relax Fiber#transfer limitations (#2453, @bjfish).
- Implement Fiber#blocking? like CRuby 3 (#2453, @aardvark179).
- Sort by default for Dir.{glob,[]} and add sort: keyword argument (#2523, @Strech).
- Implement rb_str_locktmp and rb_str_unlocktmp (#2524, @bjfish).
- Update Kernel#instance_variables to return insertion order (@bjfish).
- Fixed rb_path2class() to not error for a module (#2511, @eregon).
- Update Kernel#print to print $_ when no arguments are given (#2531, @bjfish).
- Add category kwarg to Kernel.warn and Warning.warn (#2533, @Strech).
- Implement GC.{measure_total_time, total_time} and update GC.stat to update provided hash (#2535, @bjfish).
- Implement Array#slice with ArithmeticSequence (#2526, @ccocchi).
- Update Hash#each to consistently yield a 2-element array (#2453, @bjfish).
- Remove Hash#{store, index} methods for compatibility (#2546, @bjfish).
- Implement more correct conversion of array elements by Array#pack (#2503, #2504, @aardvark179).
- Update String#split to raise a RangeError when limit is larger than int (@bjfish).
Performance:
- Regexp objects are now interned in a similar way to symbols (@aardvark179).
- Improve performance of regexps using POSIX bracket expressions (e.g., [[:lower:]]) matching against ASCII-only strings (#2447, @nirvdrum).
- String#sub, sub!, gsub, and gsub! have been refactored for better performance (@aardvark179).
- Don't allocate a MatchData object when Regexp#match? or String#match? is used (#2509, @nirvdrum).
- Add ENV.except (#2507, @Strech).
- Fully inline the Integer#+ and Integer#- logic for interpreter speed (#2518, @smarr).
- Remove unnecessary work in negotiating the encoding to use in a Regexp match (#2522, @nirvdrum).
- Add new fast paths for encoding negotiation between strings with different encodings, but which match common default cases (#2522, @nirvdrum).
- Reduce footprint by removing unnecessary nodes for accessing the FrameOnStackMarker (#2530, @smarr).
Changes:
- TruffleRuby now requires Java 11+ and no longer supports Java 8 (@eregon).
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.
TruffleRuby - GraalVM Community Edition 21.2.0.1
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
Bug fixes:
- 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).
TruffleRuby - GraalVM Community Edition 21.2.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:
- New
TruffleRuby::ConcurrentMap
data structure for use inconcurrent-ruby
(#2339, @wildmaples).
Bug fixes:
- Fix of different values of self in different scopes (@entlicher).
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.
TruffleRuby - GraalVM Community Edition 21.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 support can be added to GraalVM using the gu utility.
More information is available on the GraalVM website: https://www.graalvm.org/ruby/
Changelog
21.1.0
New features:
- Access to local variables of the interactive Binding via language bindings is now supported:
context.getBindings("ruby").putMember("my_var", 42);
(#2030). VALUE
s in C extensions now expose the Ruby object when viewed in the debugger, as long as they have not been converted to native values (@aardvark179).- Signal handlers can now be run without triggering multi-threading (@eregon).
- Fibers no longer trigger Truffle multi-threading.
Bug fixes:
Range#to_a
wasn't working forlong
ranges (#2198, @tomstuart and @LillianZ).- Show the interleaved host and guest stacktrace for host exceptions (#2226).
- Fix the label of the first location reported by
Thread#backtrace_locations
(#2229). - Fix
Thread.handle_interrupt
to defer non-pure interrupts until the end of thehandle_interrupt
block (#2219). - Clear and restore errinfo on entry and normal return from methods in C extensions (#2227).
- Fix extra whitespace in squiggly heredoc with escaped newline (#2238, @wildmaples and @norswap).
- Fix handling of signals with
--single-threaded
(#2265). - Fix
Enumerator::Lazy#{chunk_while, slice_before, slice_after, slice_when}
to return instances ofEnumerator::Lazy
(#2273, @bjfish). - Fix
Truffle::Interop.source_location
to return unavailable source sections for modules instead of null (#2257). - Fix usage of
Thread.handle_interrupt
inMonitorMixin#mon_synchronize
. - Fixed
TruffleRuby.synchronized
to handle guest safepoints (#2277). - Fix control flow bug when assigning constants using ||= (#1489).
- Fix
Kernel#raise
argument handling for hashes (#2298). - Set errinfo when
rb_protect
captures a Ruby exception (#2245). - Fixed handling of multiple optional arguments and keywords when passed a positional
Hash
(#2302).
Compatibility:
- Prepend the GraalVM LLVM Toolchain to
PATH
when installing gems (#1974, #1088, #1343, #1400, #1947, #1931, #1588). - Installing the
nokogiri
gem now defaults to use the vendoredlibxml2
andlibxslt
, similar to CRuby, which means the corresponding system packages are no longer needed (#62). - Implemented
$LOAD_PATH.resolve_feature_path
. - Add
Pathname#/
alias toPathname#+
(#2178). - Fixed issue with large
Integer
s inMath.log
(#2184). - Updated
Regexp.last_match
to supportSymbol
andString
parameter (#2179). - Added support for numbered block parameters (
_1
etc). - Fixed
String#upto
issue with non-ascii strings (#2183). - Implemented partial support for pattern matching (#2186).
- Make
File.extname
return'.'
if the path ends with one (#2192, @tomstuart). - Include fractional seconds in
Time#inspect
output (#2194, @tomstuart). - Add support for
Integer#[Range]
andInteger#[start, length]
(#2182, @gogainda). - Allow private calls with
self
as an explicit receiver (#2196, @wildmaples). - Fixed
:perm
parameter forFile.write
. - Implemented
Time#floor
and#ceil
(#2201, @wildmaples). - Allow
Range#include?
and#member?
withTime
(#2202, @wildmaples). - Implemented
Comparable#clamp(Range)
(#2200, @wildmaples). - Added a
Array#minmax
to overrideEnumerable#minmax
(#2199, @wildmaples). - Implemented
chomp
parameter forIO.{readlines, foreach}
(#2205). - Implemented the Debug Inspector C API.
- Added beginless range support for
Range#{new, bsearch, count, each, equal_value, first, inspect, max, min, size, cover?, include?, ===}
. - Added beginless range support for
Array#{[], []=, slice, slice!, to_a, fill, values_at}
(#2155, @LillianZ). - Added beginless range support for
String#{byteslice, slice, slice!}
andSymbol#slice
(#2211, @LillianZ). - Added beginless range support for
Kernel#{caller, caller_locations}
andThread#backtrace_locations
(#2211, @LillianZ). - Make rand work with exclusive range with Float (#1506, @gogainda)
- Fixed
String#dump
's formatting of escaped unicode characters (#2217, @meganniu). - Switched to the io-console C extension from C ruby for better performance and compatibility in
irb
. - Coerce the message to a
String
forBasicSocket#send
(#2209, @HoneyryderChuck). - Support buffer argument for
UDPSocket#recvfrom_nonblock
(#2209, @HoneyryderChuck). - Fixed
Integer#digits
implementation to handle more bases (#2224, #2225). - Support the
inherit
parameter forModule#{private, protected, public}_method_defined?
. - Implement
Thread.pending_interrupt?
andThread#pending_interrupt?
(#2219). - Implement
rb_lastline_set
(#2170). - Implemented
Module#const_source_location
(#2212, @tomstuart and @wildmaples). - Do not call
File.exist?
inDir.glob
asFile.exist?
is often mocked (#2236, @gogainda). - Coerce the inherit argument to a boolean in
Module#const_defined?
andModule#const_get
(#2240). - Refinements take place at
Object#method
andModule#instance_method
(#2004, @ssnickolay). - Add support for
rb_scan_args_kw
in C API (#2244, @LillianZ). - Update random implementation layout to be more compatible (#2234).
- Set
RbConfig::CONFIG['LIBPATHFLAG'/'RPATHFLAG']
like MRI to let$LIBPATH
changes inextconf.rb
work. - Access to path and mode via
rb_io_t
from C has been changed to improve compatibility for io-console. - Implemented the
Time.at
in:
parameter. - Implemented
Kernel#raise
cause
parameter. - Improved compatibility of
Signal.trap
andKernel#trap
(#2287, @chrisseaton). - Implemented
GC.stat(:total_allocated_objects)
as0
(#2292, @chrisseaton). ObjectSpace::WeakMap
now supports immediate and frozen values as both keys and values (#2267).- Call
divmod
when coercion toFloat
fails for#sleep
(#2289, @LillianZ).
Performance:
- Multi-Tier compilation is now enabled by default, which improves warmup significantly.
- Improve the performance of checks for recursion (#2189, @LillianZ).
- Improve random number generation performance by avoiding synchronization (#2190, @ivoanjo).
- We now create a single call target per block by default instead of two.
- Some uses of class variables are now much better optimized (#2259, @chrisseaton).
- Several methods that need the caller frame are now always inlined in their caller, which speeds up the interpreter and reduces footprint.
- Pasting code in IRB should be reasonably fast, by updating to
irb
1.3.3 andreline
0.2.3 (#2233).
Changes:
- Standalone builds of TruffleRuby are now based on JDK11 (they used JDK8 previously). There should be no user-visible changes. Similarly, JDK11 is now used by default in development instead of JDK8.
- The deprecated
Truffle::System.synchronized
has been removed. Java.synchronized
has been removed, it did not work on host objects.