Skip to content

TruffleRuby - GraalVM Community Edition 1.0 RC6

Pre-release
Pre-release
Compare
Choose a tag to compare
@ansalond ansalond released this 03 Sep 14:46
· 17816 commits to master since this release

TruffleRuby is high performance implementation of the Ruby programming language, compatible with MRI 2.4.4.

TruffleRuby is progressing fast but is currently probably not ready for you to try running your full Ruby application on. However it is ready for experimentation and curious end-users to try on their gems and smaller applications.

TruffleRuby runs Rails, and passes the majority of the Rails test suite. But it is missing support for Nokogiri and ActiveRecord database drivers which makes it not practical to run real Rails applications at the moment.

The Ruby language components can be installed in GraalVM using the gu utility.

Release Notes

New features:

  • Polyglot.export can now be used with primitives, and will now convert
    strings to Java, and .import will convert them from Java.
  • Implemented --encoding, --external-encoding, --internal-encoding.
  • rb_object_tainted and similar C functions have been implemented.
  • rb_struct_define_under has been implemented.
  • RbConfig::CONFIG['sysconfdir'] has been implemented.
  • Etc has been implemented (#1403).
  • The -Xcexts=false option disables C extensions.
  • Instrumentation such as the CPUSampler reports methods in a clearer way like
    Foo#bar, Gem::Specification.each_spec, block in Foo#bar instead of just
    bar, each_spec, block in bar (which is what MRI displays in backtraces).
  • TruffleRuby is now usable as a JSR 223 (javax.script) language.
  • A migration guide from JRuby (doc/user/jruby-migration.md) is now included.
  • kind_of? works as an alias for is_a? on foreign objects.
  • Boxed foreign strings unbox on to_s, to_str, and inspect.

Bug fixes:

  • Fix false-positive circular warning during autoload.
  • Fix Truffle::AtomicReference for concurrent-ruby.
  • Correctly look up llvm-link along clang and opt so it is no longer
    needed to add LLVM to PATH on macOS for Homebrew and MacPorts.
  • Fix alias to work when in a refinement module (#1394).
  • Array#reject! no longer truncates the array if the block raises an
    exception for an element.
  • WeakRef now has the same inheritance and methods as MRI's version.
  • Support -Wl linker argument for C extensions. Fixes compilation ofmysql2
    and pg.
  • Using Module#const_get with a scoped argument will now correctly
    autoload the constant if needed.
  • Loaded files are read as raw bytes, rather than as a UTF-8 string and then
    converted back into bytes.
  • Return 'DEFAULT' for Signal.trap(:INT) {}. Avoids a backtrace when quitting
    a Sinatra server with Ctrl+C.
  • Support Signal.trap('PIPE', 'SYSTEM_DEFAULT'), used by the gem rouge
    (#1411).
  • Fix arity checks and handling of arity -2 for rb_define_method().
  • Setting $SAFE to a negative value now raises a SecurityError.
  • The offset of DATA is now correct in the presence of heredocs.
  • Fix double-loading of the json gem, which led to duplicate constant
    definition warnings.
  • Fix definition of RB_NIL_P to be early enough. Fixes compilation of
    msgpack.
  • Fix compilation of megamorphic interop calls.
  • Kernel#singleton_methods now correctly ignores prepended modules of
    non-singleton classes. Fixes loading sass when activesupport is loaded.
  • Object identity numbers should never be negative.

Performance:

  • Optimize keyword rest arguments (def foo(**kwrest)).
  • Optimize rejected (non-Symbol keys) keyword arguments.
  • Source SecureRandom.random_bytes from /dev/urandom rather than OpenSSL.
  • C extension bitcode is no longer encoded as Base64 to pass it to Sulong.
  • Faster String#== using vectorization.

Changes:

  • Clarified that all sources that come in from the Polyglot API eval method
    will be treated as UTF-8, and cannot be re-interpreted as another encoding
    using a magic comment.
  • The -Xembedded option can now be set set on the launcher command line.
  • The -Xplatform.native=false option can now load the core library, by
    enabling -Xpolyglot.stdio.
  • $SAFE and Thread#safe_level now cannot be set to 1 - raising an error
    rather than warning as before. -Xsafe allows it to be set, but there are
    still no checks.
  • Foreign objects are now printed as #<Foreign:system-identity-hash-code>,
    except for foreign arrays which are now printed as #<Foreign [elements...]>.
  • Foreign objects to_s now calls inspect rather than Java's toString.
  • The embedded configuration (-Xembedded) now warns about features which may
    not work well embedded, such as signals.
  • The -Xsync.stdio option has been removed - use standard Ruby
    STDOUT.sync = true in your program instead.