Skip to content

TruffleRuby - GraalVM Community Edition 20.1.0

Compare
Choose a tag to compare
@ezzarghili ezzarghili released this 19 May 18:09
· 11025 commits to master since this release

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, @eregon).
  • ||= 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, @aardvark179).
  • 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, @bjfish).
  • 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, @pitr-ch).
  • 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, @norswap).
  • 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).