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).