Skip to content
Compare
Choose a tag to compare

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).
  • Foreign arrays now have all methods of Ruby Enumerable and many methods of Array (#2149).
  • 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:

  • Updated to Ruby 2.7.4 to fix CVE-2021-31810, CVE-2021-32066 and CVE-2021-31799.
Compare
Choose a tag to compare

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 the date C extension compiled as a macro on older glibc and then missing the __strspn_c1 symbol on newer glibc (#2406).
Compare
Choose a tag to compare

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 of different values of self in different scopes.
  • 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 multiple Symbols 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 on self and the default definee (#2334).
  • Configure mandir value in RbConfig::CONFIG and RbConfig::MAKEFILE_CONFIG (#2315, @bjfish).
  • TruffleRuby now supports the Truffle polyglot Hash interop API (@norswap).
  • Implement Fiber#raise (#2338).
  • Update File.basename to return new String instances (#2343).
  • Allow Fiber#raise after Fiber#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 comparing Infinity to other #infinite? values.
  • Implement date library as a C extension to improve compatibility (#2344).
  • Update rb_str_modify and rb_str_modify_expand to raise a FrozenError 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 Ruby Array (#2089).

Changes:

  • rb_iterate() (deprecated since 1.9) no longer magically passes the block to rb_funcall(), use rb_block_call() instead.

Security:

Compare
Choose a tag to compare

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).
  • VALUEs in C extensions now expose the Ruby object when viewed in the debugger, as long as they have not been converted to native values.
  • Signal handlers can now be run without triggering multi-threading.
  • Fibers no longer trigger Truffle multi-threading.

Bug fixes:

  • Range#to_a wasn't working for long 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 the handle_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 of Enumerator::Lazy (#2273).
  • Fix Truffle::Interop.source_location to return unavailable source sections for modules instead of null (#2257).
  • Fix usage of Thread.handle_interrupt in MonitorMixin#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 vendored libxml2 and libxslt, similar to CRuby, which means the corresponding system packages are no longer needed (#62).
  • Implemented $LOAD_PATH.resolve_feature_path.
  • Add Pathname#/ alias to Pathname#+ (#2178).
  • Fixed issue with large Integers in Math.log (#2184).
  • Updated Regexp.last_match to support Symbol and String 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] and Integer#[start, length] (#2182, @gogainda).
  • Allow private calls with self as an explicit receiver (#2196, @wildmaples).
  • Fixed :perm parameter for File.write.
  • Implemented Time#floor and #ceil (#2201, @wildmaples).
  • Allow Range#include? and #member? with Time (#2202, @wildmaples).
  • Implemented Comparable#clamp(Range) (#2200, @wildmaples).
  • Added a Array#minmax to override Enumerable#minmax (#2199, @wildmaples).
  • Implemented chomp parameter for IO.{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!} and Symbol#slice (#2211, @LillianZ).
  • Added beginless range support for Kernel#{caller, caller_locations} and Thread#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 for BasicSocket#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 for Module#{private, protected, public}_method_defined?.
  • Implement Thread.pending_interrupt? and Thread#pending_interrupt? (#2219).
  • Implement rb_lastline_set (#2170).
  • Implemented Module#const_source_location (#2212, @tomstuart and @wildmaples).
  • Do not call File.exist? in Dir.glob as File.exist? is often mocked (#2236, @gogainda).
  • Coerce the inherit argument to a boolean in Module#const_defined? and Module#const_get (#2240).
  • Refinements take place at Object#method and Module#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 in extconf.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 and Kernel#trap (#2287, @chrisseaton).
  • Implemented GC.stat(:total_allocated_objects) as 0 (#2292, @chrisseaton).
  • ObjectSpace::WeakMap now supports immediate and frozen values as both keys and values (#2267).
  • Call divmod when coercion to Float 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 and reline 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.
Compare
Choose a tag to compare

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: http://www.graalvm.org/ruby/

Changelog

21.0.0

Release notes:

  • The new IRB is quite slow when copy/pasting code into it. This is due to an inefficient io/console implementation which will be addressed in the next release. A workaround is to use irb --readline, which disables some IRB features but is much faster for copy/pasting code.

New features:

  • Updated to Ruby 2.7.2 (#2004).

Bug fixes:

  • Fix error message when the method name is not a Symbol or String for Kernel#respond_to? (#2132, @ssnickolay)
  • Fixed setting of special variables in enumerators and enumerables (#1484).
  • Fixed return value of Enumerable#count and Enumerable#uniq with multiple yielded arguments (#2145, @LillianZ).
  • Fixed String#unpack for w* format (#2143).
  • Fixed issue with Kernel#` when invalid UTF-8 given (#2118).
  • Fixed issue with Method#to_proc and special variable storage (#2156).
  • Add missing offset parameter for FFI::Pointer#put_array_of_* (#1525).
  • Fixed issue with different Structs having the same hash values (#2214).

Compatibility:

  • Implement String#undump (#2131, @kustosz)
  • Errno constants with the same errno number are now the same class.
  • Implement Enumerable#tally and Enumerable#filter_map (#2144 and #2152, @LillianZ).
  • Implement Range#minmax.
  • Pass more Enumerator::Lazy#uniq and Enumerator::Lazy#chunk specs (#2146, @LillianZ).
  • Implement Enumerator#produce (#2160, @zverok)
  • Implement Complex#<=> (#2004, @ssnickolay).
  • Add warning for proc without block (#2004, @ssnickolay).
  • Implemented FrozenError#receiver.
  • Proc#<< and Proc#>> raises TypeError if passed not callable object (#2004, @ssnickolay).
  • Support time and date related messages for Time (#2166).
  • Updated Dir.{glob,[]} to raise ArgumentError for nul-separated strings.
  • Kernel#lambda with no block in a method called with a block raises an exception (#2004, @ssnickolay).
  • Implemented BigDecimal as C extension to improve compatibility.
  • Comment lines can be placed between fluent dot now (#2004, @ssnickolay).
  • Implemented rb_make_exception.
  • **kwargs now accept non-Symbol keys like Ruby 2.7.
  • Updated the Unicode Emoji version (#2173, @wildmaples).
  • Added Enumerator::Yielder#to_proc.
  • Implemented Enumerator::Lazy#eager.
  • Updated Method#inspect to include paremeter information.
  • Update Module#name to return the same frozen string.

Performance:

  • Refactor and implement more performant MatchData#length (#2147, @LillianZ).
  • Refactor and implement more performant Array#sample (#2148, @LillianZ).
  • String#inspect is now more efficient.

Changes:

  • All InteropLibrary messages are now exposed consistently as methods on Truffle::Interop (#2139). Some methods were renamed to match the scheme described in the documentation.
Compare
Choose a tag to compare

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: http://www.graalvm.org/docs/reference-manual/ruby/

Changelog

20.3.0

Bug fixes:

  • Handle foreign null object as falsy value (#1902, @ssnickolay)
  • Fixed return value of Enumerable#first with multiple yielded arguments (#2056, @LillianZ).
  • Improve reliability of the post install hook by disabling RubyGems (#2075).
  • Fixed top level exception handler to print exception cause (#2013).
  • Fixed issue when extending FFI from File (#2094).
  • Fixed issue with Kernel#freeze not freezing singleton class (#2093).
  • Fixed String#encode with options issue (#2091, #2095, @LillianZ)
  • Fixed issue with spawn when :close redirect is used (#2097).
  • Fixed coverage issue when *eval is used (#2078).
  • Use expanded load paths for feature matching (#1501).
  • Fixed handling of post arguments for super() (#2111).
  • Fixed SystemStackError sometimes replaced by an internal Java NoClassDefFoundError on JVM (#1743).
  • Fixed constant/identifier detection in lexer for non-ASCII encodings (#2079, #2102, @ivoanjo).
  • Fixed parsing of --jvm as an application argument (#2108).
  • Fix rb_rescue2 to ignore the end marker (VALUE)0 (#2127, #2130).
  • Fix String#{chomp, chomp!} issue with invalid encoded strings (#2133).
  • Fix status and output when SystemExit is subclassed and raised (#2128)

Compatibility:

  • Run at_exit handlers even if parsing the main script fails (#2047).
  • Load required libraries (-r) before parsing the main script (#2047).
  • String#split supports block (#2052, @ssnickolay)
  • Implemented String#{grapheme_clusters, each_grapheme_cluster}.
  • Fix the caller location for #method_added (#2059).
  • Fix issue with Float#round when self is -0.0.
  • Fix String#unpack issue with m0 format (#2065).
  • Fix issue with File.absolute_path returning a path to current directory (#2062).
  • Update Range#cover? to handle Range parameter.
  • Fix String#{casecmp, casecmp?} parameter conversion.
  • Fix Regexp issue which raised syntax error instead of RegexpError (#2066).
  • Handle Object#autoload when autoload itself (#1616, @ssnickolay)
  • Skip upgraded default gems while loading RubyGems (#2075).
  • Verify that gem paths are correct before loading RubyGems (#2075).
  • Implement rb_ivar_count.
  • Implemented rb_yield_values2.
  • Implemented Digest::Base#{update, <<} (#2100).
  • Pass the final super specs (#2104, @chrisseaton).
  • Fix arity for arguments with optional kwargs (#1669, @ssnickolay)
  • Fix arity for Proc (#2098, @ssnickolay)
  • Check bounds for FFI::Pointer accesses when the size of the memory behind is known.
  • Implement negative line numbers for eval (#1482).
  • Support refinements for #to_s called by string interpolation (#2110, @ssnickolay)
  • Module#using raises error in method scope (#2112, @ssnickolay)
  • File#path now returns a new mutable String on every call like MRI (#2115).
  • Avoid infinite recursion when redefining Warning#warn and calling Kernel#warn (#2109).
  • Convert objects with #to_path in $LOAD_PATH (#2119).
  • Handle the functions being native for rb_thread_call_without_gvl() (#2090).
  • Support refinements for Kernel#respond_to? (#2120, @ssnickolay)
  • JCodings has been updated from 1.0.45 to 1.0.55.
  • Joni has been updated from 2.1.30 to 2.1.40.

Performance:

  • Calls with a literal block are no longer always split but instead the decision is made by the Truffle splitting heuristic.
  • Symbol#to_proc is now AST-inlined in order to not rely on splitting and to avoid needing the caller frame to find refinements which apply.
  • Symbol#to_proc is now globally cached per Symbol and refinements, to avoid creating many redundant CallTargets.
  • Setting and access to the special variables $~ and $_ has been refactored to require less splitting.

Changes:

  • Migrated from JLine 2 to JLine 3 for the readline standard library.
Compare
Choose a tag to compare

TruffleRuby is a high-performance implementation of the Ruby programming language.
TruffleRuby aims to be fully compatible with the standard implementation of Ruby, MRI, version 2.6.6.

More information is available on the GraalVM website: http://www.graalvm.org/docs/reference-manual/ruby/

Changelog

20.2.0

New features:

  • Updated to Ruby 2.6.6.
  • Use InteropLibrary#toDisplayString() to better display objects from other languages.
  • Implement writing to the top scope for global variables (#2024).
  • foreign_object.to_s now uses InteropLibrary#toDisplayString() (and still asString() if isString()).
  • foreign_object.inspect has been improved to be more useful (include the language and meta object).
  • foreign_object.class now calls getMetaObject() (except for Java classes, same as before).
  • Add basic support for Linux ARM64.
  • foreign_object.name = value will now call Interoplibrary#writeMember("name", value) instead of invokeMember("name=", value).
  • Always show the Ruby core library files in backtraces (#1414).
  • The Java stacktrace is now shown when sending SIGQUIT to the process, also on TruffleRuby Native, see Debugging for details (#2041).
  • Calls to foreign objects with a block argument will now pass the block as the last argument.
  • foreign.name will now use invokeMember if invocable and if not use readMember, see doc/contrib/interop_implicit_api.md for details.
  • foreign.to_f and foreign.to_i will now attempt to convert to Ruby Float and Integer (#2038).
  • foreign.equal?(other) now uses InteropLibrary#isIdentical(other) and foreign.object_id/__id__ now uses InteropLibrary#identityHashCode().

Bug fixes:

  • Fix #class_exec, #module_exec, #instance_eval, and instance_exec to use activated refinements (#1988, @ssnickolay).
  • Fixed missing method error for FFI calls with blocking: true when interrupted.
  • Use upgraded default gems when installed (#1956).
  • Fixed NameError when requiring an autoload path that does not define the autoload constant (#1905).
  • Thread local IO buffers are now allocated using a stack to ensure safe operating if a signal handler uses one during an IO operation.
  • Fixed TracePoint thread-safety by storing the state on the Ruby Thread (like MRI) instead of inside the TracePoint instance.
  • Make require 'rubygems/package' succeed and define Gem::Deprecate correctly (#2014).
  • Fix MBCLEN_CHARFOUND_P error.
  • Fix rb_enc_str_new when NULL encoding is given with a constant string.
  • Fixed rb_enc_precise_mbclen to handle more inputs.
  • The output for --engine.TraceCompilation is now significantly easier to read, by having shorter method names and source names (oracle/graal#2052).
  • Fix indentation for squiggly heredoc with single quotes (#1564).
  • Only print members which are readable for foreign #inspect (#2027).
  • Fixed the return value of the first call to Kernel#srand in a Thread (#2028).
  • Fix missing flushing when printing an exception at top-level with a custom backtrace, which caused no output being shown (#1750, #1895).
  • Use the mode of the given IO for IO#reopen(IO) which is important for the 3 standard IOs (#2034).
  • Fix potential deadlock when running finalizers (#2041).
  • Let require 'rubygems/specification' work before require 'rubygems'.

Compatibility:

  • Implement UnboundMethod#bind_call.
  • Implemented ObjectSpace::WeakMap (#1385, #1958).
  • Implemented strtod and ruby_strtod (#2007).
  • Fix detection of #find_type in FFI to ignore MakeMakefile#find_type from mkmf (#1896, #2010).
  • Implemented rb_uv_to_utf8 (#1998, @skateman).
  • Implemented rb_str_cat_cstr.
  • Implemented rb_fstring.
  • Support #refine for Module (#2021, @ssnickolay).
  • Implemented rb_ident_hash_new.
  • Improved the compatibility of Symbol.all_symbols (#2022, @chrisseaton).
  • Implemented rb_enc_str_buf_cat.
  • Implemented rb_int_positive_pow.
  • Implemented rb_usascii_str_new_lit.
  • Define #getch and #getpass on StringIO when io/console is required.
  • Implemented rb_uv_to_utf8 (#1998).
  • Single character IDs now behave more like those in MRI to improve C extension compatibility, so rb_funcall(a, '+', b) will now do the same thing as in MRI.
  • Removed extra public methods on String.
  • Implemented rb_array_sort and rb_array_sort_bang.
  • Do not create a finalizers Thread if there are other public languages, which is helpful for polyglot cases (#2035).
  • Implemented rb_enc_isalnum and rb_enc_isspace.
  • RUBY_REVISION is now the full commit hash used to build TruffleRuby, similar to MRI 2.7+.
  • Implemented rb_enc_mbc_to_codepoint.
  • Changed the lookup methods to achieve Refinements specification (#2033, @ssnickolay)
  • Implemented Digest::Instance#new (#2040).
  • Implemented ONIGENC_MBC_CASE_FOLD.
  • Fixed Thread#raise to call the exception class' constructor with no arguments when given no message (#2045).
  • Fixed refine + super compatibility (#2039, #2048, @ssnickolay)
  • Make the top-level exception handler more compatible with MRI (#2047).
  • Implemented rb_enc_codelen.
  • Implemented Ripper by using the C extension (#1585).

Changes:

  • RubyGems gem commands updated to use the --no-document option by default.

Performance:

  • Enable lazy translation from the parser AST to the Truffle AST for user code by default. This should improve application startup time (#1992).
  • instance variable ... not initialized and similar warnings are now optimized to have no peak performance impact if they are not printed (depends on $VERBOSE).
  • Implement integer modular exponentiation using BigInteger#mod_pow (#1999, @skateman)
  • Fixed a performance issue when computing many substrings of a given non-leaf String with non-US-ASCII characters.
  • Speedup native handle to Ruby object lookup for C extensions.
Compare
Choose a tag to compare

TruffleRuby is a high-performance implementation of the Ruby programming language 2.6.5.

More information is available on the GraalVM website: http://www.graalvm.org/docs/reference-manual/languages/ruby/

Changelog

New features:

  • Nightly builds of TruffleRuby are now available, see the README for details (#1483).
  • ||= will not compile the right-hand-side if it's only executed once, to match the idiomatic lazy-initialisation use-case (blog post, #1887, @kipply).
  • Added --metrics-profile-require option to profile searching, parsing, translating and loading files.
  • Added support for captured variables for the Truffle instruments (e.g. Chrome debugger).

Bug fixes:

  • Fixed Exception#dup to copy the Exception#backtrace string array.
  • Fixed rb_warn and rb_warning when used as statements (#1886, @chrisseaton).
  • Fixed NameError.new and NoMethodError.new :receiver argument.
  • Correctly handle large numbers of arguments to rb_funcall (#1882).
  • Added arity check to Module#{include, prepend}.
  • Fix OpenSSL::Digest.{digest,hexdigest,base64digest} to handle algorithm, data arguments (#1889, @bdewater).
  • Fixed SystemCallError.new parameter conversion.
  • Fixed File#{chmod, umask} argument conversion check.
  • Added warning in Hash.[] for non-array elements.
  • Fixed File.lchmod to raise NotImplementedError when not available.
  • RSTRING_PTR() now always returns a native pointer, resolving two bugs memcpying to (#1822) and from (#1772) Ruby Strings.
  • Fixed issue with duping during splat (#1883).
  • Fixed Dir#children implementation.
  • Fixed SignalException.new error when bad parameter given.
  • Added deprecation warning to Kernel#=~.
  • Fixed puts for a foreign objects, e.g. puts Polyglot.eval('js', '[]') (#1881).
  • Fixed Exception#full_message implementation.
  • Updated Kernel.Complex() to handle the exception: false parameter.
  • Fixed Kernel#dup to return self for Complex and Rational objects.
  • Updated Kernel.Float() to handle the exception: false parameter.
  • Fixed String#unpack M format (#1901).
  • Fixed error when SystemCallError message contained non-ASCII characters.
  • Fixed rb_rescue to allow null rescue methods. (#1909, @kipply).
  • Fixed incorrect comparisons between bignums and doubles.
  • Prevented some internal uses of Kernel#caller_locations to be overridden by user code (#1934).
  • Fixed an issue caused by recursing inlining within Regexp#quote (#1927).
  • Updated Kernel.Float() to return given string in error message (#1945).
  • Parameters and arity of methods derived from method_missing should now match MRI (#1921).
  • Fixed compile error in RB_FLOAT_TYPE_P macro (#1928).
  • Fixed Symbol#match to call the block with the MatchData (#1933).
  • Fixed Digest::SHA2.hexdigest error with long messages (#1922).
  • Fixed Date.parse to dup the coerced string to not modify original (#1946).
  • Update Comparable error messages for special constant values (#1941).
  • Fixed File.ftype parameter conversion (#1961).
  • Fixed Digest::Instance#file to not modify string literals (#1964).
  • Make sure that string interpolation returns a String, and not a subclass (#1950).
  • alias_method and instance_methods should now work correctly inside a refinement (#1942).
  • Fixed Regexp.union parameter conversion (#1963).
  • IO#read(n) no longer buffers more than needed, which could cause hanging if detecting readability via a native call such as select(2) (#1951).
  • Fixed Random::DEFAULT.seed to be different on boot (#1965, @kipply)
  • rb_encoding->name can now be read even if the rb_encoding is stored in native memory.
  • Detect and cut off recursion when inspecting a foreign object, substituting an ellipsis instead.
  • Fixed feature lookup order to check every $LOAD_PATH path entry for .rb, then every entry for native extension when require is called with no extension.
  • Define the _DARWIN_C_SOURCE macro in extension makefiles (#1592).
  • Change handling of var args in rb_rescue2 to handle usage in C extensions (#1823).
  • Fixed incorrect Encoding::CompatibilityError raised for some interpolated Regexps (#1967).
  • Actually unset environment variables with a nil value for Process.spawn instead of setting them to an empty String.
  • Core library methods part of the Native Image heap are no longer added in the compilation queue on the first call, but after they reach the thresholds like other methods.
  • Fix RbConfig::CONFIG['LIBRUBY_SO'] file extension.
  • Fix char, short, unsigned char, unsigned int, and unsigned short types in Fiddle (#1971).
  • Fix IO#select to reallocate its buffer if it is interrupted by a signal.
  • Fix issue where interpolated string matched # within string as being a variable (#1495).
  • Fix File.join to raise error on strings with null bytes.
  • Fix initialization of Ruby Thread for foreign thread created in Java.
  • Fix registration of default specs in RubyGems (#1987).

Compatibility:

  • The C API type VALUE is now defined as unsigned long as on MRI. This enables switch (VALUE) and other expressions which rely on VALUE being an integer type (#1409, #1541, #1675, #1917, #1954).
  • Implemented Float#{floor, ceil} with ndigits argument.
  • Implemented Thread#fetch.
  • Implemented Float#truncate with ndigits argument.
  • Made String#{byteslice, slice, slice!} and Symbol#slice compatible with endless ranges.
  • Implemented "instance variable not initialized" warning.
  • Make Kernel#{caller, caller_locations} and Thread#backtrace_locations compatible with endless ranges.
  • Implemented Dir#each_child.
  • Implemented Kernel.{chomp, chop} and Kernel#{chomp, chop}.
  • Implemented -p and -a, and -l CLI options.
  • Convert the argument to File.realpath with #to_path (#1894).
  • StringIO#binmode now sets the external encoding to BINARY like MRI (#1898).
  • StringIO#inspect should not include the contents of the StringIO (#1898).
  • Implemented rb_fd_* functions (#1623).
  • Fixed uninitialized variable warnings in core and lib (#1897).
  • Make Thread#backtrace support omit, length and range arguments.
  • Implemented Range#%.
  • Fixed the type of the flags field of rb_data_type_t (#1911).
  • Implemented rb_obj_is_proc (#1908, @kipply, @XrXr).
  • Implemented C API macro RARRAY_ASET().
  • Implemented num2short (#1910, @kipply).
  • RSTRING_END() now always returns a native pointer.
  • Removed register specifier for rb_mem_clear() (#1924).
  • Implemented Thread::Backtrace::Locations#base_label (#1920).
  • Implemented rb_mProcess (#1936).
  • Implemented rb_gc_latest_gc_info (#1937).
  • Implemented RBASIC_CLASS (#1935).
  • Yield 2 arguments for Hash#map if the arity of the block is > 1 (#1944).
  • Add all Errno constants to match MRI, needed by recent RubyGems.
  • Silence ruby_dep warnings since that gem is unmaintained.
  • Clarify error message for not implemented Process.daemon (#1962).
  • Allow multiple assignments in conditionals (#1513).
  • Update NoMethodError#message to match MRI (#1957).
  • Make StringIO work with --enable-frozen-string-literal (#1969).
  • Support NULL for the status of rb_protect().
  • Ensure BigDecimal#inspect does not call BigDecimal#to_s to avoid behaviour change on to_s override (#1960).
  • Define all C-API rb_{c,m,e}* constants as C global variables (#1541).
  • Raise ArgumentError for Socket.unpack_sockaddr_un if the socket family is incorrect.
  • Implemented RTYPEDDATA_*() macros and rb_str_tmp_new() (#1975).
  • Implemented rb_set_end_proc (#1959).
  • Implemented rb_to_symbol.
  • Implemented rb_class_instance_methods, rb_class_public_instance_methods, rb_class_protected_instance_methods, and rb_class_private_instance_methods.
  • Implemented rb_tracepoint_new, rb_tracepoint_disable, rb_tracepoint_enable, and rb_tracepoint_enabled_p (#1450).
  • Implemented RbConfig::CONFIG['AR'] and RbConfig::CONFIG['STRIP'] (#1973).
  • Not yet implemented C API functions are now correctly detected as missing via mkmf's have_func (#1980).
  • Accept RUBY_INTERNAL_EVENT_{NEWOBJ,FREEOBJ} events but warn they are not triggered (#1978, #1983).
  • IO.copy_stream(in, STDOUT) now writes to STDOUT without buffering like MRI.
  • Implemented RbConfig['vendordir'].
  • Implemented Enumerator::ArithmeticSequence.
  • Support (struct RBasic *)->flags and ->klass from ruby.h (#1891, #1884, #1978).

Changes:

  • TRUFFLERUBY_RESILIENT_GEM_HOME has been removed. Unset GEM_HOME and GEM_PATH instead if you need to.
  • The deprecated Truffle::System.full_memory_barrier, Truffle::Primitive.logical_processors, and Truffle::AtomicReference have been removed.
  • The implicit interface for allowing Ruby objects to behave as polyglot arrays with #size, #[] methods has been removed and replaced with an explicit interface where each method starts with polyglot_*.
  • Hash keys are no longer reported as polyglot members.
  • All remaining implicit polyglot behaviour for #[] method was replaced with polyglot_* methods.
  • Rename dynamic API to match InteropLibrary. All the methods keep the name as it is in InteropLibrary with the following changes: use snake_case, add polyglot_ prefix, drop get and is prefix, append ? on all predicates.
  • Split Truffle::Interop.write into .write_array_element and .write_member methods.
  • Rename Truffle::Interop.size to .array_size.
  • Rename Truffle::Interop.is_boolean? to .boolean?.
  • Split Truffle::Interop.read into .read_member and .read_array_element.
  • Drop is_ prefix in Truffle::Interop.is_array_element_* predicates.
  • Truffle::Interop.hash_keys_as_members has been added to treat a Ruby Hash as a polyglot object with the Hash keys as members.

Performance:

  • Optimized RSTRING_PTR() accesses by going to native directly, optimized various core methods, use Mode=latency and tune GC heap size for Bundler. This speeds up bundle install from 84s to 19s for a small Gemfile with 6 gems (#1398).
  • Fixed memory footprint issue due to large compilation on Native Image, notably during bundle install (#1893).
  • ArrayBuilderNode now uses a new Truffle library for manipulating array stores.
  • Ruby objects passed to C extensions are now converted less often to native handles.
  • Calling blocking system calls and running C code with unblocking actions has been refactored to remove some optimisation boundaries.
  • return expressions are now rewritten as implicit return expressions where control flow allows this to be safely done as a tail optimisation. This can improve interpreter performance by up to 50% in some benchmarks, and can be applied to approximately 80% of return nodes seen in Rails and its dependencies (#1977).
  • The old array strategy code has been removed and all remaining nodes converted to the new ArrayStoreLibrary.
  • Updated nil to be a global immutable singleton (#1835).
Compare
Choose a tag to compare

TruffleRuby is a high-performance implementation of the Ruby programming language 2.6.5. More information is available on the GraalVM website. Changes in 20.0.0 (from the project changelog):

New features:

  • Enable and document --coverage option (#1840, @chrisseaton).
  • Update the internal LLVM toolchain to LLVM 9 and reduce its download size.
  • Updated to Ruby 2.6.5 (#1749).
  • Automatically set PKG_CONFIG_PATH as needed for compiling OpenSSL on macOS (#1830).

Bug fixes:

  • Fix Tempfile#{size,length} when the IO is not flushed (#1765, @rafaelfranca).
  • Dump and load instance variables in subclasses of Exception (#1766, @rafaelfranca).
  • Fix Date._iso8601 and Date._rfc3339 when the string is an invalid date (#1773, @rafaelfranca).
  • Fail earlier for bad handle unwrapping (#1777, @chrisseaton).
  • Match out of range ArgumentError message with MRI (#1774, @rafaelfranca)
  • Raise Encoding::CompatibilityError with incompatible encodings on Regexp (#1775, @rafaelfranca).
  • Fixed interactions between attributes and instance variables in Struct (#1776, @chrisseaton).
  • Coercion fixes for TCPServer.new (#1780, @XrXr)
  • Fix Float#<=> not calling coerce when other argument responds to it (#1783, @XrXr).
  • Do not warn / crash when requiring a file that sets and trigger autoload on itself (#1779, @XrXr).
  • Strip trailing whitespaces when creating a BigDecimal with a String (#1796, @XrXr).
  • Default close_others in Process.exec to false like Ruby 2.6 (#1798, @XrXr).
  • Don't clone methods when setting method to the same visibility (#1794, @XrXr).
  • BigDecimal() deal with large rationals precisely (#1797, @XrXr).
  • Make it possible to call instance_exec with rb_block_call (#1802, @XrXr).
  • Check for duplicate members in Struct.new (#1803, @XrXr).
  • Process::Status#to_i return raw waitpid(2) status (#1800, @XrXr).
  • Process#exec: set close-on-exec to false for fd redirection (#1805, @XrXr, @rafaelfranca).
  • Building C extensions should now work with frozen string literals (#1786).
  • Keep the Truffle working directory in sync with the native working directory.
  • Rename to_native to polyglot_to_native to match polyglot_pointer? and polyglot_address methods.
  • Fixed missing partial evaluation boundary in Array#{sort,sort!} (#1727).
  • Fixed the class of self and the wrapping Module for Kernel#load(path, wrap=true) (#1739).
  • Fixed missing polyglot type declaration for RSTRING_PTR to help with native/managed interop.
  • Fixed Module#to_s and Module#inspect to not return an extra #<Class: for singleton classes.
  • Arrays backed by native storage now allocate the correct amount of memory (#1828).
  • Fixed issue in ConditionVariable#wait that could lose a ConditionVariable#signal.
  • Do not expose TruffleRuby-specific method Array#swap (#1816)
  • Fixed #inspect on broken UTF-8 sequences (#1842, @chrisseaton).
  • Truffle::Interop.keys should report methods of String and Symbol (#1817)
  • Kernel#sprintf encoding validity has been fixed (#1852, @XrXr).
  • Fixed ArrayIndexOutOfBoundsException in File.fnmatch (#1845).
  • Make String#concat work with no or multiple arguments (#1519).
  • Make Array#concat work with no or multiple arguments (#1519).
  • Coerce BigDecimal(arg) using to_str (#1826).
  • Fixed NameError#dup, NoMethodError#dup, and SystemCallError#dup to copy internal fields.
  • Make Enumerable#chunk work without a block (#1518).
  • Fixed issue with SystemCallError.new setting a backtrace too early.
  • Fixed BigDecimal#to_s formatting issue (#1711).
  • Run END keyword block only once at exit.
  • Implement Numeric#clone to return self.
  • Fixed Symbol#to_proc to create a Proc with nil source_location (#1663).
  • Make GC.start work with keyword arguments.
  • Fixed Kernel#clone for nil, true, false, Integer, and Symbol.
  • Make top-level methods available in Context#getBindings() (#1838).
  • Made Kernel#caller_locations accept a range argument, and return nil when appropriate.
  • Made rb_respond_to work with primitives (#1869, @chrisseaton).
  • Fixed issue with missing backtrace for rescue $ERROR_INFO (#1660).
  • Fixed Struct#hash for keyword_init: true Struct.
  • Fixed String#{upcase!,downcase!,swapcase!}(:ascii) for non-ASCII-compatible encodings like UTF-16.
  • Fixed String#capitalize! for strings that weren't full ASCII.
  • Fixed enumeration issue in ENV.{select, filter}.
  • Fixed Complex and Rational should be frozen after initializing.
  • Fixed printf should raise error when not enough arguments for positional argument.
  • Removed "shadowing outer local variable" warning.
  • Fixed parameter conversion to String in ENV methods.
  • Fixed deprecation warning when ENV.index is called.
  • Fixed issue with ENV.each_key.
  • Fixed ENV.replace implementation.
  • Fixed ENV.udpate implementation.
  • Fixed argument handling in Kernel.printf.
  • Fixed character length after conversion to binary from a non-US-ASCII String.
  • Fixed issue with installing latest bundler (#1880).
  • Fixed type conversion for Numeric#step step parameter.
  • Fixed Kernel#Integer conversion.
  • Fixed IO.try_convert parameter conversion.
  • Fixed linking of always-inline C API functions with -std=gnu90 (#1837, #1879).
  • Avoid race conditions during gem install by using a single download thread.
  • RSTRING_PTR() now always returns a native pointer, resolving two bugs memcpying to (#1822) and from (#1772) Ruby Strings.
  • Do not use gems precompiled for MRI on TruffleRuby (#1837).

Compatibility:

  • Implemented String#start_with?(Regexp) (#1771, @dimameshcharakou).
  • Various improvements to SignalException and signal handling (#1790, @XrXr).
  • Implemented rb_utf8_str_new, rb_utf8_str_new_cstr, rb_utf8_str_new_static (#1788, @chrisseaton).
  • Implemented the unit argument of Time.at (#1791, @XrXr).
  • Implemented keyword_init: true for Struct.new (#1789, @XrXr).
  • Implemented MatchData#dup (#1792, @XrXr).
  • Implemented a native storage strategy for Array to allow better C extension compatibility.
  • Implemented rb_check_symbol_cstr (#1814).
  • Implemented rb_hash_start (#1841, @XrXr).
  • JCodings has been updated from 1.0.42 to 1.0.45.
  • Joni has been updated from 2.1.25 to 2.1.30.
  • Implemented Method#<< and Method#>> (#1821).
  • The .bundle file extension is now used for C extensions on macOS (#1819, #1837).
  • Implemented Comparable#clamp (#1517).
  • Implemented rb_gc_register_mark_object and rb_enc_str_asciionly_p (#1856, @chrisseaton).
  • Implemented rb_io_set_nonblock (#1741).
  • Include the major kernel version in RUBY_PLATFORM on macOS like MRI (#1860, @eightbitraptor).
  • Implemented Enumerator::Chain, Enumerator#+, and Enumerable#chain (#1859, #1858).
  • Implemented Thread#backtrace_locations and Exception#backtrace_locations (#1556).
  • Implemented rb_module_new, rb_define_class_id, rb_define_module_id, (#1876, @XrXr, @chrisseaton).
  • Implemented -n CLI option (#1532).
  • Cache the Symbol of method names in call nodes only when needed (#1872).
  • Implemented rb_get_alloc_func and related functions (#1874, @XrXr).
  • Implemented rb_module_new, rb_define_class_id, rb_define_module_id, (#1876, @chrisseaton).
  • Implemented ENV.slice.
  • Support for the Darkfish theme for RDoc generation has been added back.
  • Implemented Kernel#system exception: true option.
  • Implemented Random.bytes.
  • Implemented Random.random_number.
  • Added the ability to parse endless ranges.
  • Made Range#to_a compatible with endless ranges.
  • Made Array#[] and Array#[]= compatible with endless ranges.

Performance:

  • Use a smaller limit for identity-based inline caches to improve warmup by avoiding too many deoptimizations.
  • long[] array storage now correctly declare that they accept int values, reducing deoptimisations and promotions to Object[] storage.
  • Enable inline caching of Symbol conversion for rb_iv_get and rb_iv_set.
  • rb_type information is now cached on classes as a hidden variable to improve performance.
  • Change to using thread local buffers for socket calls to reduce allocations.
  • Refactor IO.select to reduce copying and optimisation boundaries.
  • Refactor various String and Rope nodes to avoid Truffle performance warnings.
  • Reading caller frames should now work in more cases without deoptimisation.