diff options
87 files changed, 744 insertions, 744 deletions
diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml index 2d198331d9..133dc36bfc 100644 --- a/.github/workflows/compilers.yml +++ b/.github/workflows/compilers.yml @@ -197,7 +197,7 @@ jobs: # - { name: VM_DEBUG_BP_CHECK, env: { cppflags: '-DVM_DEBUG_BP_CHECK' } } # - { name: VM_DEBUG_VERIFY_METHOD_CACHE, env: { cppflags: '-DVM_DEBUG_VERIFY_METHOD_CACHE' } } - - { name: MJIT_FORCE_ENABLE, env: { cppflags: '-DMJIT_FORCE_ENABLE' } } + - { name: RJIT_FORCE_ENABLE, env: { cppflags: '-DRJIT_FORCE_ENABLE' } } - { name: YJIT_FORCE_ENABLE, env: { cppflags: '-DYJIT_FORCE_ENABLE' } } name: ${{ matrix.entry.name }} diff --git a/.github/workflows/rjit-bindgen.yml b/.github/workflows/rjit-bindgen.yml index 3107fcee0a..45f05f65b0 100644 --- a/.github/workflows/rjit-bindgen.yml +++ b/.github/workflows/rjit-bindgen.yml @@ -1,4 +1,4 @@ -name: MJIT bindgen +name: RJIT bindgen on: push: paths-ignore: diff --git a/.github/workflows/rjit.yml b/.github/workflows/rjit.yml index 7a95cb6875..701a4779e7 100644 --- a/.github/workflows/rjit.yml +++ b/.github/workflows/rjit.yml @@ -1,4 +1,4 @@ -name: MJIT +name: RJIT on: push: paths-ignore: @@ -112,7 +112,7 @@ jobs: payload: | { "ci": "GitHub Actions", - "env": "MJIT / ${{ matrix.run_opts }}", + "env": "RJIT / ${{ matrix.run_opts }}", "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "commit": "${{ github.sha }}", "branch": "${{ github.ref_name }}" diff --git a/.gitignore b/.gitignore index d36aeee7ba..30e5f49699 100644 --- a/.gitignore +++ b/.gitignore @@ -238,7 +238,7 @@ lcov*.info # /win32/ /win32/*.ico -# MJIT +# RJIT /include/ruby-*/*/rb_mjit_min_header-*.h /lib/ruby_vm/mjit/instruction.rb /lib/ruby_vm/rjit/instruction.rb diff --git a/README.ja.md b/README.ja.md index eab96b0b0b..67bbc9530d 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,5 +1,5 @@ [](https://github.com/ruby/ruby/actions?query=workflow%3A"MinGW") -[](https://github.com/ruby/ruby/actions?query=workflow%3A"MJIT") +[](https://github.com/ruby/ruby/actions?query=workflow%3A"RJIT") [](https://github.com/ruby/ruby/actions?query=workflow%3A"Ubuntu") [](https://github.com/ruby/ruby/actions?query=workflow%3A"Windows") [](https://ci.appveyor.com/project/ruby/ruby/branch/master) @@ -1,5 +1,5 @@ [](https://github.com/ruby/ruby/actions?query=workflow%3A"MinGW") -[](https://github.com/ruby/ruby/actions?query=workflow%3A"MJIT") +[](https://github.com/ruby/ruby/actions?query=workflow%3A"RJIT") [](https://github.com/ruby/ruby/actions?query=workflow%3A"Ubuntu") [](https://github.com/ruby/ruby/actions?query=workflow%3A"Windows") [](https://ci.appveyor.com/project/ruby/ruby/branch/master) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index f9b3e919b8..fc4998b523 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -669,7 +669,7 @@ end def assert_finish(timeout_seconds, testsrc, message = '') add_assertion testsrc, -> as do - if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait + if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # for --jit-wait timeout_seconds *= 3 end diff --git a/bootstraptest/test_gc.rb b/bootstraptest/test_gc.rb index d7c8251afa..591df7d440 100644 --- a/bootstraptest/test_gc.rb +++ b/bootstraptest/test_gc.rb @@ -14,7 +14,7 @@ ms = "a".."k" o.send(meth) end end -}, '[ruby-dev:39453]' unless ENV.fetch('RUN_OPTS', '').include?('mjit') # speed up MJIT CI +}, '[ruby-dev:39453]' unless ENV.fetch('RUN_OPTS', '').include?('mjit') # speed up RJIT CI assert_normal_exit %q{ a = [] diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 13da1e35fb..7c2a50c4e0 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -2244,7 +2244,7 @@ assert_equal '[[:c_return, :String, :string_alias, "events_to_str"]]', %q{ events.compiled(events) events -} unless defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # MJIT calls extra Ruby methods +} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods # test enabling a TracePoint that targets a particular line in a C method call assert_equal '[true]', %q{ @@ -2326,7 +2326,7 @@ assert_equal '[[:c_call, :itself]]', %q{ tp.enable { shouldnt_compile } events -} unless defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # MJIT calls extra Ruby methods +} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods # test enabling c_return tracing before compiling assert_equal '[[:c_return, :itself, main]]', %q{ @@ -2341,7 +2341,7 @@ assert_equal '[[:c_return, :itself, main]]', %q{ tp.enable { shouldnt_compile } events -} unless defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # MJIT calls extra Ruby methods +} unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # RJIT calls extra Ruby methods # test c_call invalidation assert_equal '[[:c_call, :itself]]', %q{ @@ -360,7 +360,7 @@ ruby.imp: $(COMMONOBJS) $(NM) -Pgp $(COMMONOBJS) | \ awk 'BEGIN{print "#!"}; $$2~/^[A-TV-Z]$$/&&$$1!~/^$(SYMBOL_PREFIX)(Init_|InitVM_|ruby_static_id_|.*_threadptr_|rb_ec_)|^\./{print $$1}'; \ ($(CHDIR) $(srcdir) && \ - exec sed -n '/^MJIT_FUNC_EXPORTED/!d;N;s/.*\n\(rb_[a-zA-Z_0-9]*\).*/$(SYMBOL_PREFIX)\1/p' cont.c gc.c thread*c vm*.c) \ + exec sed -n '/^RJIT_FUNC_EXPORTED/!d;N;s/.*\n\(rb_[a-zA-Z_0-9]*\).*/$(SYMBOL_PREFIX)\1/p' cont.c gc.c thread*c vm*.c) \ } | \ sort -u -o $@ diff --git a/configure.ac b/configure.ac index 813fa9bb3d..42bb497cdb 100644 --- a/configure.ac +++ b/configure.ac @@ -405,19 +405,19 @@ AC_SUBST(OUTFLAG) AC_SUBST(COUTFLAG) AC_SUBST(CSRCFLAG) -: ${MJIT_CC=$CC} +: ${RJIT_CC=$CC} AS_IF([test "x$cross_compiling" = xno], [ - AC_PATH_PROG([MJIT_CC], ${MJIT_CC}) + AC_PATH_PROG([RJIT_CC], ${RJIT_CC}) # if $CC is in /usr/lib/ccache/$CC, search original $CC (disable ccache) AS_IF([echo $RUBY_DEBUG | grep ci > /dev/null && - echo $MJIT_CC | grep ^/usr/lib/ccache > /dev/null], [ - PATH=`echo $PATH | sed "s/\/usr\/lib\/ccache://"` MJIT_CC=`which $CC`]) + echo $RJIT_CC | grep ^/usr/lib/ccache > /dev/null], [ + PATH=`echo $PATH | sed "s/\/usr\/lib\/ccache://"` RJIT_CC=`which $CC`]) AS_CASE([$target_os], - [*mingw*], [command -v cygpath > /dev/null && MJIT_CC=`cygpath -ma $MJIT_CC`]) + [*mingw*], [command -v cygpath > /dev/null && RJIT_CC=`cygpath -ma $RJIT_CC`]) shift 2 - MJIT_CC="$MJIT_CC${1+ }$*" + RJIT_CC="$RJIT_CC${1+ }$*" ]) AS_CASE(["$build_os"], @@ -1236,7 +1236,7 @@ main() AS_CASE(["$target_cpu"], [powerpc64*], [ ac_cv_func___builtin_setjmp=no ]) - # With gcc-8's -fcf-protection, MJIT's __builtin_longjmp fails. + # With gcc-8's -fcf-protection, RJIT's __builtin_longjmp fails. AS_CASE(["$CC $CFLAGS "], [*" -fcf-protection "*], [cf_protection=yes], [cf_protection=no]) AS_IF([test "$cf_protection" = yes], [ ac_cv_func___builtin_setjmp=no @@ -2927,14 +2927,14 @@ LIBEXT=a AC_SUBST(DLDFLAGS)dnl AC_SUBST(ARCH_FLAG)dnl -AC_SUBST(MJIT_CC)dnl +AC_SUBST(RJIT_CC)dnl AS_CASE(["$GCC:$target_os"], [yes:aix*], [mjit_std_cflag="-std=gnu99"], [mjit_std_cflag=]) -AC_SUBST(MJIT_CFLAGS, [${MJIT_CFLAGS-"-w ${mjit_std_cflag} ${orig_cflags}"}])dnl -AC_SUBST(MJIT_OPTFLAGS, [${MJIT_OPTFLAGS-'$(optflags)'}])dnl -AC_SUBST(MJIT_DEBUGFLAGS, [${MJIT_DEBUGFLAGS-'$(debugflags)'}])dnl -AC_SUBST(MJIT_LDSHARED)dnl +AC_SUBST(RJIT_CFLAGS, [${RJIT_CFLAGS-"-w ${mjit_std_cflag} ${orig_cflags}"}])dnl +AC_SUBST(RJIT_OPTFLAGS, [${RJIT_OPTFLAGS-'$(optflags)'}])dnl +AC_SUBST(RJIT_DEBUGFLAGS, [${RJIT_DEBUGFLAGS-'$(debugflags)'}])dnl +AC_SUBST(RJIT_LDSHARED)dnl AC_SUBST(STATIC)dnl AC_SUBST(CCDLFLAGS)dnl @@ -3727,13 +3727,13 @@ AC_SUBST(INSTALLDOC) AC_ARG_ENABLE(jit-support, AS_HELP_STRING([--disable-jit-support], [disable JIT features]), - [MJIT_SUPPORT=$enableval], + [RJIT_SUPPORT=$enableval], [AS_CASE(["$target_os"], - [wasi | mingw* | solaris*], [MJIT_SUPPORT=no], - [MJIT_SUPPORT=yes] + [wasi | mingw* | solaris*], [RJIT_SUPPORT=no], + [RJIT_SUPPORT=yes] )]) -AC_SUBST(MJIT_SUPPORT) +AC_SUBST(RJIT_SUPPORT) AC_CHECK_PROG(RUSTC, [rustc], [rustc], [no]) dnl no ac_tool_prefix @@ -3835,15 +3835,15 @@ AS_CASE(["${YJIT_SUPPORT}"], AC_DEFINE_UNQUOTED(YJIT_SUPPORT, [$YJIT_SUPPORT]) ]) AC_DEFINE(USE_YJIT, 1) - AC_DEFINE(USE_MJIT, 1) + AC_DEFINE(USE_RJIT, 1) ], [ AC_DEFINE(USE_YJIT, 0) - AC_DEFINE(USE_MJIT, 0) + AC_DEFINE(USE_RJIT, 0) ]) # If YJIT links capstone, libcapstone stops working on the C side. -# capstone should be linked for MJIT only when YJIT doesn't. -AS_IF([test x"$MJIT_SUPPORT" = "xyes" -a -z "$CARGO_BUILD_ARGS" ], [ +# capstone should be linked for RJIT only when YJIT doesn't. +AS_IF([test x"$RJIT_SUPPORT" = "xyes" -a -z "$CARGO_BUILD_ARGS" ], [ AC_CHECK_LIB([capstone], [cs_disasm]) ]) @@ -4054,7 +4054,7 @@ AS_IF([test "${universal_binary-no}" = yes ], [ [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no])) ]) -: ${MJIT_LDSHARED=`echo "$LDSHARED" | sed ['s|\$(LD)|'"${LD}"'|g;s|\$(CC)|$(MJIT_CC)|g']`} +: ${RJIT_LDSHARED=`echo "$LDSHARED" | sed ['s|\$(LD)|'"${LD}"'|g;s|\$(CC)|$(RJIT_CC)|g']`} MAINLIBS="$LIBS" LIBS=$ORIG_LIBS @@ -4541,7 +4541,7 @@ config_summary "debugflags" "$debugflags" config_summary "warnflags" "$warnflags" config_summary "strip command" "$STRIP" config_summary "install doc" "$DOCTARGETS" -config_summary "MJIT support" "$MJIT_SUPPORT" +config_summary "RJIT support" "$RJIT_SUPPORT" config_summary "YJIT support" "$YJIT_SUPPORT" config_summary "man page type" "$MANTYPE" config_summary "search path" "$search_path" diff --git a/defs/gmake.mk b/defs/gmake.mk index 0c404e04e4..53eec5cf5f 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -13,7 +13,7 @@ endif ifneq ($(filter darwin%,$(target_os)),) # Remove debug option not to generate thousands of .dSYM -MJIT_DEBUGFLAGS := $(filter-out -g%,$(MJIT_DEBUGFLAGS)) +RJIT_DEBUGFLAGS := $(filter-out -g%,$(RJIT_DEBUGFLAGS)) INSTRUBY_ENV += SDKROOT= endif diff --git a/doc/rjit/rjit.md b/doc/rjit/rjit.md index 6f19ab3ea7..7f038af88d 100644 --- a/doc/rjit/rjit.md +++ b/doc/rjit/rjit.md @@ -1,6 +1,6 @@ -# MJIT +# RJIT -This document has some tips that might be useful when you work on MJIT. +This document has some tips that might be useful when you work on RJIT. ## Supported platforms @@ -11,24 +11,24 @@ The following platforms are either tested on CI or assumed to work. ### Not supported -The MJIT support for the following platforms is no longer maintained. +The RJIT support for the following platforms is no longer maintained. * OS: Windows (mswin, MinGW), Solaris * Arch: SPARC, s390x -## Developing MJIT +## Developing RJIT ### Bindgen -If you see an "MJIT bindgen" GitHub Actions failure, please commit the `git diff` shown on the failed job. +If you see an "RJIT bindgen" GitHub Actions failure, please commit the `git diff` shown on the failed job. For doing the same thing locally, run `make mjit-bindgen` after installing libclang. macOS seems to have libclang by default. On Ubuntu, you can install it with `apt install libclang1`. ### Always run make install -Always run `make install` before running MJIT. It could easily cause a SEGV if you don't. -MJIT looks for the installed header for security reasons. +Always run `make install` before running RJIT. It could easily cause a SEGV if you don't. +RJIT looks for the installed header for security reasons. ### --mjit-debug vs --mjit-debug=-ggdb3 @@ -36,4 +36,4 @@ MJIT looks for the installed header for security reasons. which is useful for profiling benchmarks. `--mjit-debug` alone, on the other hand, disables `-O3` and adds debug flags. -If you're debugging MJIT, what you need to use is not `--mjit-debug=-ggdb3` but `--mjit-debug`. +If you're debugging RJIT, what you need to use is not `--mjit-debug=-ggdb3` but `--mjit-debug`. @@ -105,7 +105,7 @@ rb_call_builtin_inits(void) BUILTIN(yjit); BUILTIN(nilclass); BUILTIN(marshal); -#if USE_MJIT +#if USE_RJIT BUILTIN(mjit_c); BUILTIN(mjit); #endif diff --git a/internal/cmdlineopt.h b/internal/cmdlineopt.h index bf52f1214b..8ce6c606d7 100644 --- a/internal/cmdlineopt.h +++ b/internal/cmdlineopt.h @@ -23,7 +23,7 @@ typedef struct ruby_cmdline_options { ruby_features_t features; ruby_features_t warn; unsigned int dump; -#if USE_MJIT +#if USE_RJIT struct mjit_options mjit; #endif @@ -164,7 +164,7 @@ rb_iseq_free(const rb_iseq_t *iseq) if (iseq && ISEQ_BODY(iseq)) { iseq_clear_ic_references(iseq); struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq); - mjit_free_iseq(iseq); /* Notify MJIT */ + mjit_free_iseq(iseq); /* Notify RJIT */ #if USE_YJIT rb_yjit_iseq_free(body->yjit_payload); #endif @@ -356,7 +356,7 @@ rb_iseq_mark_and_move(rb_iseq_t *iseq, bool reference_updating) } if (reference_updating) { -#if USE_MJIT +#if USE_RJIT rb_mjit_iseq_update_references(body); #endif #if USE_YJIT @@ -364,7 +364,7 @@ rb_iseq_mark_and_move(rb_iseq_t *iseq, bool reference_updating) #endif } else { -#if USE_MJIT +#if USE_RJIT rb_mjit_iseq_mark(body->mjit_blocks); #endif #if USE_YJIT diff --git a/lib/ruby_vm/rjit/assembler.rb b/lib/ruby_vm/rjit/assembler.rb index cccd228c00..232c104af7 100644 --- a/lib/ruby_vm/rjit/assembler.rb +++ b/lib/ruby_vm/rjit/assembler.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module RubyVM::MJIT +module RubyVM::RJIT # 8-bit memory access class BytePtr < Data.define(:reg, :disp); end @@ -905,7 +905,7 @@ module RubyVM::MJIT Label.new(id: @label_id += 1, name:) end - # @param [RubyVM::MJIT::Assembler::Label] label + # @param [RubyVM::RJIT::Assembler::Label] label def write_label(label) @labels[label] = @bytes.size end diff --git a/lib/ruby_vm/rjit/block.rb b/lib/ruby_vm/rjit/block.rb index 9b0c91ad40..cfdaade8b1 100644 --- a/lib/ruby_vm/rjit/block.rb +++ b/lib/ruby_vm/rjit/block.rb @@ -1,10 +1,10 @@ -class RubyVM::MJIT::Block < Struct.new( +class RubyVM::RJIT::Block < Struct.new( :iseq, # @param `` :pc, # @param [Integer] Starting PC - :ctx, # @param [RubyVM::MJIT::Context] **Starting** Context (TODO: freeze?) + :ctx, # @param [RubyVM::RJIT::Context] **Starting** Context (TODO: freeze?) :start_addr, # @param [Integer] Starting address of this block's JIT code :entry_exit, # @param [Integer] Address of entry exit (optional) - :incoming, # @param [Array<RubyVM::MJIT::BranchStub>] Incoming branches + :incoming, # @param [Array<RubyVM::RJIT::BranchStub>] Incoming branches :invalidated, # @param [TrueClass,FalseClass] true if already invalidated ) def initialize(incoming: [], invalidated: false, **) = super diff --git a/lib/ruby_vm/rjit/branch_stub.rb b/lib/ruby_vm/rjit/branch_stub.rb index 0f015e2f72..b9fe78b744 100644 --- a/lib/ruby_vm/rjit/branch_stub.rb +++ b/lib/ruby_vm/rjit/branch_stub.rb @@ -1,14 +1,14 @@ -module RubyVM::MJIT +module RubyVM::RJIT # Branch shapes Next0 = :Next0 # target0 is a fallthrough Next1 = :Next1 # target1 is a fallthrough Default = :Default # neither targets is a fallthrough class BranchStub < Struct.new( - :iseq, # @param [RubyVM::MJIT::CPointer::Struct_rb_iseq_struct] Branch target ISEQ + :iseq, # @param [RubyVM::RJIT::CPointer::Struct_rb_iseq_struct] Branch target ISEQ :shape, # @param [Symbol] Next0, Next1, or Default - :target0, # @param [RubyVM::MJIT::BranchTarget] First branch target - :target1, # @param [RubyVM::MJIT::BranchTarget,NilClass] Second branch target (optional) + :target0, # @param [RubyVM::RJIT::BranchTarget] First branch target + :target1, # @param [RubyVM::RJIT::BranchTarget,NilClass] Second branch target (optional) :compile, # @param [Proc] A callback to (re-)generate this branch stub :start_addr, # @param [Integer] Stub source start address to be re-generated :end_addr, # @param [Integer] Stub source end address to be re-generated diff --git a/lib/ruby_vm/rjit/c_pointer.rb b/lib/ruby_vm/rjit/c_pointer.rb index 73cf267482..d65d5a93a5 100644 --- a/lib/ruby_vm/rjit/c_pointer.rb +++ b/lib/ruby_vm/rjit/c_pointer.rb @@ -1,4 +1,4 @@ -module RubyVM::MJIT +module RubyVM::RJIT # Every class under this namespace is a pointer. Even if the type is # immediate, it shouldn't be dereferenced until `*` is called. module CPointer @@ -7,7 +7,7 @@ module RubyVM::MJIT class Struct # @param name [String] # @param sizeof [Integer] - # @param members [Hash{ Symbol => [RubyVM::MJIT::CType::*, Integer, TrueClass] }] + # @param members [Hash{ Symbol => [RubyVM::RJIT::CType::*, Integer, TrueClass] }] def initialize(addr, sizeof, members) @addr = addr @sizeof = sizeof @@ -48,7 +48,7 @@ module RubyVM::MJIT end # @param size [Integer] - # @param members [Hash{ Symbol => [Integer, RubyVM::MJIT::CType::*] }] + # @param members [Hash{ Symbol => [Integer, RubyVM::RJIT::CType::*] }] def self.define(size, members) Class.new(self) do # Return the size of this type @@ -103,7 +103,7 @@ module RubyVM::MJIT class Union # @param _name [String] To be used when it starts defining a union pointer class # @param sizeof [Integer] - # @param members [Hash{ Symbol => RubyVM::MJIT::CType::* }] + # @param members [Hash{ Symbol => RubyVM::RJIT::CType::* }] def initialize(addr, sizeof, members) @addr = addr @sizeof = sizeof @@ -128,7 +128,7 @@ module RubyVM::MJIT end # @param sizeof [Integer] - # @param members [Hash{ Symbol => RubyVM::MJIT::CType::* }] + # @param members [Hash{ Symbol => RubyVM::RJIT::CType::* }] def self.define(sizeof, members) Class.new(self) do # Return the size of this type @@ -242,7 +242,7 @@ module RubyVM::MJIT attr_reader :type # @param addr [Integer] - # @param type [Class] RubyVM::MJIT::CType::* + # @param type [Class] RubyVM::RJIT::CType::* def initialize(addr, type) @addr = addr @type = type @@ -267,7 +267,7 @@ module RubyVM::MJIT # Array set # @param index [Integer] - # @param value [Integer, RubyVM::MJIT::CPointer::Struct] an address itself or an object that return an address with to_i + # @param value [Integer, RubyVM::RJIT::CPointer::Struct] an address itself or an object that return an address with to_i def []=(index, value) Fiddle::Pointer.new(@addr + index * Fiddle::SIZEOF_VOIDP)[0, Fiddle::SIZEOF_VOIDP] = [value.to_i].pack(Fiddle::PackInfo::PACK_MAP[Fiddle::TYPE_VOIDP]) @@ -292,7 +292,7 @@ module RubyVM::MJIT # Type-level []=: Used by struct fields # @param addr [Integer] - # @param value [Integer, RubyVM::MJIT::CPointer::Struct] an address itself, or an object that return an address with to_i + # @param value [Integer, RubyVM::RJIT::CPointer::Struct] an address itself, or an object that return an address with to_i define_singleton_method(:[]=) do |addr, value| value = value.to_i Fiddle::Pointer.new(addr)[0, Fiddle::SIZEOF_VOIDP] = [value].pack(Fiddle::PackInfo::PACK_MAP[Fiddle::TYPE_VOIDP]) diff --git a/lib/ruby_vm/rjit/c_type.rb b/lib/ruby_vm/rjit/c_type.rb index 9e45d8d41c..bec7e21c38 100644 --- a/lib/ruby_vm/rjit/c_type.rb +++ b/lib/ruby_vm/rjit/c_type.rb @@ -2,11 +2,11 @@ require 'fiddle' require 'fiddle/pack' require_relative 'c_pointer' -module RubyVM::MJIT +module RubyVM::RJIT module CType module Struct # @param name [String] - # @param members [Hash{ Symbol => [Integer, RubyVM::MJIT::CType::*] }] + # @param members [Hash{ Symbol => [Integer, RubyVM::RJIT::CType::*] }] def self.new(name, sizeof, **members) name = members.keys.join('_') if name.empty? CPointer.with_class_name('Struct', name) do @@ -17,7 +17,7 @@ module RubyVM::MJIT module Union # @param name [String] - # @param members [Hash{ Symbol => RubyVM::MJIT::CType::* }] + # @param members [Hash{ Symbol => RubyVM::RJIT::CType::* }] def self.new(name, sizeof, **members) name = members.keys.join('_') if name.empty? CPointer.with_class_name('Union', name) do diff --git a/lib/ruby_vm/rjit/code_block.rb b/lib/ruby_vm/rjit/code_block.rb index 21ae2386b7..d5b264f761 100644 --- a/lib/ruby_vm/rjit/code_block.rb +++ b/lib/ruby_vm/rjit/code_block.rb @@ -1,4 +1,4 @@ -module RubyVM::MJIT +module RubyVM::RJIT class CodeBlock # @param mem_block [Integer] JIT buffer address # @param mem_size [Integer] JIT buffer size @@ -11,7 +11,7 @@ module RubyVM::MJIT @outlined = outlined end - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def write(asm) return 0 if @write_pos + asm.size >= @mem_size diff --git a/lib/ruby_vm/rjit/compiler.rb b/lib/ruby_vm/rjit/compiler.rb index 85e6b5fa06..d48f9df3de 100644 --- a/lib/ruby_vm/rjit/compiler.rb +++ b/lib/ruby_vm/rjit/compiler.rb @@ -9,7 +9,7 @@ require 'ruby_vm/mjit/instruction' require 'ruby_vm/mjit/invariants' require 'ruby_vm/mjit/jit_state' -module RubyVM::MJIT +module RubyVM::RJIT # Compilation status KeepCompiling = :KeepCompiling CantCompile = :CantCompile @@ -55,8 +55,8 @@ module RubyVM::MJIT end # Compile an ISEQ from its entry point. - # @param iseq `RubyVM::MJIT::CPointer::Struct_rb_iseq_t` - # @param cfp `RubyVM::MJIT::CPointer::Struct_rb_control_frame_t` + # @param iseq `RubyVM::RJIT::CPointer::Struct_rb_iseq_t` + # @param cfp `RubyVM::RJIT::CPointer::Struct_rb_control_frame_t` def compile(iseq, cfp) # TODO: Support has_opt return if iseq.body.param.flags.has_opt @@ -73,8 +73,8 @@ module RubyVM::MJIT end # Compile a branch stub. - # @param branch_stub [RubyVM::MJIT::BranchStub] - # @param cfp `RubyVM::MJIT::CPointer::Struct_rb_control_frame_t` + # @param branch_stub [RubyVM::RJIT::BranchStub] + # @param cfp `RubyVM::RJIT::CPointer::Struct_rb_control_frame_t` # @param target0_p [TrueClass,FalseClass] # @return [Integer] The starting address of the compiled branch stub def branch_stub_hit(branch_stub, cfp, target0_p) @@ -127,14 +127,14 @@ module RubyVM::MJIT exit 1 end - # @param iseq `RubyVM::MJIT::CPointer::Struct_rb_iseq_t` + # @param iseq `RubyVM::RJIT::CPointer::Struct_rb_iseq_t` # @param pc [Integer] def invalidate_blocks(iseq, pc) list_blocks(iseq, pc).each do |block| invalidate_block(block) end - # If they were the ISEQ's first blocks, re-compile MJIT entry as well + # If they were the ISEQ's first blocks, re-compile RJIT entry as well if iseq.body.iseq_encoded.to_i == pc iseq.body.jit_func = 0 iseq.body.total_calls = 0 @@ -191,9 +191,9 @@ module RubyVM::MJIT # Callee-saved: rbx, rsp, rbp, r12, r13, r14, r15 # Caller-saved: rax, rdi, rsi, rdx, rcx, r8, r9, r10, r11 # - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def compile_prologue(asm) - asm.comment('MJIT entry point') + asm.comment('RJIT entry point') # Save callee-saved registers used by JITed code asm.push(CFP) @@ -212,7 +212,7 @@ module RubyVM::MJIT asm.mov([CFP, C.rb_control_frame_t.offsetof(:jit_return)], :rax) end - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def compile_block(asm, jit:, pc: jit.iseq.body.iseq_encoded.to_i, ctx: Context.new) # Mark the block start address and prepare an exit code storage block = Block.new(iseq: jit.iseq, pc:, ctx: ctx.dup) @@ -276,18 +276,18 @@ module RubyVM::MJIT end # @param [Integer] pc - # @param [RubyVM::MJIT::Context] ctx - # @return [RubyVM::MJIT::Block,NilClass] + # @param [RubyVM::RJIT::Context] ctx + # @return [RubyVM::RJIT::Block,NilClass] def find_block(iseq, pc, ctx) mjit_blocks(iseq)[pc][ctx] end - # @param [RubyVM::MJIT::Block] block + # @param [RubyVM::RJIT::Block] block def set_block(iseq, block) mjit_blocks(iseq)[block.pc][block.ctx] = block end - # @param [RubyVM::MJIT::Block] block + # @param [RubyVM::RJIT::Block] block def remove_block(iseq, block) mjit_blocks(iseq)[block.pc].delete(block.ctx) end diff --git a/lib/ruby_vm/rjit/context.rb b/lib/ruby_vm/rjit/context.rb index e834b42999..746f29b8fb 100644 --- a/lib/ruby_vm/rjit/context.rb +++ b/lib/ruby_vm/rjit/context.rb @@ -1,4 +1,4 @@ -module RubyVM::MJIT +module RubyVM::RJIT class Context < Struct.new( :stack_size, # @param [Integer] The number of values on the stack :sp_offset, # @param [Integer] JIT sp offset relative to the interpreter's sp diff --git a/lib/ruby_vm/rjit/exit_compiler.rb b/lib/ruby_vm/rjit/exit_compiler.rb index 1d704a8dca..4aeb8c3c2f 100644 --- a/lib/ruby_vm/rjit/exit_compiler.rb +++ b/lib/ruby_vm/rjit/exit_compiler.rb @@ -1,8 +1,8 @@ -module RubyVM::MJIT +module RubyVM::RJIT class ExitCompiler # Used for invalidating a block on entry. # @param pc [Integer] - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def compile_entry_exit(pc, ctx, asm, cause:) # Increment per-insn exit counter incr_insn_exit(pc, asm) @@ -21,7 +21,7 @@ module RubyVM::MJIT end # Set to cfp->jit_return by default for leave insn - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def compile_leave_exit(asm) asm.comment('default cfp->jit_return') @@ -35,7 +35,7 @@ module RubyVM::MJIT end # Fire cfunc events on invalidation by TracePoint - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def compile_full_cfunc_return(asm) # This chunk of code expects REG_EC to be filled properly and # RAX to contain the return value of the C method. @@ -56,9 +56,9 @@ module RubyVM::MJIT asm.ret end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def compile_side_exit(pc, ctx, asm) # Increment per-insn exit counter incr_insn_exit(pc, asm) @@ -76,9 +76,9 @@ module RubyVM::MJIT asm.ret end - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] - # @param branch_stub [RubyVM::MJIT::BranchStub] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] + # @param branch_stub [RubyVM::RJIT::BranchStub] # @param target0_p [TrueClass,FalseClass] def compile_branch_stub(ctx, asm, branch_stub, target0_p) # Call rb_mjit_branch_stub_hit @@ -102,7 +102,7 @@ module RubyVM::MJIT end # @param pc [Integer] - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def incr_insn_exit(pc, asm) if C.mjit_opts.stats insn = Compiler.decode_insn(C.VALUE.new(pc).*) @@ -112,9 +112,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def save_pc_and_sp(pc, ctx, asm, reset_sp_offset: true) # Update pc (TODO: manage PC offset?) asm.comment("save PC#{' and SP' if ctx.sp_offset != 0} to CFP") diff --git a/lib/ruby_vm/rjit/hooks.rb b/lib/ruby_vm/rjit/hooks.rb index 57d4ebc381..d7e4e5f5bc 100644 --- a/lib/ruby_vm/rjit/hooks.rb +++ b/lib/ruby_vm/rjit/hooks.rb @@ -1,4 +1,4 @@ -module RubyVM::MJIT +module RubyVM::RJIT module Hooks # :nodoc: all def self.on_bop_redefined(_redefined_flag, _bop) # C.mjit_cancel_all("BOP is redefined") diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb index 07670daed1..7af6f9b0c3 100644 --- a/lib/ruby_vm/rjit/insn_compiler.rb +++ b/lib/ruby_vm/rjit/insn_compiler.rb @@ -1,7 +1,7 @@ -module RubyVM::MJIT +module RubyVM::RJIT class InsnCompiler # @param ocb [CodeBlock] - # @param exit_compiler [RubyVM::MJIT::ExitCompiler] + # @param exit_compiler [RubyVM::RJIT::ExitCompiler] def initialize(cb, ocb, exit_compiler) @ocb = ocb @exit_compiler = exit_compiler @@ -16,10 +16,10 @@ module RubyVM::MJIT # freeze # workaround a binding.irb issue. TODO: resurrect this end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] - # @param insn `RubyVM::MJIT::Instruction` + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] + # @param insn `RubyVM::RJIT::Instruction` def compile(jit, ctx, asm, insn) asm.incr_counter(:mjit_insns_count) asm.comment("Insn: #{insn.name}") @@ -137,35 +137,35 @@ module RubyVM::MJIT # Insns # - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def nop(jit, ctx, asm) # Do nothing KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getlocal(jit, ctx, asm) idx = jit.operand(0) level = jit.operand(1) jit_getlocal_generic(jit, ctx, asm, idx:, level:) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def setlocal(jit, ctx, asm) idx = jit.operand(0) level = jit.operand(1) jit_setlocal_generic(jit, ctx, asm, idx:, level:) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getblockparam(jit, ctx, asm) # EP level level = jit.operand(1) @@ -236,9 +236,9 @@ module RubyVM::MJIT # setblockparam - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getblockparamproxy(jit, ctx, asm) # To get block_handler unless jit.at_current_insn? @@ -309,9 +309,9 @@ module RubyVM::MJIT # getspecial # setspecial - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getinstancevariable(jit, ctx, asm) # Specialize on a compile-time receiver, and split a block for chain guards unless jit.at_current_insn? @@ -325,9 +325,9 @@ module RubyVM::MJIT jit_getivar(jit, ctx, asm, comptime_obj, id) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def setinstancevariable(jit, ctx, asm) starting_context = ctx.dup # make a copy for use with jit_chain_guard @@ -477,9 +477,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getclassvariable(jit, ctx, asm) # rb_vm_getclassvariable can raise exceptions. jit_prepare_routine_call(jit, ctx, asm) @@ -498,9 +498,9 @@ module RubyVM::MJIT # setclassvariable - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_getconstant_path(jit, ctx, asm) # Cut the block for invalidation unless jit.at_current_insn? @@ -564,9 +564,9 @@ module RubyVM::MJIT EndBlock end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getconstant(jit, ctx, asm) id = jit.operand(0) @@ -592,16 +592,16 @@ module RubyVM::MJIT # getglobal # setglobal - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putnil(jit, ctx, asm) putobject(jit, ctx, asm, val: Qnil) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putself(jit, ctx, asm) stack_top = ctx.stack_push asm.mov(:rax, [CFP, C.rb_control_frame_t.offsetof(:self)]) @@ -609,9 +609,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putobject(jit, ctx, asm, val: jit.operand(0)) # Push it to the stack stack_top = ctx.stack_push @@ -628,9 +628,9 @@ module RubyVM::MJIT # putspecialobject - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putstring(jit, ctx, asm) put_val = jit.operand(0, ruby: true) @@ -647,9 +647,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def concatstrings(jit, ctx, asm) n = jit.operand(0) @@ -670,9 +670,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def anytostring(jit, ctx, asm) # Save the PC and SP since we might call #to_s jit_prepare_routine_call(jit, ctx, asm) @@ -694,9 +694,9 @@ module RubyVM::MJIT # toregexp # intern - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def newarray(jit, ctx, asm) n = jit.operand(0) @@ -729,9 +729,9 @@ module RubyVM::MJIT # newarraykwsplat - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def duparray(jit, ctx, asm) ary = jit.operand(0) @@ -751,9 +751,9 @@ module RubyVM::MJIT # duphash - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def expandarray(jit, ctx, asm) # Both arguments are rb_num_t which is unsigned num = jit.operand(0) @@ -819,9 +819,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def concatarray(jit, ctx, asm) # Save the PC and SP because the callee may allocate # Note that this modifies REG_SP, which is why we do it first @@ -842,9 +842,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def splatarray(jit, ctx, asm) flag = jit.operand(0) @@ -866,9 +866,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def newhash(jit, ctx, asm) num = jit.operand(0) @@ -911,17 +911,17 @@ module RubyVM::MJIT # newrange - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def pop(jit, ctx, asm) ctx.stack_pop KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def dup(jit, ctx, asm) val1 = ctx.stack_opnd(0) val2 = ctx.stack_push @@ -930,9 +930,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def dupn(jit, ctx, asm) n = jit.operand(0) @@ -955,9 +955,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def swap(jit, ctx, asm) stack0_mem = ctx.stack_opnd(0) stack1_mem = ctx.stack_opnd(1) @@ -972,9 +972,9 @@ module RubyVM::MJIT # opt_reverse - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def topn(jit, ctx, asm) n = jit.operand(0) @@ -986,9 +986,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def setn(jit, ctx, asm) n = jit.operand(0) @@ -1000,18 +1000,18 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def adjuststack(jit, ctx, asm) n = jit.operand(0) ctx.stack_pop(n) KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def defined(jit, ctx, asm) op_type = jit.operand(0) obj = jit.operand(1, ruby: true) @@ -1051,9 +1051,9 @@ module RubyVM::MJIT # definemethod # definesmethod - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def send(jit, ctx, asm) # Specialize on a compile-time receiver, and split a block for chain guards unless jit.at_current_insn? @@ -1082,9 +1082,9 @@ module RubyVM::MJIT jit_call_general(jit, ctx, asm, mid, argc, flags, cme, block_handler, comptime_recv_klass) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_send_without_block(jit, ctx, asm, cd: C.rb_call_data.new(jit.operand(0))) # Specialize on a compile-time receiver, and split a block for chain guards unless jit.at_current_insn? @@ -1105,9 +1105,9 @@ module RubyVM::MJIT jit_call_general(jit, ctx, asm, mid, argc, flags, cme, C.VM_BLOCK_HANDLER_NONE, comptime_recv_klass) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def objtostring(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1129,9 +1129,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_str_freeze(jit, ctx, asm) unless Invariants.assume_bop_not_redefined(jit, C.STRING_REDEFINED_OP_FLAG, C.BOP_FREEZE) return CantCompile; @@ -1147,9 +1147,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_nil_p(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end @@ -1157,9 +1157,9 @@ module RubyVM::MJIT # opt_str_uminus # opt_newarray_max - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_newarray_min(jit, ctx, asm) num = jit.operand(0) @@ -1182,9 +1182,9 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def invokesuper(jit, ctx, asm) # Specialize on a compile-time receiver, and split a block for chain guards unless jit.at_current_insn? @@ -1215,9 +1215,9 @@ module RubyVM::MJIT # invokeblock - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def leave(jit, ctx, asm) assert_equal(ctx.stack_size, 1) @@ -1244,9 +1244,9 @@ module RubyVM::MJIT # throw - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jump(jit, ctx, asm) # Check for interrupts, but only on backward branches that may create loops jump_offset = jit.operand(0, signed: true) @@ -1259,9 +1259,9 @@ module RubyVM::MJIT EndBlock end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def branchif(jit, ctx, asm) # Check for interrupts, but only on backward branches that may create loops jump_offset = jit.operand(0, signed: true) @@ -1311,9 +1311,9 @@ module RubyVM::MJIT EndBlock end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def branchunless(jit, ctx, asm) # Check for interrupts, but only on backward branches that may create loops jump_offset = jit.operand(0, signed: true) @@ -1363,9 +1363,9 @@ module RubyVM::MJIT EndBlock end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def branchnil(jit, ctx, asm) # Check for interrupts, but only on backward branches that may create loops jump_offset = jit.operand(0, signed: true) @@ -1416,18 +1416,18 @@ module RubyVM::MJIT # once - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_case_dispatch(jit, ctx, asm) # Just go to === branches for now ctx.stack_pop KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_plus(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1471,9 +1471,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_minus(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1517,23 +1517,23 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_mult(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_div(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_mod(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1575,9 +1575,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_eq(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1592,9 +1592,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_neq(jit, ctx, asm) # opt_neq is passed two rb_call_data as arguments: # first for ==, second for != @@ -1602,44 +1602,44 @@ module RubyVM::MJIT opt_send_without_block(jit, ctx, asm, cd: neq_cd) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_lt(jit, ctx, asm) jit_fixnum_cmp(jit, ctx, asm, opcode: :cmovl, bop: C.BOP_LT) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_le(jit, ctx, asm) jit_fixnum_cmp(jit, ctx, asm, opcode: :cmovle, bop: C.BOP_LE) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_gt(jit, ctx, asm) jit_fixnum_cmp(jit, ctx, asm, opcode: :cmovg, bop: C.BOP_GT) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_ge(jit, ctx, asm) jit_fixnum_cmp(jit, ctx, asm, opcode: :cmovge, bop: C.BOP_GE) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_ltlt(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_and(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1676,9 +1676,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_or(jit, ctx, asm) unless jit.at_current_insn? defer_compilation(jit, ctx, asm) @@ -1716,9 +1716,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_aref(jit, ctx, asm) cd = C.rb_call_data.new(jit.operand(0)) argc = C.vm_ci_argc(cd.ci) @@ -1806,9 +1806,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_aset(jit, ctx, asm) # Defer compilation so we can specialize on a runtime `self` unless jit.at_current_insn? @@ -1892,44 +1892,44 @@ module RubyVM::MJIT # opt_aset_with # opt_aref_with - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_length(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_size(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_empty_p(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_succ(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_not(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_regexpmatch2(jit, ctx, asm) opt_send_without_block(jit, ctx, asm) end @@ -1974,17 +1974,17 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def opt_invokebuiltin_delegate_leave(jit, ctx, asm) opt_invokebuiltin_delegate(jit, ctx, asm) # opt_invokebuiltin_delegate is always followed by leave insn end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getlocal_WC_0(jit, ctx, asm) # Get operands idx = jit.operand(0) @@ -2001,17 +2001,17 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def getlocal_WC_1(jit, ctx, asm) idx = jit.operand(0) jit_getlocal_generic(jit, ctx, asm, idx:, level: 1) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def setlocal_WC_0(jit, ctx, asm) slot_idx = jit.operand(0) @@ -2043,24 +2043,24 @@ module RubyVM::MJIT KeepCompiling end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def setlocal_WC_1(jit, ctx, asm) idx = jit.operand(0) jit_setlocal_generic(jit, ctx, asm, idx:, level: 1) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putobject_INT2FIX_0_(jit, ctx, asm) putobject(jit, ctx, asm, val: C.to_value(0)) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def putobject_INT2FIX_1_(jit, ctx, asm) putobject(jit, ctx, asm, val: C.to_value(1)) end @@ -2069,9 +2069,9 @@ module RubyVM::MJIT # C func # - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_true(jit, ctx, asm, argc, _known_recv_class) return false if argc != 0 asm.comment('nil? == true'); @@ -2081,9 +2081,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_false(jit, ctx, asm, argc, _known_recv_class) return false if argc != 0 asm.comment('nil? == false'); @@ -2093,9 +2093,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_obj_not(jit, ctx, asm, argc, _known_recv_class) return false if argc != 0 asm.comment('rb_obj_not') @@ -2112,9 +2112,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_obj_equal(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 asm.comment('equal?') @@ -2133,17 +2133,17 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_obj_not_equal(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 jit_equality_specialized(jit, ctx, asm, false) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_mod_eqq(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 @@ -2168,9 +2168,9 @@ module RubyVM::MJIT return true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_int_equal(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 return false unless two_fixnums_on_stack?(jit) @@ -2193,9 +2193,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_int_mul(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 return false unless two_fixnums_on_stack?(jit) @@ -2238,9 +2238,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_int_aref(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 return false unless two_fixnums_on_stack?(jit) @@ -2261,9 +2261,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_str_to_s(jit, ctx, asm, argc, known_recv_class) return false if argc != 0 if known_recv_class == String @@ -2275,9 +2275,9 @@ module RubyVM::MJIT false end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_str_getbyte(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 asm.comment('rb_str_getbyte') @@ -2293,9 +2293,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_rb_ary_push(jit, ctx, asm, argc, _known_recv_class) return false if argc != 1 asm.comment('rb_ary_push') @@ -2313,9 +2313,9 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_thread_s_current(jit, ctx, asm, argc, _known_recv_class) return false if argc != 0 asm.comment('Thread.current') @@ -2462,7 +2462,7 @@ module RubyVM::MJIT local_table_size - op - 1 end - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def guard_object_is_heap(asm, object_opnd, side_exit) asm.comment('guard object is heap') # Test that the object is not an immediate @@ -2474,7 +2474,7 @@ module RubyVM::MJIT asm.je(side_exit) end - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def guard_object_is_array(asm, object_reg, flags_reg, side_exit) asm.comment('guard object is array') # Pull out the type mask @@ -2486,9 +2486,9 @@ module RubyVM::MJIT asm.jne(side_exit) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_chain_guard(opcode, jit, ctx, asm, side_exit, limit: 20) opcode => :je | :jne | :jnz | :jz @@ -2520,9 +2520,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_guard_known_klass(jit, ctx, asm, known_klass, obj_opnd, comptime_obj, side_exit, limit: 10) # Only memory operand is supported for now assert_equal(true, obj_opnd.is_a?(Array)) @@ -2584,16 +2584,16 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] + # @param jit [RubyVM::RJIT::JITState] def two_fixnums_on_stack?(jit) comptime_recv = jit.peek_at_stack(1) comptime_arg = jit.peek_at_stack(0) return fixnum?(comptime_recv) && fixnum?(comptime_arg) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def guard_two_fixnums(jit, ctx, asm, side_exit) # Get stack operands without popping them arg1 = ctx.stack_opnd(0) @@ -2610,9 +2610,9 @@ module RubyVM::MJIT # TODO: upgrade type, and skip the check when possible end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_fixnum_cmp(jit, ctx, asm, opcode:, bop:) opcode => :cmovl | :cmovle | :cmovg | :cmovge @@ -2658,9 +2658,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_equality_specialized(jit, ctx, asm, gen_eq) # Create a side-exit to fall back to the interpreter side_exit = side_exit(jit, ctx) @@ -2738,9 +2738,9 @@ module RubyVM::MJIT end # NOTE: This clobbers :rax - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_prepare_routine_call(jit, ctx, asm) jit.record_boundary_patch_point = true jit_save_pc(jit, asm) @@ -2748,8 +2748,8 @@ module RubyVM::MJIT end # Note: This clobbers :rax - # @param jit [RubyVM::MJIT::JITState] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param asm [RubyVM::RJIT::Assembler] def jit_save_pc(jit, asm, comment: 'save PC to CFP') next_pc = jit.pc + jit.insn.len * C.VALUE.size # Use the next one for backtrace and side exits asm.comment(comment) @@ -2757,9 +2757,9 @@ module RubyVM::MJIT asm.mov([CFP, C.rb_control_frame_t.offsetof(:pc)], :rax) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_save_sp(jit, ctx, asm) if ctx.sp_offset != 0 asm.comment('save SP to CFP') @@ -2769,9 +2769,9 @@ module RubyVM::MJIT end end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jump_to_next_insn(jit, ctx, asm) reset_depth = ctx.dup reset_depth.chain_depth = 0 @@ -2792,9 +2792,9 @@ module RubyVM::MJIT end # rb_vm_check_ints - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_check_ints(jit, ctx, asm) asm.comment('RUBY_VM_CHECK_INTS(ec)') asm.mov(:eax, [EC, C.rb_execution_context_t.offsetof(:interrupt_flag)]) @@ -2813,15 +2813,15 @@ module RubyVM::MJIT end # GET_LEP - # @param jit [RubyVM::MJIT::JITState] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param asm [RubyVM::RJIT::Assembler] def jit_get_lep(jit, asm, reg:) level = get_lvar_level(jit.iseq) jit_get_ep(asm, level, reg:) end # vm_get_ep - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def jit_get_ep(asm, level, reg:) asm.mov(reg, [CFP, C.rb_control_frame_t.offsetof(:ep)]) level.times do @@ -2832,9 +2832,9 @@ module RubyVM::MJIT end # vm_getivar - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_getivar(jit, ctx, asm, comptime_obj, ivar_id, obj_opnd = nil) side_exit = side_exit(jit, ctx) starting_ctx = ctx.dup # copy for jit_chain_guard @@ -2940,9 +2940,9 @@ module RubyVM::MJIT end # vm_caller_setup_arg_block - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_caller_setup_arg_block(jit, ctx, asm, ci, blockiseq, is_super) side_exit = side_exit(jit, ctx) if C.vm_ci_flag(ci) & C.VM_CALL_ARGS_BLOCKARG != 0 @@ -2982,9 +2982,9 @@ module RubyVM::MJIT end # vm_search_method - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_search_method(jit, ctx, asm, mid, argc, flags, send_shift: 0) assert_equal(true, jit.at_current_insn?) @@ -3109,17 +3109,17 @@ module RubyVM::MJIT end # vm_call_general - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_general(jit, ctx, asm, mid, argc, flags, cme, block_handler, known_recv_class) jit_call_method(jit, ctx, asm, mid, argc, flags, cme, block_handler, known_recv_class) end # vm_call_method - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] # @param send_shift [Integer] The number of shifts needed for VM_CALL_OPT_SEND def jit_call_method(jit, ctx, asm, mid, argc, flags, cme, block_handler, known_recv_class, send_shift: 0) # The main check of vm_call_method before vm_call_method_each_type @@ -3168,9 +3168,9 @@ module RubyVM::MJIT end # vm_call_method_each_type - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_method_each_type(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:) case cme.def.type when C.VM_METHOD_TYPE_ISEQ @@ -3211,9 +3211,9 @@ module RubyVM::MJIT end # vm_call_iseq_setup - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_iseq_setup(jit, ctx, asm, cme, flags, argc, iseq, block_handler, send_shift:, frame_type: nil, prev_ep: nil) opt_pc = jit_callee_setup_arg(jit, ctx, asm, flags, argc, iseq) if opt_pc == CantCompile @@ -3229,9 +3229,9 @@ module RubyVM::MJIT end # vm_call_iseq_setup_normal (vm_call_iseq_setup_2 -> vm_call_iseq_setup_normal) - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_iseq_setup_normal(jit, ctx, asm, cme, flags, argc, iseq, block_handler, opt_pc, send_shift:, frame_type:, prev_ep:) # We will not have side exits from here. Adjust the stack. if flags & C.VM_CALL_OPT_SEND != 0 @@ -3264,9 +3264,9 @@ module RubyVM::MJIT end # vm_call_cfunc - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_cfunc(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) if jit_caller_setup_arg(jit, ctx, asm, flags) == CantCompile return CantCompile @@ -3279,9 +3279,9 @@ module RubyVM::MJIT end # jit_call_cfunc_with_frame - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_cfunc_with_frame(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) cfunc = cme.def.body.cfunc @@ -3373,9 +3373,9 @@ module RubyVM::MJIT end # vm_call_ivar (+ part of vm_call_method_each_type) - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_ivar(jit, ctx, asm, cme, flags, argc, comptime_recv, recv_opnd, send_shift:) if flags & C.VM_CALL_ARGS_SPLAT != 0 asm.incr_counter(:send_ivar_splat) @@ -3405,9 +3405,9 @@ module RubyVM::MJIT end # vm_call_bmethod - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_bmethod(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:) proc_addr = cme.def.body.bmethod.proc @@ -3442,18 +3442,18 @@ module RubyVM::MJIT end # vm_call_alias - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_alias(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:) cme = C.rb_aliased_callable_method_entry(cme) jit_call_method_each_type(jit, ctx, asm, argc, flags, cme, comptime_recv, recv_opnd, block_handler, known_recv_class, send_shift:) end # vm_call_optimized - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_optimized(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) if flags & C.VM_CALL_ARGS_BLOCKARG != 0 # Not working yet @@ -3481,9 +3481,9 @@ module RubyVM::MJIT end # vm_call_opt_send - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_opt_send(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) if jit_caller_setup_arg(jit, ctx, asm, flags) == CantCompile return CantCompile @@ -3509,9 +3509,9 @@ module RubyVM::MJIT end # vm_call_opt_call - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_opt_call(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) if block_handler != C.VM_BLOCK_HANDLER_NONE asm.incr_counter(:send_optimized_call_block) @@ -3567,9 +3567,9 @@ module RubyVM::MJIT end # vm_call_opt_struct_aref - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_opt_struct_aref(jit, ctx, asm, cme, flags, argc, block_handler, known_recv_class, send_shift:) if argc != 0 asm.incr_counter(:send_optimized_struct_aref_error) @@ -3610,8 +3610,8 @@ module RubyVM::MJIT EndBlock end - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_opt_send_shift_stack(ctx, asm, argc, send_shift:) # We don't support `send(:send, ...)` for now. assert_equal(1, send_shift) @@ -3628,9 +3628,9 @@ module RubyVM::MJIT end # vm_call_symbol - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_call_symbol(jit, ctx, asm, cme, flags, argc, kw_splat, block_handler, known_recv_class, send_shift:) flags |= C.VM_CALL_OPT_SEND | (kw_splat ? C.VM_CALL_KW_SPLAT : 0) @@ -3673,9 +3673,9 @@ module RubyVM::MJIT # Frame structure: # | args | locals | cme/cref | block_handler/prev EP | frame type (EP here) | stack bottom (SP here) # - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_push_frame(jit, ctx, asm, cme, flags, argc, frame_type, block_handler, iseq: nil, local_size: 0, stack_max: 0, prev_ep: nil) # CHECK_VM_STACK_OVERFLOW0: next_cfp <= sp + (local_size + stack_max) asm.comment('stack overflow check') @@ -3788,9 +3788,9 @@ module RubyVM::MJIT end # vm_callee_setup_arg: Set up args and return opt_pc (or CantCompile) - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_callee_setup_arg(jit, ctx, asm, flags, argc, iseq) if flags & C.VM_CALL_KW_SPLAT == 0 if C.rb_simple_iseq_p(iseq) @@ -3839,9 +3839,9 @@ module RubyVM::MJIT end # CALLER_SETUP_ARG: Return CantCompile if not supported - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_caller_setup_arg(jit, ctx, asm, flags) if flags & C.VM_CALL_ARGS_SPLAT != 0 # We don't support vm_caller_setup_arg_splat @@ -3856,9 +3856,9 @@ module RubyVM::MJIT end # CALLER_REMOVE_EMPTY_KW_SPLAT: Return CantCompile if not supported - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def jit_caller_remove_empty_kw_splat(jit, ctx, asm, flags) if (flags & C.VM_CALL_KW_SPLAT) > 0 # We don't support removing the last Hash argument @@ -3908,9 +3908,9 @@ module RubyVM::MJIT C.rb_shape_get_shape_id(obj) == C.OBJ_TOO_COMPLEX_SHAPE_ID end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] - # @param asm [RubyVM::MJIT::Assembler] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] + # @param asm [RubyVM::RJIT::Assembler] def defer_compilation(jit, ctx, asm) # Make a stub to compile the current insn stub_next_block(jit.iseq, jit.pc, ctx, asm, comment: 'defer_compilation') @@ -3940,8 +3940,8 @@ module RubyVM::MJIT branch_stub.compile.call(asm) end - # @param jit [RubyVM::MJIT::JITState] - # @param ctx [RubyVM::MJIT::Context] + # @param jit [RubyVM::RJIT::JITState] + # @param ctx [RubyVM::RJIT::Context] def side_exit(jit, ctx) if side_exit = jit.side_exits[jit.pc] return side_exit diff --git a/lib/ruby_vm/rjit/invariants.rb b/lib/ruby_vm/rjit/invariants.rb index 127e446ed9..0ee2cd8e24 100644 --- a/lib/ruby_vm/rjit/invariants.rb +++ b/lib/ruby_vm/rjit/invariants.rb @@ -1,13 +1,13 @@ require 'set' -module RubyVM::MJIT +module RubyVM::RJIT class Invariants class << self - # Called by RubyVM::MJIT::Compiler to lazily initialize this + # Called by RubyVM::RJIT::Compiler to lazily initialize this # @param cb [CodeBlock] # @param ocb [CodeBlock] - # @param compiler [RubyVM::MJIT::Compiler] - # @param exit_compiler [RubyVM::MJIT::ExitCompiler] + # @param compiler [RubyVM::RJIT::Compiler] + # @param exit_compiler [RubyVM::RJIT::ExitCompiler] def initialize(cb, ocb, compiler, exit_compiler) @cb = cb @ocb = ocb @@ -21,7 +21,7 @@ module RubyVM::MJIT # freeze # workaround a binding.irb issue. TODO: resurrect this end - # @param jit [RubyVM::MJIT::JITState] + # @param jit [RubyVM::RJIT::JITState] # @param klass [Integer] # @param op [Integer] def assume_bop_not_redefined(jit, klass, op) @@ -32,7 +32,7 @@ module RubyVM::MJIT true end - # @param jit [RubyVM::MJIT::JITState] + # @param jit [RubyVM::RJIT::JITState] def assume_method_lookup_stable(jit, cme) ensure_block_entry_exit(jit, cause: 'assume_method_lookup_stable') @cme_blocks[cme.to_i] << jit.block @@ -45,7 +45,7 @@ module RubyVM::MJIT end end - # @param asm [RubyVM::MJIT::Assembler] + # @param asm [RubyVM::RJIT::Assembler] def record_global_inval_patch(asm, target) asm.pos_marker do |address| if @patches.key?(address) @@ -103,8 +103,8 @@ module RubyVM::MJIT invalidate_all end - # @param jit [RubyVM::MJIT::JITState] - # @param block [RubyVM::MJIT::Block] + # @param jit [RubyVM::RJIT::JITState] + # @param block [RubyVM::RJIT::Block] def ensure_block_entry_exit(jit, cause:) block = jit.block if block.entry_exit.nil? diff --git a/lib/ruby_vm/rjit/jit_state.rb b/lib/ruby_vm/rjit/jit_state.rb index decafee579..214993bbe4 100644 --- a/lib/ruby_vm/rjit/jit_state.rb +++ b/lib/ruby_vm/rjit/jit_state.rb @@ -1,9 +1,9 @@ -module RubyVM::MJIT +module RubyVM::RJIT class JITState < Struct.new( - :iseq, # @param `RubyVM::MJIT::CPointer::Struct_rb_iseq_t` + :iseq, # @param `RubyVM::RJIT::CPointer::Struct_rb_iseq_t` :pc, # @param [Integer] The JIT target PC - :cfp, # @param `RubyVM::MJIT::CPointer::Struct_rb_control_frame_t` The JIT source CFP (before MJIT is called) - :block, # @param [RubyVM::MJIT::Block] + :cfp, # @param `RubyVM::RJIT::CPointer::Struct_rb_control_frame_t` The JIT source CFP (before RJIT is called) + :block, # @param [RubyVM::RJIT::Block] :side_exits, # @param [Hash{ Integer => Integer }] { PC => address } :record_boundary_patch_point, # @param [TrueClass,FalseClass] ) diff --git a/lib/ruby_vm/rjit/stats.rb b/lib/ruby_vm/rjit/stats.rb index b605f3c1ad..e80c0dae7d 100644 --- a/lib/ruby_vm/rjit/stats.rb +++ b/lib/ruby_vm/rjit/stats.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module RubyVM::MJIT +module RubyVM::RJIT def self.runtime_stats stats = {} @@ -32,7 +32,7 @@ module RubyVM::MJIT def print_stats stats = runtime_stats - $stderr.puts("***MJIT: Printing MJIT statistics on exit***") + $stderr.puts("***RJIT: Printing RJIT statistics on exit***") print_counters(stats, prefix: 'send_', prompt: 'method call exit reasons') print_counters(stats, prefix: 'invokesuper_', prompt: 'invokesuper exit reasons') @@ -1079,7 +1079,7 @@ void rb_sigwait_sleep(const rb_thread_t *, int fd, const rb_hrtime_t *); void rb_sigwait_fd_put(const rb_thread_t *, int fd); void rb_thread_sleep_interruptible(void); -#if USE_MJIT +#if USE_RJIT static struct waitpid_state mjit_waitpid_state; // variables shared with thread.c @@ -1095,7 +1095,7 @@ waitpid_signal(struct waitpid_state *w) rb_threadptr_interrupt(rb_ec_thread_ptr(w->ec)); return TRUE; } -#if USE_MJIT +#if USE_RJIT else if (w == &mjit_waitpid_state && w->ret) { /* mjit_add_waiting_pid */ mjit_waitpid_finished = true; mjit_waitpid_status = w->status; @@ -1197,7 +1197,7 @@ waitpid_state_init(struct waitpid_state *w, rb_pid_t pid, int options) w->status = 0; } -#if USE_MJIT +#if USE_RJIT /* * must be called with vm->waitpid_lock held, this is not interruptible */ @@ -4187,8 +4187,8 @@ retry_fork_async_signal_safe(struct rb_process_status *status, int *ep, } } -#if USE_MJIT -// This is used to create MJIT's child Ruby process +#if USE_RJIT +// This is used to create RJIT's child Ruby process pid_t rb_mjit_fork(void) { @@ -4267,7 +4267,7 @@ fork_check_err(struct rb_process_status *status, int (*chfunc)(void*, char *, si * The "async_signal_safe" name is a lie, but it is used by pty.c and * maybe other exts. fork() is not async-signal-safe due to pthread_atfork * and future POSIX revisions will remove it from a list of signal-safe - * functions. rb_waitpid is not async-signal-safe since MJIT, either. + * functions. rb_waitpid is not async-signal-safe since RJIT, either. * For our purposes, we do not need async-signal-safety, here */ rb_pid_t @@ -4297,7 +4297,7 @@ rb_fork_ruby2(struct rb_process_status *status) while (1) { prefork(); - if (mjit_enabled) mjit_pause(false); // Don't leave locked mutex to child. Note: child_handler must be enabled to pause MJIT. + if (mjit_enabled) mjit_pause(false); // Don't leave locked mutex to child. Note: child_handler must be enabled to pause RJIT. disable_child_handler_before_fork(&old); before_fork_ruby(); pid = rb_fork(); @@ -4719,7 +4719,7 @@ rb_execarg_spawn(VALUE execarg_obj, char *errmsg, size_t errmsg_buflen) struct rb_execarg *eargp = rb_execarg_get(execarg_obj); /* - * Prevent a race with MJIT where the compiler process where + * Prevent a race with RJIT where the compiler process where * can hold an FD of ours in between vfork + execve */ if (!eargp->waitpid_state && mjit_enabled) { @@ -39,7 +39,7 @@ static void ASSERT_ractor_unlocking(rb_ractor_t *r) { #if RACTOR_CHECK_MODE > 0 - // GET_EC is NULL in an MJIT worker + // GET_EC is NULL in an RJIT worker if (rb_current_execution_context(false) != NULL && r->sync.locked_by == rb_ractor_self(GET_RACTOR())) { rb_bug("recursive ractor locking"); } @@ -50,7 +50,7 @@ static void ASSERT_ractor_locking(rb_ractor_t *r) { #if RACTOR_CHECK_MODE > 0 - // GET_EC is NULL in an MJIT worker + // GET_EC is NULL in an RJIT worker if (rb_current_execution_context(false) != NULL && r->sync.locked_by != rb_ractor_self(GET_RACTOR())) { rp(r->sync.locked_by); rb_bug("ractor lock is not acquired."); @@ -67,7 +67,7 @@ ractor_lock(rb_ractor_t *r, const char *file, int line) rb_native_mutex_lock(&r->sync.lock); #if RACTOR_CHECK_MODE > 0 - if (rb_current_execution_context(false) != NULL) { // GET_EC is NULL in an MJIT worker + if (rb_current_execution_context(false) != NULL) { // GET_EC is NULL in an RJIT worker r->sync.locked_by = rb_ractor_self(GET_RACTOR()); } #endif @@ -7,12 +7,12 @@ **********************************************************************/ -#include "ruby/internal/config.h" // defines USE_MJIT +#include "ruby/internal/config.h" // defines USE_RJIT // ISO C requires a translation unit to contain at least one declaration void rb_mjit(void) {} -#if USE_MJIT +#if USE_RJIT #include "constant.h" #include "id_table.h" @@ -59,12 +59,12 @@ void rb_mjit(void) {} #include "ruby/util.h" -// A copy of MJIT portion of MRI options since MJIT initialization. We -// need them as MJIT threads still can work when the most MRI data were +// A copy of RJIT portion of MRI options since RJIT initialization. We +// need them as RJIT threads still can work when the most MRI data were // freed. struct mjit_options mjit_opts; -// true if MJIT is enabled. +// true if RJIT is enabled. bool mjit_enabled = false; bool mjit_stats_enabled = false; // true if JIT-ed code should be called. When `ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS` @@ -73,7 +73,7 @@ bool mjit_call_p = false; // A flag to communicate that mjit_call_p should be disabled while it's temporarily false. bool mjit_cancel_p = false; -// Print the arguments according to FORMAT to stderr only if MJIT +// Print the arguments according to FORMAT to stderr only if RJIT // verbose option value is more or equal to LEVEL. PRINTF_ARGS(static void, 2, 3) verbose(int level, const char *format, ...) @@ -126,18 +126,18 @@ mjit_notify_waitpid(int exit_code) // TODO: remove this function } -// RubyVM::MJIT -static VALUE rb_mMJIT = 0; -// RubyVM::MJIT::C -static VALUE rb_mMJITC = 0; -// RubyVM::MJIT::Compiler -static VALUE rb_MJITCompiler = 0; -// RubyVM::MJIT::CPointer::Struct_rb_iseq_t -static VALUE rb_cMJITIseqPtr = 0; -// RubyVM::MJIT::CPointer::Struct_rb_control_frame_t -static VALUE rb_cMJITCfpPtr = 0; -// RubyVM::MJIT::Hooks -static VALUE rb_mMJITHooks = 0; +// RubyVM::RJIT +static VALUE rb_mRJIT = 0; +// RubyVM::RJIT::C +static VALUE rb_mRJITC = 0; +// RubyVM::RJIT::Compiler +static VALUE rb_RJITCompiler = 0; +// RubyVM::RJIT::CPointer::Struct_rb_iseq_t +static VALUE rb_cRJITIseqPtr = 0; +// RubyVM::RJIT::CPointer::Struct_rb_control_frame_t +static VALUE rb_cRJITCfpPtr = 0; +// RubyVM::RJIT::Hooks +static VALUE rb_mRJITHooks = 0; void rb_mjit_add_iseq_to_process(const rb_iseq_t *iseq) @@ -235,7 +235,7 @@ mjit_setup_options(const char *s, struct mjit_options *mjit_opt) } else { rb_raise(rb_eRuntimeError, - "invalid MJIT option `%s' (--help will show valid MJIT options)", s); + "invalid RJIT option `%s' (--help will show valid RJIT options)", s); } } @@ -248,7 +248,7 @@ const struct ruby_opt_message mjit_option_messages[] = { M("--mjit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"), M("--mjit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: " STRINGIZE(DEFAULT_MAX_CACHE_SIZE) ")"), M("--mjit-call-threshold=num", "", "Number of calls to trigger JIT (for testing, default: " STRINGIZE(DEFAULT_CALL_THRESHOLD) ")"), - M("--mjit-stats", "", "Enable collecting MJIT statistics"), + M("--mjit-stats", "", "Enable collecting RJIT statistics"), {0} }; #undef M @@ -292,10 +292,10 @@ uint8_t *rb_mjit_mem_block = NULL; // `rb_ec_ractor_hooks(ec)->events` is moved to this variable during compilation. rb_event_flag_t rb_mjit_global_events = 0; -// Basically mjit_opts.stats, but this becomes false during MJIT compilation. +// Basically mjit_opts.stats, but this becomes false during RJIT compilation. static bool mjit_stats_p = false; -#if MJIT_STATS +#if RJIT_STATS struct rb_mjit_runtime_counters rb_mjit_counters = { 0 }; @@ -311,7 +311,7 @@ rb_mjit_collect_vm_usage_insn(int insn) extern VALUE rb_gc_enable(void); extern VALUE rb_gc_disable(void); -#define WITH_MJIT_ISOLATED(stmt) do { \ +#define WITH_RJIT_ISOLATED(stmt) do { \ VALUE was_disabled = rb_gc_disable(); \ rb_hook_list_t *global_hooks = rb_ec_ractor_hooks(GET_EC()); \ rb_mjit_global_events = global_hooks->events; \ @@ -336,9 +336,9 @@ rb_mjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) static void mjit_cme_invalidate(void *data) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; - WITH_MJIT_ISOLATED({ - rb_funcall(rb_mMJITHooks, rb_intern("on_cme_invalidate"), 1, SIZET2NUM((size_t)data)); + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; + WITH_RJIT_ISOLATED({ + rb_funcall(rb_mRJITHooks, rb_intern("on_cme_invalidate"), 1, SIZET2NUM((size_t)data)); }); } @@ -347,7 +347,7 @@ extern int rb_workqueue_register(unsigned flags, rb_postponed_job_func_t func, v void rb_mjit_cme_invalidate(rb_callable_method_entry_t *cme) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; // Asynchronously hook the Ruby code since running Ruby in the middle of cme invalidation is dangerous. rb_workqueue_register(0, mjit_cme_invalidate, (void *)cme); } @@ -362,12 +362,12 @@ rb_mjit_before_ractor_spawn(void) static void mjit_constant_state_changed(void *data) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; RB_VM_LOCK_ENTER(); rb_vm_barrier(); - WITH_MJIT_ISOLATED({ - rb_funcall(rb_mMJITHooks, rb_intern("on_constant_state_changed"), 1, SIZET2NUM((size_t)data)); + WITH_RJIT_ISOLATED({ + rb_funcall(rb_mRJITHooks, rb_intern("on_constant_state_changed"), 1, SIZET2NUM((size_t)data)); }); RB_VM_LOCK_LEAVE(); @@ -376,7 +376,7 @@ mjit_constant_state_changed(void *data) void rb_mjit_constant_state_changed(ID id) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; // Asynchronously hook the Ruby code since this is hooked during a "Ruby critical section". rb_workqueue_register(0, mjit_constant_state_changed, (void *)id); } @@ -384,13 +384,13 @@ rb_mjit_constant_state_changed(ID id) void rb_mjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic, unsigned insn_idx) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; RB_VM_LOCK_ENTER(); rb_vm_barrier(); - WITH_MJIT_ISOLATED({ - rb_funcall(rb_mMJITHooks, rb_intern("on_constant_ic_update"), 3, + WITH_RJIT_ISOLATED({ + rb_funcall(rb_mRJITHooks, rb_intern("on_constant_ic_update"), 3, SIZET2NUM((size_t)iseq), SIZET2NUM((size_t)ic), UINT2NUM(insn_idx)); }); @@ -400,18 +400,18 @@ rb_mjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic, unsigned insn_idx void rb_mjit_tracing_invalidate_all(rb_event_flag_t new_iseq_events) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; - WITH_MJIT_ISOLATED({ - rb_funcall(rb_mMJITHooks, rb_intern("on_tracing_invalidate_all"), 1, UINT2NUM(new_iseq_events)); + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; + WITH_RJIT_ISOLATED({ + rb_funcall(rb_mRJITHooks, rb_intern("on_tracing_invalidate_all"), 1, UINT2NUM(new_iseq_events)); }); } static void mjit_iseq_update_references(void *data) { - if (!mjit_enabled || !mjit_call_p || !rb_mMJITHooks) return; - WITH_MJIT_ISOLATED({ - rb_funcall(rb_mMJITHooks, rb_intern("on_update_references"), 0); + if (!mjit_enabled || !mjit_call_p || !rb_mRJITHooks) return; + WITH_RJIT_ISOLATED({ + rb_funcall(rb_mRJITHooks, rb_intern("on_update_references"), 0); }); } @@ -436,7 +436,7 @@ rb_mjit_iseq_mark(VALUE mjit_blocks) if (!mjit_enabled) return; // Note: This wasn't enough for some reason. - // We actually rely on RubyVM::MJIT::GC_REFS to mark this. + // We actually rely on RubyVM::RJIT::GC_REFS to mark this. if (mjit_blocks) { rb_gc_mark_movable(mjit_blocks); } @@ -446,7 +446,7 @@ rb_mjit_iseq_mark(VALUE mjit_blocks) VALUE rb_mjit_iseq_new(rb_iseq_t *iseq) { - return rb_funcall(rb_cMJITIseqPtr, rb_intern("new"), 1, SIZET2NUM((size_t)iseq)); + return rb_funcall(rb_cRJITIseqPtr, rb_intern("new"), 1, SIZET2NUM((size_t)iseq)); } void @@ -455,10 +455,10 @@ rb_mjit_compile(const rb_iseq_t *iseq) RB_VM_LOCK_ENTER(); rb_vm_barrier(); - WITH_MJIT_ISOLATED({ - VALUE iseq_ptr = rb_funcall(rb_cMJITIseqPtr, rb_intern("new"), 1, SIZET2NUM((size_t)iseq)); - VALUE cfp_ptr = rb_funcall(rb_cMJITCfpPtr, rb_intern("new"), 1, SIZET2NUM((size_t)GET_EC()->cfp)); - rb_funcall(rb_MJITCompiler, rb_intern("compile"), 2, iseq_ptr, cfp_ptr); + WITH_RJIT_ISOLATED({ + VALUE iseq_ptr = rb_funcall(rb_cRJITIseqPtr, rb_intern("new"), 1, SIZET2NUM((size_t)iseq)); + VALUE cfp_ptr = rb_funcall(rb_cRJITCfpPtr, rb_intern("new"), 1, SIZET2NUM((size_t)GET_EC()->cfp)); + rb_funcall(rb_RJITCompiler, rb_intern("compile"), 2, iseq_ptr, cfp_ptr); }); RB_VM_LOCK_LEAVE(); @@ -475,9 +475,9 @@ rb_mjit_branch_stub_hit(VALUE branch_stub, int sp_offset, int target0_p) rb_control_frame_t *cfp = GET_EC()->cfp; cfp->sp += sp_offset; // preserve stack values, also using the actual sp_offset to make jit.peek_at_stack work - WITH_MJIT_ISOLATED({ - VALUE cfp_ptr = rb_funcall(rb_cMJITCfpPtr, rb_intern("new"), 1, SIZET2NUM((size_t)cfp)); - result = rb_funcall(rb_MJITCompiler, rb_intern("branch_stub_hit"), 3, branch_stub, cfp_ptr, RBOOL(target0_p)); + WITH_RJIT_ISOLATED({ + VALUE cfp_ptr = rb_funcall(rb_cRJITCfpPtr, rb_intern("new"), 1, SIZET2NUM((size_t)cfp)); + result = rb_funcall(rb_RJITCompiler, rb_intern("branch_stub_hit"), 3, branch_stub, cfp_ptr, RBOOL(target0_p)); }); cfp->sp -= sp_offset; // reset for consistency with the code without the stub @@ -496,10 +496,10 @@ mjit_mark(void) RUBY_MARK_ENTER("mjit"); // Pin object pointers used in this file - rb_gc_mark(rb_MJITCompiler); - rb_gc_mark(rb_cMJITIseqPtr); - rb_gc_mark(rb_cMJITCfpPtr); - rb_gc_mark(rb_mMJITHooks); + rb_gc_mark(rb_RJITCompiler); + rb_gc_mark(rb_cRJITIseqPtr); + rb_gc_mark(rb_cRJITCfpPtr); + rb_gc_mark(rb_mRJITHooks); RUBY_MARK_LEAVE("mjit"); } @@ -511,22 +511,22 @@ mjit_init(const struct mjit_options *opts) mjit_opts = *opts; extern uint8_t* rb_yjit_reserve_addr_space(uint32_t mem_size); - rb_mjit_mem_block = rb_yjit_reserve_addr_space(MJIT_CODE_SIZE); + rb_mjit_mem_block = rb_yjit_reserve_addr_space(RJIT_CODE_SIZE); - // MJIT doesn't support miniruby, but it might reach here by MJIT_FORCE_ENABLE. - rb_mMJIT = rb_const_get(rb_cRubyVM, rb_intern("MJIT")); - if (!rb_const_defined(rb_mMJIT, rb_intern("Compiler"))) { - verbose(1, "Disabling MJIT because RubyVM::MJIT::Compiler is not defined"); + // RJIT doesn't support miniruby, but it might reach here by RJIT_FORCE_ENABLE. + rb_mRJIT = rb_const_get(rb_cRubyVM, rb_intern("RJIT")); + if (!rb_const_defined(rb_mRJIT, rb_intern("Compiler"))) { + verbose(1, "Disabling RJIT because RubyVM::RJIT::Compiler is not defined"); mjit_enabled = false; return; } - rb_mMJITC = rb_const_get(rb_mMJIT, rb_intern("C")); - VALUE rb_cMJITCompiler = rb_const_get(rb_mMJIT, rb_intern("Compiler")); - rb_MJITCompiler = rb_funcall(rb_cMJITCompiler, rb_intern("new"), 2, - SIZET2NUM((size_t)rb_mjit_mem_block), UINT2NUM(MJIT_CODE_SIZE)); - rb_cMJITIseqPtr = rb_funcall(rb_mMJITC, rb_intern("rb_iseq_t"), 0); - rb_cMJITCfpPtr = rb_funcall(rb_mMJITC, rb_intern("rb_control_frame_t"), 0); - rb_mMJITHooks = rb_const_get(rb_mMJIT, rb_intern("Hooks")); + rb_mRJITC = rb_const_get(rb_mRJIT, rb_intern("C")); + VALUE rb_cRJITCompiler = rb_const_get(rb_mRJIT, rb_intern("Compiler")); + rb_RJITCompiler = rb_funcall(rb_cRJITCompiler, rb_intern("new"), 2, + SIZET2NUM((size_t)rb_mjit_mem_block), UINT2NUM(RJIT_CODE_SIZE)); + rb_cRJITIseqPtr = rb_funcall(rb_mRJITC, rb_intern("rb_iseq_t"), 0); + rb_cRJITCfpPtr = rb_funcall(rb_mRJITC, rb_intern("rb_control_frame_t"), 0); + rb_mRJITHooks = rb_const_get(rb_mRJIT, rb_intern("Hooks")); mjit_call_p = true; mjit_stats_p = mjit_opts.stats; @@ -546,7 +546,7 @@ mjit_finish(bool close_handle_p) // TODO: implement } -// Same as `RubyVM::MJIT::C.enabled?`, but this is used before mjit_init. +// Same as `RubyVM::RJIT::C.enabled?`, but this is used before mjit_init. static VALUE mjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self) { @@ -564,4 +564,4 @@ mjit_stop_stats(rb_execution_context_t *ec, VALUE self) #include "mjit.rbinc" -#endif // USE_MJIT +#endif // USE_RJIT @@ -1,5 +1,5 @@ -#ifndef RUBY_MJIT_H -#define RUBY_MJIT_H 1 +#ifndef RUBY_RJIT_H +#define RUBY_RJIT_H 1 /********************************************************************** mjit.h - Interface to MRI method JIT compiler @@ -9,35 +9,35 @@ **********************************************************************/ -#include "ruby/internal/config.h" // defines USE_MJIT +#include "ruby/internal/config.h" // defines USE_RJIT #include "ruby/internal/stdbool.h" #include "vm_core.h" -# if USE_MJIT +# if USE_RJIT -#ifndef MJIT_STATS -# define MJIT_STATS RUBY_DEBUG +#ifndef RJIT_STATS +# define RJIT_STATS RUBY_DEBUG #endif #include "ruby.h" #include "vm_core.h" // Special address values of a function generated from the -// corresponding iseq by MJIT: +// corresponding iseq by RJIT: enum rb_mjit_func_state { // ISEQ has not been compiled yet - MJIT_FUNC_NOT_COMPILED = 0, + RJIT_FUNC_NOT_COMPILED = 0, // ISEQ is already queued for the machine code generation but the // code is not ready yet for the execution - MJIT_FUNC_COMPILING = 1, + RJIT_FUNC_COMPILING = 1, // ISEQ included not compilable insn, some internal assertion failed // or the unit is unloaded - MJIT_FUNC_FAILED = 2, + RJIT_FUNC_FAILED = 2, }; // Return true if jit_func is part of enum rb_mjit_func_state -#define MJIT_FUNC_STATE_P(jit_func) ((uintptr_t)(jit_func) <= (uintptr_t)MJIT_FUNC_FAILED) +#define RJIT_FUNC_STATE_P(jit_func) ((uintptr_t)(jit_func) <= (uintptr_t)RJIT_FUNC_FAILED) -// MJIT options which can be defined on the MRI command line. +// RJIT options which can be defined on the MRI command line. struct mjit_options { // Converted from "jit" feature flag to tell the enablement // information to ruby_show_version(). @@ -46,7 +46,7 @@ struct mjit_options { // include the pre-compiled header, C code file generated for ISEQ, // and the corresponding object file. bool save_temps; - // Print MJIT warnings to stderr. + // Print RJIT warnings to stderr. bool warnings; // Disable compiler optimization and add debug symbols. It can be // very slow. @@ -57,17 +57,17 @@ struct mjit_options { bool wait; // Number of calls to trigger JIT compilation. For testing. unsigned int call_threshold; - // Collect MJIT statistics + // Collect RJIT statistics bool stats; - // Force printing info about MJIT work of level VERBOSE or + // Force printing info about RJIT work of level VERBOSE or // less. 0=silence, 1=medium, 2=verbose. int verbose; - // Maximal permitted number of iseq JIT codes in a MJIT memory + // Maximal permitted number of iseq JIT codes in a RJIT memory // cache. int max_cache_size; - // [experimental] Do not start MJIT until MJIT.resume is called. + // [experimental] Do not start RJIT until RJIT.resume is called. bool pause; - // [experimental] Call custom RubyVM::MJIT.compile instead of MJIT. + // [experimental] Call custom RubyVM::RJIT.compile instead of RJIT. bool custom; // Enable disasm of all JIT code bool dump_disasm; @@ -131,7 +131,7 @@ VALUE mjit_pause(bool wait_p); VALUE mjit_resume(void); void mjit_finish(bool close_handle_p); -# else // USE_MJIT +# else // USE_RJIT static inline void mjit_cancel_all(const char *reason){} static inline void mjit_free_iseq(const rb_iseq_t *iseq){} @@ -154,5 +154,5 @@ static inline void mjit_finish(bool close_handle_p){} static inline void rb_mjit_collect_vm_usage_insn(int insn) {} -# endif // USE_MJIT -#endif // RUBY_MJIT_H +# endif // USE_RJIT +#endif // RUBY_RJIT_H @@ -1,5 +1,5 @@ -module RubyVM::MJIT - # Return true if MJIT is enabled. +module RubyVM::RJIT + # Return true if RJIT is enabled. def self.enabled? Primitive.cexpr! 'RBOOL(mjit_enabled)' end @@ -22,12 +22,12 @@ module RubyVM::MJIT end end -if RubyVM::MJIT.enabled? +if RubyVM::RJIT.enabled? begin require 'fiddle' require 'fiddle/import' rescue LoadError - return # miniruby doesn't support MJIT + return # miniruby doesn't support RJIT end require 'ruby_vm/mjit/c_type' @@ -1,17 +1,17 @@ /********************************************************************** - mjit_c.c - C helpers for MJIT + mjit_c.c - C helpers for RJIT Copyright (C) 2017 Takashi Kokubun <[email protected]>. **********************************************************************/ -#include "ruby/internal/config.h" // defines USE_MJIT +#include "ruby/internal/config.h" // defines USE_RJIT // ISO C requires a translation unit to contain at least one declaration void rb_mjit_c(void) {} -#if USE_MJIT +#if USE_RJIT #include "mjit.h" #include "mjit_c.h" @@ -42,7 +42,7 @@ void rb_mjit_c(void) {} #define SIZEOF(type) RB_SIZE2NUM(sizeof(type)) #define SIGNED_TYPE_P(type) RBOOL((type)(-1) < (type)(1)) -#if MJIT_STATS +#if RJIT_STATS // Insn side exit counters static size_t mjit_insn_exits[VM_INSTRUCTION_SIZE] = { 0 }; #endif // YJIT_STATS @@ -83,7 +83,7 @@ dump_disasm(rb_execution_context_t *ec, VALUE self, VALUE from, VALUE to) return result; } -// Same as `RubyVM::MJIT.enabled?`, but this is used before it's defined. +// Same as `RubyVM::RJIT.enabled?`, but this is used before it's defined. static VALUE mjit_enabled_p(rb_execution_context_t *ec, VALUE self) { @@ -122,4 +122,4 @@ extern ID rb_get_symbol_id(VALUE name); #include "mjit_c.rbinc" -#endif // USE_MJIT +#endif // USE_RJIT @@ -1,6 +1,6 @@ // This file is parsed by tool/mjit/generate.rb to generate mjit_c.rb -#ifndef MJIT_C_H -#define MJIT_C_H +#ifndef RJIT_C_H +#define RJIT_C_H #include "ruby/internal/config.h" #include "internal/string.h" @@ -25,14 +25,14 @@ struct rb_mjit_unit_list { enum rb_mjit_unit_type { // Single-ISEQ unit for unit_queue - MJIT_UNIT_ISEQ = 0, + RJIT_UNIT_ISEQ = 0, // Multi-ISEQ unit for mjit_batch - MJIT_UNIT_BATCH = 1, + RJIT_UNIT_BATCH = 1, // All-ISEQ unit for mjit_compact - MJIT_UNIT_COMPACT = 2, + RJIT_UNIT_COMPACT = 2, }; -// The unit structure that holds metadata of ISeq for MJIT. +// The unit structure that holds metadata of ISeq for RJIT. // TODO: Use different structs for ISEQ and BATCH/COMPACT struct rb_mjit_unit { struct ccan_list_node unode; @@ -41,7 +41,7 @@ struct rb_mjit_unit { // Type of this unit enum rb_mjit_unit_type type; - /* MJIT_UNIT_ISEQ */ + /* RJIT_UNIT_ISEQ */ // ISEQ for a non-batch unit rb_iseq_t *iseq; // Only used by unload_units. Flag to check this unit is currently on stack or not. @@ -53,11 +53,11 @@ struct rb_mjit_unit { // ISEQ_BODY(iseq)->ci_size + ones of inlined iseqs unsigned int cc_entries_size; - /* MJIT_UNIT_BATCH, MJIT_UNIT_COMPACT */ + /* RJIT_UNIT_BATCH, RJIT_UNIT_COMPACT */ // Dlopen handle of the loaded object file. void *handle; // Units compacted by this batch - struct rb_mjit_unit_list units; // MJIT_UNIT_BATCH only + struct rb_mjit_unit_list units; // RJIT_UNIT_BATCH only }; // Storage to keep data which is consistent in each conditional branch. @@ -103,12 +103,12 @@ struct compile_status { // // TODO: Make it configurable -#define MJIT_CODE_SIZE 64 * 1024 * 1024 +#define RJIT_CODE_SIZE 64 * 1024 * 1024 extern uint8_t *rb_mjit_mem_block; -#define MJIT_RUNTIME_COUNTERS(...) struct rb_mjit_runtime_counters { size_t __VA_ARGS__; }; -MJIT_RUNTIME_COUNTERS( +#define RJIT_RUNTIME_COUNTERS(...) struct rb_mjit_runtime_counters { size_t __VA_ARGS__; }; +RJIT_RUNTIME_COUNTERS( vm_insns_count, mjit_insns_count, @@ -207,7 +207,7 @@ MJIT_RUNTIME_COUNTERS( compiled_block_count ) -#undef MJIT_RUNTIME_COUNTERS +#undef RJIT_RUNTIME_COUNTERS extern struct rb_mjit_runtime_counters rb_mjit_counters; -#endif /* MJIT_C_H */ +#endif /* RJIT_C_H */ @@ -1,7 +1,7 @@ # frozen_string_literal: true # Part of this file is generated by tool/mjit/bindgen.rb. -# Run `make mjit-bindgen` to update code between "MJIT bindgen begin" and "MJIT bindgen end". -module RubyVM::MJIT # :nodoc: all +# Run `make mjit-bindgen` to update code between "RJIT bindgen begin" and "RJIT bindgen end". +module RubyVM::RJIT # :nodoc: all # This `class << C` section is for calling C functions. For importing variables # or macros as is, please consider using tool/mjit/bindgen.rb instead. class << C = Object.new @@ -12,7 +12,7 @@ module RubyVM::MJIT # :nodoc: all def mjit_mark_writable Primitive.cstmt! %{ extern bool rb_yjit_mark_writable(void *mem_block, uint32_t mem_size); - rb_yjit_mark_writable(rb_mjit_mem_block, MJIT_CODE_SIZE); + rb_yjit_mark_writable(rb_mjit_mem_block, RJIT_CODE_SIZE); return Qnil; } end @@ -20,14 +20,14 @@ module RubyVM::MJIT # :nodoc: all def mjit_mark_executable Primitive.cstmt! %{ extern bool rb_yjit_mark_executable(void *mem_block, uint32_t mem_size); - rb_yjit_mark_executable(rb_mjit_mem_block, MJIT_CODE_SIZE); + rb_yjit_mark_executable(rb_mjit_mem_block, RJIT_CODE_SIZE); return Qnil; } end def mjit_insn_exits addr = Primitive.cstmt! %{ - #if MJIT_STATS + #if RJIT_STATS return SIZET2NUM((size_t)mjit_insn_exits); #else return SIZET2NUM(0); @@ -45,7 +45,7 @@ module RubyVM::MJIT # :nodoc: all def rb_mjit_counters addr = Primitive.cstmt! %{ - #if MJIT_STATS + #if RJIT_STATS return SIZET2NUM((size_t)&rb_mjit_counters); #else return SIZET2NUM(0); @@ -569,7 +569,7 @@ module RubyVM::MJIT # :nodoc: all end end - ### MJIT bindgen begin ### + ### RJIT bindgen begin ### def C.USE_LAZY_LOAD Primitive.cexpr! %q{ RBOOL(USE_LAZY_LOAD != 0) } @@ -1872,5 +1872,5 @@ module RubyVM::MJIT # :nodoc: all CType::Stub.new(:rb_ext_config) end - ### MJIT bindgen end ### + ### RJIT bindgen end ### end if Primitive.mjit_enabled_p @@ -118,7 +118,7 @@ void rb_warning_category_update(unsigned int mask, unsigned int bits); enum feature_flag_bits { EACH_FEATURES(DEFINE_FEATURE, COMMA), feature_debug_flag_first, -#if defined(MJIT_FORCE_ENABLE) || !USE_YJIT +#if defined(RJIT_FORCE_ENABLE) || !USE_YJIT DEFINE_FEATURE(jit) = feature_mjit, #else DEFINE_FEATURE(jit) = feature_yjit, @@ -213,7 +213,7 @@ cmdline_options_init(ruby_cmdline_options_t *opt) opt->ext.enc.index = -1; opt->intern.enc.index = -1; opt->features.set = DEFAULT_FEATURES; -#ifdef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */ +#ifdef RJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DRJIT_FORCE_ENABLE" */ opt->features.set |= FEATURE_BIT(mjit); #elif defined(YJIT_FORCE_ENABLE) opt->features.set |= FEATURE_BIT(yjit); @@ -286,7 +286,7 @@ usage(const char *name, int help, int highlight, int columns) M("-W[level=2|:category]", "", "set warning level; 0=silence, 1=medium, 2=verbose"), M("-x[directory]", "", "strip off text before #!ruby line and perhaps cd to directory"), M("--jit", "", "enable JIT for the platform, same as " PLATFORM_JIT_OPTION), -#if USE_MJIT +#if USE_RJIT M("--mjit", "", "enable C compiler-based JIT compiler (experimental)"), #endif #if USE_YJIT @@ -321,7 +321,7 @@ usage(const char *name, int help, int highlight, int columns) M("syntax_suggest", "", "syntax_suggest (default: "DEFAULT_RUBYGEMS_ENABLED")"), M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"), M("frozen-string-literal", "", "freeze all string literals (default: disabled)"), -#if USE_MJIT +#if USE_RJIT M("mjit", "", "C compiler-based JIT compiler (default: disabled)"), #endif #if USE_YJIT @@ -332,7 +332,7 @@ usage(const char *name, int help, int highlight, int columns) M("deprecated", "", "deprecated features"), M("experimental", "", "experimental features"), }; -#if USE_MJIT +#if USE_RJIT extern const struct ruby_opt_message mjit_option_messages[]; #endif #if USE_YJIT @@ -370,8 +370,8 @@ usage(const char *name, int help, int highlight, int columns) printf("%s""Warning categories:%s\n", sb, se); for (i = 0; i < numberof(warn_categories); ++i) SHOW(warn_categories[i]); -#if USE_MJIT - printf("%s""MJIT options (experimental):%s\n", sb, se); +#if USE_RJIT + printf("%s""RJIT options (experimental):%s\n", sb, se); for (i = 0; mjit_option_messages[i].str; ++i) SHOW(mjit_option_messages[i]); #endif @@ -957,7 +957,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable) goto found; } if (NAME_MATCH_P("all", str, len)) { - // YJIT and MJIT cannot be enabled at the same time. We enable only one for --enable=all. + // YJIT and RJIT cannot be enabled at the same time. We enable only one for --enable=all. mask &= ~feature_jit_mask | FEATURE_BIT(jit); goto found; } @@ -1486,19 +1486,19 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) ruby_verbose = Qtrue; } else if (strcmp("jit", s) == 0) { -#if !USE_MJIT +#if !USE_RJIT rb_warn("Ruby was built without JIT support"); #else FEATURE_SET(opt->features, FEATURE_BIT(jit)); #endif } else if (is_option_with_optarg("mjit", '-', true, false, false)) { -#if USE_MJIT +#if USE_RJIT extern void mjit_setup_options(const char *s, struct mjit_options *mjit_opt); FEATURE_SET(opt->features, FEATURE_BIT(mjit)); mjit_setup_options(s, &opt->mjit); #else - rb_warn("MJIT support is disabled."); + rb_warn("RJIT support is disabled."); #endif } else if (is_option_with_optarg("yjit", '-', true, false, false)) { @@ -1611,8 +1611,8 @@ ruby_opt_init(ruby_cmdline_options_t *opt) rb_warning_category_update(opt->warn.mask, opt->warn.set); -#if USE_MJIT - // rb_call_builtin_inits depends on RubyVM::MJIT.enabled? +#if USE_RJIT + // rb_call_builtin_inits depends on RubyVM::RJIT.enabled? if (opt->mjit.on) mjit_enabled = true; if (opt->mjit.stats) @@ -1625,8 +1625,8 @@ ruby_opt_init(ruby_cmdline_options_t *opt) ruby_init_prelude(); // Initialize JITs after prelude because JITing prelude is typically not optimal. -#if USE_MJIT - // Also, mjit_init is safe only after rb_call_builtin_inits() defines RubyVM::MJIT::Compiler. +#if USE_RJIT + // Also, mjit_init is safe only after rb_call_builtin_inits() defines RubyVM::RJIT::Compiler. if (opt->mjit.on) mjit_init(&opt->mjit); #endif @@ -1935,11 +1935,11 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) #endif } if (MULTI_BITS_P(FEATURE_SET_BITS(opt->features) & feature_jit_mask)) { - rb_warn("MJIT and YJIT cannot both be enabled at the same time. Exiting"); + rb_warn("RJIT and YJIT cannot both be enabled at the same time. Exiting"); return Qfalse; } -#if USE_MJIT +#if USE_RJIT if (FEATURE_SET_P(opt->features, mjit)) { opt->mjit.on = true; // set opt->mjit.on for Init_ruby_description() and calling mjit_init() } diff --git a/spec/ruby/command_line/dash_v_spec.rb b/spec/ruby/command_line/dash_v_spec.rb index a4f4dcd051..9b570fa1eb 100644 --- a/spec/ruby/command_line/dash_v_spec.rb +++ b/spec/ruby/command_line/dash_v_spec.rb @@ -8,6 +8,6 @@ describe "The -v command line option" do it "prints version and ends" do ruby_exe(nil, args: '-v').should include(RUBY_DESCRIPTION) end unless (defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?) || - (defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?) + (defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?) end end diff --git a/spec/ruby/core/io/flush_spec.rb b/spec/ruby/core/io/flush_spec.rb index 34cf42c425..f7d5ba77fc 100644 --- a/spec/ruby/core/io/flush_spec.rb +++ b/spec/ruby/core/io/flush_spec.rb @@ -19,11 +19,11 @@ describe "IO#flush" do end end - # [ruby-core:90895] MJIT worker may leave fd open in a forked child. - # For instance, MJIT creates a worker before @r.close with fork(), @r.close happens, - # and the MJIT worker keeps the pipe open until the worker execve(). - # TODO: consider acquiring GVL from MJIT worker. - guard_not -> { defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? } do + # [ruby-core:90895] RJIT worker may leave fd open in a forked child. + # For instance, RJIT creates a worker before @r.close with fork(), @r.close happens, + # and the RJIT worker keeps the pipe open until the worker execve(). + # TODO: consider acquiring GVL from RJIT worker. + guard_not -> { defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? } do it "raises Errno::EPIPE if sync=false and the read end is closed" do @w.sync = false @w.write "foo" diff --git a/spec/ruby/core/io/shared/write.rb b/spec/ruby/core/io/shared/write.rb index 9503f94212..a4d1259971 100644 --- a/spec/ruby/core/io/shared/write.rb +++ b/spec/ruby/core/io/shared/write.rb @@ -85,11 +85,11 @@ describe :io_write, shared: true do @r.read.should == "foo" end - # [ruby-core:90895] MJIT worker may leave fd open in a forked child. - # For instance, MJIT creates a worker before @r.close with fork(), @r.close happens, - # and the MJIT worker keeps the pipe open until the worker execve(). - # TODO: consider acquiring GVL from MJIT worker. - guard_not -> { defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? } do + # [ruby-core:90895] RJIT worker may leave fd open in a forked child. + # For instance, RJIT creates a worker before @r.close with fork(), @r.close happens, + # and the RJIT worker keeps the pipe open until the worker execve(). + # TODO: consider acquiring GVL from RJIT worker. + guard_not -> { defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? } do it "raises Errno::EPIPE if the read end is closed and does not die from SIGPIPE" do @r.close -> { @w.send(@method, "foo") }.should raise_error(Errno::EPIPE, /Broken pipe/) diff --git a/spec/ruby/core/process/wait2_spec.rb b/spec/ruby/core/process/wait2_spec.rb index 673d3cdb9d..cc4cf89e0c 100644 --- a/spec/ruby/core/process/wait2_spec.rb +++ b/spec/ruby/core/process/wait2_spec.rb @@ -4,7 +4,7 @@ describe "Process.wait2" do before :all do # HACK: this kludge is temporarily necessary because some # misbehaving spec somewhere else does not clear processes - # Note: background processes are unavoidable with MJIT, + # Note: background processes are unavoidable with RJIT, # but we shouldn't reap them from Ruby-space begin Process.wait(-1, Process::WNOHANG) diff --git a/template/Doxyfile.tmpl b/template/Doxyfile.tmpl index 502e171384..3e122863c1 100644 --- a/template/Doxyfile.tmpl +++ b/template/Doxyfile.tmpl @@ -2249,10 +2249,10 @@ PREDEFINED += DEPRECATED(_)=_ PREDEFINED += DEPRECATED_BY(__,_)=_ PREDEFINED += ENUM_OVER_INT=1 PREDEFINED += ERRORFUNC(__,_)=_ -PREDEFINED += MJIT_FUNC_EXPORTED= -PREDEFINED += MJIT_STATIC=extern -PREDEFINED += MJIT_SYMBOL_EXPORT_BEGIN= -PREDEFINED += MJIT_SYMBOL_EXPORT_END= +PREDEFINED += RJIT_FUNC_EXPORTED= +PREDEFINED += RJIT_STATIC=extern +PREDEFINED += RJIT_SYMBOL_EXPORT_BEGIN= +PREDEFINED += RJIT_SYMBOL_EXPORT_END= PREDEFINED += NOINLINE(_)=_ PREDEFINED += NORETURN(_)=_ PREDEFINED += PACKED_STRUCT_UNALIGNED(_)=_ diff --git a/template/Makefile.in b/template/Makefile.in index 60390e8c93..7b7fbd4c9e 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -95,13 +95,13 @@ XCFLAGS = @XCFLAGS@ $(INCFLAGS) $(_RUBY_DEVEL_enabled:yes=-DRUBY_DEVEL=1) USE_RUBYGEMS = @USE_RUBYGEMS@ USE_RUBYGEMS_ = $(USE_RUBYGEMS:yes=) CPPFLAGS = @CPPFLAGS@ $(USE_RUBYGEMS_:no=-DDISABLE_RUBYGEMS=1) -MJIT_SUPPORT = @MJIT_SUPPORT@ -MJIT_CC = @MJIT_CC@ -MJIT_CFLAGS = @MJIT_CFLAGS@ -MJIT_OPTFLAGS = @MJIT_OPTFLAGS@ -MJIT_DEBUGFLAGS = @MJIT_DEBUGFLAGS@ -MJIT_LDSHARED = @MJIT_LDSHARED@ -MJIT_DLDFLAGS = $(XDLDFLAGS) +RJIT_SUPPORT = @RJIT_SUPPORT@ +RJIT_CC = @RJIT_CC@ +RJIT_CFLAGS = @RJIT_CFLAGS@ +RJIT_OPTFLAGS = @RJIT_OPTFLAGS@ +RJIT_DEBUGFLAGS = @RJIT_DEBUGFLAGS@ +RJIT_LDSHARED = @RJIT_LDSHARED@ +RJIT_DLDFLAGS = $(XDLDFLAGS) YJIT_SUPPORT=@YJIT_SUPPORT@ YJIT_LIBS=@YJIT_LIBS@ YJIT_OBJ=@YJIT_OBJ@ diff --git a/template/fake.rb.in b/template/fake.rb.in index 1ad4943b04..a08967167e 100644 --- a/template/fake.rb.in +++ b/template/fake.rb.in @@ -23,7 +23,7 @@ File.read(File.join(arg['srcdir'], 'version.c')). scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|(STR))\(([^()]*)\)/m) do |n, s, v| version[n] = arg[v] || src.value(v) || (s ? v : 0) end -arg['RUBY_DESCRIPTION_WITH_MJIT'] = src.value('description_with_mjit') || 'description_with_mjit' +arg['RUBY_DESCRIPTION_WITH_RJIT'] = src.value('description_with_mjit') || 'description_with_mjit' arg['RUBY_DESCRIPTION_WITH_YJIT'] = src.value('description_with_yjit') || 'description_with_yjit' %>baseruby="<%=arg['BASERUBY']%>" _\ @@ -41,8 +41,8 @@ class Object constants.grep(/^RUBY_/) {|n| remove_const n} % arg['versions'].each {|n, v| <%=n%> = <%if n=='RUBY_DESCRIPTION' %>case - when RubyVM.const_defined?(:MJIT) && RubyVM::MJIT.enabled? - <%=arg['RUBY_DESCRIPTION_WITH_MJIT'].inspect%> + when RubyVM.const_defined?(:RJIT) && RubyVM::RJIT.enabled? + <%=arg['RUBY_DESCRIPTION_WITH_RJIT'].inspect%> when RubyVM.const_defined?(:YJIT) && RubyVM::YJIT.enabled? <%=arg['RUBY_DESCRIPTION_WITH_YJIT'].inspect%> else diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb index 81d2ca4674..fb1b61d367 100644 --- a/test/-ext-/bug_reporter/test_bug_reporter.rb +++ b/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -12,7 +12,7 @@ class TestBugReporter < Test::Unit::TestCase omit if ENV['RUBY_ON_BUG'] description = RUBY_DESCRIPTION - description = description.sub(/\+MJIT /, '') unless JITSupport.mjit_force_enabled? + description = description.sub(/\+RJIT /, '') unless JITSupport.mjit_force_enabled? expected_stderr = [ :*, /\[BUG\]\sSegmentation\sfault.*\n/, diff --git a/test/csv/parse/test_general.rb b/test/csv/parse/test_general.rb index 23cd7ee807..48e68d3392 100644 --- a/test/csv/parse/test_general.rb +++ b/test/csv/parse/test_general.rb @@ -329,7 +329,7 @@ line,5,jkl if defined?(RubyVM::YJIT.enabled?) and RubyVM::YJIT.enabled? timeout = 1 # for --yjit-call-threshold=1 end - if defined?(RubyVM::MJIT.enabled?) and RubyVM::MJIT.enabled? + if defined?(RubyVM::RJIT.enabled?) and RubyVM::RJIT.enabled? timeout = 5 # for --jit-wait end Timeout.timeout(timeout) do diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index 71bc92ab70..72220f32ef 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -218,7 +218,7 @@ module DRbCore omit if RUBY_PLATFORM.include?("armv7l-linux") omit if RUBY_PLATFORM.include?("sparc-solaris2.10") omit if RUBY_PLATFORM.include?("freebsd") - omit if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # expecting a certain delay is difficult for --jit-wait CI + omit if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # expecting a certain delay is difficult for --jit-wait CI Timeout.timeout(60) do ten = Onecky.new(10) assert_raise(Timeout::Error) do diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb index 9ff1914133..769bc3d644 100644 --- a/test/lib/jit_support.rb +++ b/test/lib/jit_support.rb @@ -54,11 +54,11 @@ module JITSupport ) end - # For MJIT + # For RJIT def supported? return @supported if defined?(@supported) - @supported = RbConfig::CONFIG["MJIT_SUPPORT"] != 'no' && - UNSUPPORTED_COMPILERS.all? { |regexp| !regexp.match?(RbConfig::CONFIG['MJIT_CC']) } && + @supported = RbConfig::CONFIG["RJIT_SUPPORT"] != 'no' && + UNSUPPORTED_COMPILERS.all? { |regexp| !regexp.match?(RbConfig::CONFIG['RJIT_CC']) } && !PENDING_RUBYCI_NICKNAMES.include?(ENV['RUBYCI_NICKNAME']) && !UNSUPPORTED_ARCHITECTURES.include?(RUBY_PLATFORM.split('-', 2).first) end @@ -70,8 +70,8 @@ module JITSupport end def remove_mjit_logs(stderr) - if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # utility for -DFORCE_MJIT_ENABLE - stderr.gsub(/^MJIT warning: Skipped to compile unsupported instruction: \w+\n/m, '') + if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # utility for -DFORCE_RJIT_ENABLE + stderr.gsub(/^RJIT warning: Skipped to compile unsupported instruction: \w+\n/m, '') else stderr end @@ -88,6 +88,6 @@ module JITSupport end def mjit_force_enabled? - "#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?MJIT_FORCE_ENABLE\b/) + "#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?RJIT_FORCE_ENABLE\b/) end end diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb index 394b4c5bfa..a8e6fa1ed1 100644 --- a/test/net/http/test_httpresponse.rb +++ b/test/net/http/test_httpresponse.rb @@ -313,7 +313,7 @@ EOS def test_read_body_block_mod # http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3019353 - if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? omit 'too unstable with --jit-wait, and extending read_timeout did not help it' end IO.pipe do |r, w| diff --git a/test/reline/test_within_pipe.rb b/test/reline/test_within_pipe.rb index 43a66f45f4..930f99c32d 100644 --- a/test/reline/test_within_pipe.rb +++ b/test/reline/test_within_pipe.rb @@ -9,7 +9,7 @@ class Reline::WithinPipeTest < Reline::TestCase @reader, @output_writer = IO.pipe(@encoding) @output = Reline.output = @output_writer @config = Reline.send(:core).config - @config.keyseq_timeout *= 600 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait CI + @config.keyseq_timeout *= 600 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # for --jit-wait CI @line_editor = Reline.send(:core).line_editor end diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb index 74d8d363b4..00404e39df 100644 --- a/test/rinda/test_rinda.rb +++ b/test/rinda/test_rinda.rb @@ -402,7 +402,7 @@ module TupleSpaceTestModule end def test_cancel_02 - omit 'this test is unstable with --jit-wait' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit 'this test is unstable with --jit-wait' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? entry = @ts.write([:removeme, 1]) assert_equal([[:removeme, 1]], @ts.read_all([nil, nil])) entry.cancel @@ -686,7 +686,7 @@ class TestRingServer < Test::Unit::TestCase end def test_do_reply_local - omit 'timeout-based test becomes unstable with --jit-wait' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit 'timeout-based test becomes unstable with --jit-wait' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? with_timeout(30) {_test_do_reply_local} end diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 5825aaf6cc..cb6e846bc6 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -34,7 +34,7 @@ class TestFiber < Test::Unit::TestCase end def test_many_fibers - omit 'This is unstable on GitHub Actions --jit-wait. TODO: debug it' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit 'This is unstable on GitHub Actions --jit-wait. TODO: debug it' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? max = 1000 assert_equal(max, max.times{ Fiber.new{} diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 5ea9a8e574..55fefab97c 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -655,7 +655,7 @@ class TestIO < Test::Unit::TestCase if have_nonblock? def test_copy_stream_no_busy_wait - omit "MJIT has busy wait on GC. This sometimes fails with --jit." if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit "RJIT has busy wait on GC. This sometimes fails with --jit." if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? omit "multiple threads already active" if Thread.list.size > 1 msg = 'r58534 [ruby-core:80969] [Backport #13533]' @@ -1679,7 +1679,7 @@ class TestIO < Test::Unit::TestCase end if have_nonblock? def test_read_nonblock_no_exceptions - omit '[ruby-core:90895] MJIT worker may leave fd open in a forked child' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # TODO: consider acquiring GVL from MJIT worker. + omit '[ruby-core:90895] RJIT worker may leave fd open in a forked child' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # TODO: consider acquiring GVL from RJIT worker. with_pipe {|r, w| assert_equal :wait_readable, r.read_nonblock(4096, exception: false) w.puts "HI!" @@ -2349,7 +2349,7 @@ class TestIO < Test::Unit::TestCase def test_autoclose_true_closed_by_finalizer # http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1465760 # http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1469765 - omit 'this randomly fails with MJIT' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit 'this randomly fails with RJIT' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? feature2250 = '[ruby-core:26222]' pre = 'ft2250' diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 434e720f8b..3add9b7250 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -3172,7 +3172,7 @@ class TestModule < Test::Unit::TestCase end def test_redefinition_mismatch - omit "Investigating trunk-mjit failure on ci.rvm.jp" if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit "Investigating trunk-mjit failure on ci.rvm.jp" if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? m = Module.new m.module_eval "A = 1", __FILE__, line = __LINE__ e = assert_raise_with_message(TypeError, /is not a module/) { diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 80c3c3860b..9ce5371dd0 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -510,7 +510,7 @@ class TestRubyOptimization < Test::Unit::TestCase end def test_tailcall_not_to_grow_stack - omit 'currently JIT-ed code always creates a new stack frame' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit 'currently JIT-ed code always creates a new stack frame' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? bug16161 = '[ruby-core:94881]' tailcall("#{<<-"begin;"}\n#{<<~"end;"}") diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 1d04d22631..beb181ccd4 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -272,7 +272,7 @@ class TestProcess < Test::Unit::TestCase end; end - MANDATORY_ENVS = %w[RUBYLIB MJIT_SEARCH_BUILD_DIR] + MANDATORY_ENVS = %w[RUBYLIB RJIT_SEARCH_BUILD_DIR] case RbConfig::CONFIG['target_os'] when /linux/ MANDATORY_ENVS << 'LD_PRELOAD' @@ -1717,7 +1717,7 @@ class TestProcess < Test::Unit::TestCase Process.wait pid assert_send [sig_r, :wait_readable, 5], 'self-pipe not readable' end - if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # checking -DMJIT_FORCE_ENABLE. It may trigger extra SIGCHLD. + if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # checking -DRJIT_FORCE_ENABLE. It may trigger extra SIGCHLD. assert_equal [true], signal_received.uniq, "[ruby-core:19744]" else assert_equal [true], signal_received, "[ruby-core:19744]" diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index ff3534a531..aca6608126 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -7,12 +7,12 @@ require 'tempfile' require_relative '../lib/jit_support' class TestRubyOptions < Test::Unit::TestCase - def self.mjit_enabled? = defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + def self.mjit_enabled? = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled? NO_JIT_DESCRIPTION = if mjit_enabled? - RUBY_DESCRIPTION.sub(/\+MJIT /, '') + RUBY_DESCRIPTION.sub(/\+RJIT /, '') elsif yjit_enabled? RUBY_DESCRIPTION.sub(/\+YJIT( (dev|dev_nodebug|stats))? /, '') else @@ -140,7 +140,7 @@ class TestRubyOptions < Test::Unit::TestCase VERSION_PATTERN_WITH_JIT = case RUBY_ENGINE when 'ruby' - /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+MJIT \[#{q[RUBY_PLATFORM]}\]$/ + /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \+RJIT \[#{q[RUBY_PLATFORM]}\]$/ else VERSION_PATTERN end @@ -225,8 +225,8 @@ class TestRubyOptions < Test::Unit::TestCase assert_equal([], e) end - omit "This fails on some CIs for now. To be fixed in MJIT's side." - return if RbConfig::CONFIG["MJIT_SUPPORT"] == 'no' + omit "This fails on some CIs for now. To be fixed in RJIT's side." + return if RbConfig::CONFIG["RJIT_SUPPORT"] == 'no' return if yjit_force_enabled? [ diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index f869f574a7..a30c4309ad 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -2168,9 +2168,9 @@ CODE } # it is dirty hack. usually we shouldn't use such technique Thread.pass until t.status == 'sleep' - # When MJIT thread exists, t.status becomes 'sleep' even if it does not reach m2t_q.pop. + # When RJIT thread exists, t.status becomes 'sleep' even if it does not reach m2t_q.pop. # This sleep forces it to reach m2t_q.pop for --jit-wait. - sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + sleep 1 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? t.add_trace_func proc{|ev, file, line, *args| if file == __FILE__ diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb index b8fa73cb88..b1a2ba2f1b 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -348,7 +348,7 @@ class TestShapes < Test::Unit::TestCase end def test_basic_shape_transition - omit "Failing with MJIT for some reason" if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + omit "Failing with RJIT for some reason" if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? obj = Example.new shape = RubyVM::Shape.of(obj) refute_equal(RubyVM::Shape.root_shape, shape) diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 85fbde2de8..e6f347c486 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -323,7 +323,7 @@ class TestThread < Test::Unit::TestCase s += 1 end Thread.pass until t.stop? - sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # t.stop? behaves unexpectedly with --jit-wait + sleep 1 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # t.stop? behaves unexpectedly with --jit-wait assert_equal(1, s) t.wakeup Thread.pass while t.alive? @@ -1446,8 +1446,8 @@ q.pop def test_thread_interrupt_for_killed_thread opts = { timeout: 5, timeout_error: nil } - # prevent SIGABRT from slow shutdown with MJIT - opts[:reprieve] = 3 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + # prevent SIGABRT from slow shutdown with RJIT + opts[:reprieve] = 3 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? assert_normal_exit(<<-_end, '[Bug #8996]', **opts) Thread.report_on_exception = false diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 3f7704116f..537735de4c 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -11,7 +11,7 @@ require_relative '../lib/jit_support' return unless JITSupport.yjit_supported? # Tests for YJIT with assertions on compilation and side exits -# insipired by the MJIT tests in test/ruby/test_mjit.rb +# insipired by the RJIT tests in test/ruby/test_mjit.rb class TestYJIT < Test::Unit::TestCase running_with_yjit = defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled? diff --git a/test/ruby/test_yjit_exit_locations.rb b/test/ruby/test_yjit_exit_locations.rb index 5421f9c804..851a582470 100644 --- a/test/ruby/test_yjit_exit_locations.rb +++ b/test/ruby/test_yjit_exit_locations.rb @@ -11,7 +11,7 @@ require_relative '../lib/jit_support' return unless JITSupport.yjit_supported? # Tests for YJIT with assertions on tracing exits -# insipired by the MJIT tests in test/ruby/test_yjit.rb +# insipired by the RJIT tests in test/ruby/test_yjit.rb class TestYJITExitLocations < Test::Unit::TestCase def test_yjit_trace_exits_and_v_no_error _stdout, stderr, _status = EnvUtil.invoke_ruby(%w(-v --yjit-trace-exits), '', true, true) diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb index 3dbc346271..06c3ba2ec9 100644 --- a/test/rubygems/test_gem_stream_ui.rb +++ b/test/rubygems/test_gem_stream_ui.rb @@ -4,8 +4,8 @@ require "rubygems/user_interaction" require "timeout" class TestGemStreamUI < Gem::TestCase - # increase timeout with MJIT for --jit-wait testing - mjit_enabled = defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + # increase timeout with RJIT for --jit-wait testing + mjit_enabled = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? SHORT_TIMEOUT = (RUBY_ENGINE == "ruby" && !mjit_enabled) ? 0.1 : 1.0 module IsTty diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index e3ce2b920e..edcfcdb889 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -486,7 +486,7 @@ class TestSocket < Test::Unit::TestCase end while IO.select([r], nil, nil, 0.1).nil? n end - timeout = (defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? ? 120 : 30) # for --jit-wait + timeout = (defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? ? 120 : 30) # for --jit-wait assert_equal([[s1],[],[]], IO.select([s1], nil, nil, timeout)) msg, _, _, stamp = s1.recvmsg assert_equal("a", msg) @@ -100,7 +100,7 @@ #include "vm_debug.h" #include "vm_sync.h" -#if USE_MJIT && defined(HAVE_SYS_WAIT_H) +#if USE_RJIT && defined(HAVE_SYS_WAIT_H) #include <sys/wait.h> #endif @@ -2280,7 +2280,7 @@ threadptr_get_interrupts(rb_thread_t *th) return interrupt & (rb_atomic_t)~ec->interrupt_mask; } -#if USE_MJIT +#if USE_RJIT // process.c extern bool mjit_waitpid_finished; extern int mjit_waitpid_status; @@ -2335,8 +2335,8 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing) th->status = prev_status; } -#if USE_MJIT - // Handle waitpid_signal for MJIT issued by ruby_sigchld_handler. This needs to be done +#if USE_RJIT + // Handle waitpid_signal for RJIT issued by ruby_sigchld_handler. This needs to be done // outside ruby_sigchld_handler to avoid recursively relying on the SIGCHLD handler. if (mjit_waitpid_finished && th == th->vm->ractor.main_thread) { mjit_waitpid_finished = false; @@ -4621,7 +4621,7 @@ rb_thread_atfork_internal(rb_thread_t *th, void (*atfork)(rb_thread_t *, const r rb_ractor_atfork(vm, th); - /* may be held by MJIT threads in parent */ + /* may be held by RJIT threads in parent */ rb_native_mutex_initialize(&vm->waitpid_lock); rb_native_mutex_initialize(&vm->workqueue_lock); @@ -4658,7 +4658,7 @@ rb_thread_atfork(void) /* We don't want reproduce CVE-2003-0900. */ rb_reset_random_seed(); - /* For child, starting MJIT worker thread in this place which is safer than immediately after `after_fork_ruby`. */ + /* For child, starting RJIT worker thread in this place which is safer than immediately after `after_fork_ruby`. */ mjit_child_after_fork(); } diff --git a/thread_pthread.c b/thread_pthread.c index 693d8f10e8..5de4bb3526 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -275,7 +275,7 @@ static int ubf_threads_empty(void); /* * sigwait_th is the thread which owns sigwait_fd and sleeps on it - * (using ppoll). MJIT worker can be sigwait_th==0, so we initialize + * (using ppoll). RJIT worker can be sigwait_th==0, so we initialize * it to THREAD_INVALID at startup and fork time. It is the ONLY thread * allowed to read from sigwait_fd, otherwise starvation can occur. */ diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index fdae050bb5..c646281549 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -111,8 +111,8 @@ module Test end def assert_no_memory_leak(args, prepare, code, message=nil, limit: 2.0, rss: false, **opt) - # TODO: consider choosing some appropriate limit for MJIT and stop skipping this once it does not randomly fail - pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + # TODO: consider choosing some appropriate limit for RJIT and stop skipping this once it does not randomly fail + pend 'assert_no_memory_leak may consider RJIT memory usage as leak' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? require_relative 'memory_status' raise Test::Unit::PendedError, "unsupported platform" unless defined?(Memory::Status) diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 0fa7b4c5cd..fe5c17887c 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -89,16 +89,16 @@ module Test end end - module MJITFirst + module RJITFirst def group(list) - # MJIT first + # RJIT first mjit, others = list.partition {|e| /test_mjit/ =~ e} mjit + others end end class Alpha < NoSort - include MJITFirst + include RJITFirst def sort_by_name(list) list.sort_by(&:name) @@ -112,7 +112,7 @@ module Test # shuffle test suites based on CRC32 of their names Shuffle = Struct.new(:seed, :salt) do - include MJITFirst + include RJITFirst def initialize(seed) self.class::CRC_TBL ||= (0..255).map {|i| @@ -1589,7 +1589,7 @@ module Test puts if @verbose $stdout.flush - unless defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # compiler process is wrongly considered as leak + unless defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # compiler process is wrongly considered as leak leakchecker.check("#{inst.class}\##{inst.__name__}") end diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index 131b2a311a..55e781a28e 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -63,8 +63,8 @@ File.foreach "config.status" do |line| when /^(?:X|(?:MINI|RUN|(?:HAVE_)?BASE|BOOTSTRAP|BTEST)RUBY(?:_COMMAND)?$)/; next when /^INSTALLDOC|TARGET$/; next when /^DTRACE/; next - when /^MJIT_(CC|SUPPORT)$/; # pass - when /^MJIT_/; next + when /^RJIT_(CC|SUPPORT)$/; # pass + when /^RJIT_/; next when /^(?:MAJOR|MINOR|TEENY)$/; vars[name] = val; next when /^LIBRUBY_D?LD/; next when /^RUBY_INSTALL_NAME$/; next vars[name] = (install_name = val).dup if $install_name diff --git a/tool/rjit/bindgen.rb b/tool/rjit/bindgen.rb index c4f8bff329..6ff4d67e0a 100755 --- a/tool/rjit/bindgen.rb +++ b/tool/rjit/bindgen.rb @@ -98,8 +98,8 @@ end # Convert Node objects to a Ruby binding source. class BindingGenerator - BINDGEN_BEG = '### MJIT bindgen begin ###' - BINDGEN_END = '### MJIT bindgen end ###' + BINDGEN_BEG = '### RJIT bindgen begin ###' + BINDGEN_END = '### RJIT bindgen end ###' DEFAULTS = { '_Bool' => 'CType::Bool.new' } DEFAULTS.default_proc = proc { |_h, k| "CType::Stub.new(:#{k})" } diff --git a/tool/ruby_vm/views/_leaf_helpers.erb b/tool/ruby_vm/views/_leaf_helpers.erb index ed2b5dec49..ac35df64f4 100644 --- a/tool/ruby_vm/views/_leaf_helpers.erb +++ b/tool/ruby_vm/views/_leaf_helpers.erb @@ -35,7 +35,7 @@ insn_leaf_p(VALUE insn) return rb_vm_insn_leaf_p[insn]; } -// This is used to tell MJIT that this insn would be leaf if CHECK_INTS didn't exist. +// This is used to tell RJIT that this insn would be leaf if CHECK_INTS didn't exist. // It should be used only when RUBY_VM_CHECK_INTS is directly written in insns.def. static bool leafness_of_check_ints = false; diff --git a/tool/ruby_vm/views/lib/ruby_vm/rjit/instruction.rb.erb b/tool/ruby_vm/views/lib/ruby_vm/rjit/instruction.rb.erb index 16c10a9928..1bc22de4d0 100644 --- a/tool/ruby_vm/views/lib/ruby_vm/rjit/instruction.rb.erb +++ b/tool/ruby_vm/views/lib/ruby_vm/rjit/instruction.rb.erb @@ -1,4 +1,4 @@ -module RubyVM::MJIT # :nodoc: all +module RubyVM::RJIT # :nodoc: all Instruction = Struct.new( :name, :bin, diff --git a/tool/test/testunit/test_hideskip.rb b/tool/test/testunit/test_hideskip.rb index e15947fe53..0cf8f4e4b0 100644 --- a/tool/test/testunit/test_hideskip.rb +++ b/tool/test/testunit/test_hideskip.rb @@ -6,7 +6,7 @@ class TestHideSkip < Test::Unit::TestCase assert_not_match(/^ *1\) Skipped/, hideskip) assert_match(/^ *1\) Skipped.*^ *2\) Skipped/m, hideskip("--show-skip")) output = hideskip("--hide-skip") - output.gsub!(/Successful MJIT finish\n/, '') if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + output.gsub!(/Successful RJIT finish\n/, '') if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? assert_match(/assertions\/s.\n+2 tests, 0 assertions, 0 failures, 0 errors, 2 skips/, output) end diff --git a/tool/test/testunit/test_parallel.rb b/tool/test/testunit/test_parallel.rb index 006354aee2..29176483b5 100644 --- a/tool/test/testunit/test_parallel.rb +++ b/tool/test/testunit/test_parallel.rb @@ -6,7 +6,7 @@ module TestParallel PARALLEL_RB = "#{__dir__}/../../lib/test/unit/parallel.rb" TESTS = "#{__dir__}/tests_for_parallel" # use large timeout for --jit-wait - TIMEOUT = EnvUtil.apply_timeout_scale(defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? ? 100 : 30) + TIMEOUT = EnvUtil.apply_timeout_scale(defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? ? 100 : 30) class TestParallelWorker < Test::Unit::TestCase def setup diff --git a/tool/test/webrick/test_httpserver.rb b/tool/test/webrick/test_httpserver.rb index 4133be85ad..f6b53e142b 100644 --- a/tool/test/webrick/test_httpserver.rb +++ b/tool/test/webrick/test_httpserver.rb @@ -253,7 +253,7 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase server.virtual_host(WEBrick::HTTPServer.new(vhost_config)) Thread.pass while server.status != :Running - sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait + sleep 1 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # server.status behaves unexpectedly with --jit-wait assert_equal(1, started, log.call) assert_equal(0, stopped, log.call) assert_equal(0, accepted, log.call) diff --git a/tool/test/webrick/test_server.rb b/tool/test/webrick/test_server.rb index 815cc3ce39..3bd8115c61 100644 --- a/tool/test/webrick/test_server.rb +++ b/tool/test/webrick/test_server.rb @@ -65,7 +65,7 @@ class TestWEBrickServer < Test::Unit::TestCase } TestWEBrick.start_server(Echo, config){|server, addr, port, log| true while server.status != :Running - sleep 1 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # server.status behaves unexpectedly with --jit-wait + sleep 1 if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # server.status behaves unexpectedly with --jit-wait assert_equal(1, started, log.call) assert_equal(0, stopped, log.call) assert_equal(0, accepted, log.call) @@ -71,7 +71,7 @@ const char ruby_release_date[] = RUBY_RELEASE_DATE; const char ruby_platform[] = RUBY_PLATFORM; const int ruby_patchlevel = RUBY_PATCHLEVEL; const char ruby_description[] = RUBY_DESCRIPTION_WITH(""); -static const char ruby_description_with_mjit[] = RUBY_DESCRIPTION_WITH(" +MJIT"); +static const char ruby_description_with_mjit[] = RUBY_DESCRIPTION_WITH(" +RJIT"); static const char ruby_description_with_yjit[] = RUBY_DESCRIPTION_WITH(YJIT_DESCRIPTION); const char ruby_copyright[] = "ruby - Copyright (C) " RUBY_BIRTH_YEAR_STR "-" RUBY_RELEASE_YEAR_STR " " @@ -126,10 +126,10 @@ Init_version(void) rb_provide("ruby2_keywords.rb"); } -#if USE_MJIT -#define MJIT_OPTS_ON opt->mjit.on +#if USE_RJIT +#define RJIT_OPTS_ON opt->mjit.on #else -#define MJIT_OPTS_ON 0 +#define RJIT_OPTS_ON 0 #endif #if USE_YJIT @@ -143,7 +143,7 @@ Init_ruby_description(ruby_cmdline_options_t *opt) { VALUE description; - if (MJIT_OPTS_ON) { + if (RJIT_OPTS_ON) { rb_dynamic_description = ruby_description_with_mjit; description = MKSTR(description_with_mjit); } @@ -368,9 +368,9 @@ extern VALUE rb_vm_invoke_bmethod(rb_execution_context_t *ec, rb_proc_t *proc, V const rb_callable_method_entry_t *me); static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, int kw_splat, VALUE block_handler); -#if USE_MJIT || USE_YJIT +#if USE_RJIT || USE_YJIT // Try to execute the current iseq in ec. Use JIT code if it is ready. -// If it is not, add ISEQ to the compilation queue and return Qundef for MJIT. +// If it is not, add ISEQ to the compilation queue and return Qundef for RJIT. // YJIT compiles on the thread running the iseq. static inline VALUE jit_exec(rb_execution_context_t *ec) diff --git a/vm_callinfo.h b/vm_callinfo.h index 2002718881..1edeee1f56 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -424,7 +424,7 @@ vm_cc_invalidated_p(const struct rb_callcache *cc) } } -// For MJIT. cc_cme is supposed to have inlined `vm_cc_cme(cc)`. +// For RJIT. cc_cme is supposed to have inlined `vm_cc_cme(cc)`. static inline bool vm_cc_valid_p(const struct rb_callcache *cc, const rb_callable_method_entry_t *cc_cme, VALUE klass) { @@ -503,15 +503,15 @@ struct rb_iseq_constant_body { const rb_iseq_t *mandatory_only_iseq; -#if USE_MJIT || USE_YJIT +#if USE_RJIT || USE_YJIT // Function pointer for JIT code VALUE (*jit_func)(struct rb_execution_context_struct *, struct rb_control_frame_struct *); // Number of total calls with jit_exec() long unsigned total_calls; #endif -#if USE_MJIT - // MJIT stores some data on each iseq. +#if USE_RJIT + // RJIT stores some data on each iseq. VALUE mjit_blocks; #endif diff --git a/vm_insnhelper.c b/vm_insnhelper.c index f1d50d179b..875c5491bc 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -5397,7 +5397,7 @@ vm_ic_track_const_chain(rb_control_frame_t *cfp, IC ic, const ID *segments) RB_VM_LOCK_LEAVE(); } -// For MJIT inlining +// For RJIT inlining static inline bool vm_inlined_ic_hit_p(VALUE flags, VALUE value, const rb_cref_t *ic_cref, const VALUE *reg_ep) { diff --git a/vm_insnhelper.h b/vm_insnhelper.h index db769f26e9..30139881f5 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -16,8 +16,8 @@ RUBY_EXTERN rb_serial_t ruby_vm_constant_cache_invalidations; RUBY_EXTERN rb_serial_t ruby_vm_constant_cache_misses; RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state; -#ifndef MJIT_STATS -# define MJIT_STATS RUBY_DEBUG +#ifndef RJIT_STATS +# define RJIT_STATS RUBY_DEBUG #endif #if VM_COLLECT_USAGE_DETAILS @@ -25,12 +25,12 @@ RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state; #define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op))) #define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s)) -#elif MJIT_STATS && YJIT_STATS +#elif RJIT_STATS && YJIT_STATS // Both flags could be enabled at the same time. You need to call both in that case. #define COLLECT_USAGE_INSN(insn) rb_mjit_collect_vm_usage_insn(insn); rb_yjit_collect_vm_usage_insn(insn) #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */ #define COLLECT_USAGE_REGISTER(reg, s) /* none */ -#elif MJIT_STATS +#elif RJIT_STATS // for --mjit-stats #define COLLECT_USAGE_INSN(insn) rb_mjit_collect_vm_usage_insn(insn) #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */ diff --git a/win32/Makefile.sub b/win32/Makefile.sub index ae97edcb8d..ea3b50c4ea 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -350,8 +350,8 @@ CPPFLAGS = $(DEFS) $(ARCHDEFS) $(CPPFLAGS) !if "$(USE_RUBYGEMS)" == "no" CPPFLAGS = -DDISABLE_RUBYGEMS $(CPPFLAGS) !endif -!ifndef MJIT_SUPPORT -MJIT_SUPPORT = no +!ifndef RJIT_SUPPORT +RJIT_SUPPORT = no !endif POSTLINK = @@ -930,7 +930,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub #define RUBY_COREDLL "$(RT)" #define RUBY_PLATFORM "$(arch)" #define RUBY_SITEARCH "$(sitearch)" -#define USE_MJIT 0 +#define USE_RJIT 0 #endif /* $(guard) */ << @@ -1123,7 +1123,7 @@ s,@srcdir@,$(srcdir),;t t s,@top_srcdir@,$(srcdir),;t t s,@try_header@,try_compile,;t t s,@ruby_pc@,$(ruby_pc),;t t -s,@MJIT_SUPPORT@,$(MJIT_SUPPORT),;t t +s,@RJIT_SUPPORT@,$(RJIT_SUPPORT),;t t <<KEEP !if "$(HAVE_BASERUBY)" != "yes" || "$(CROSS_COMPILING)" == "yes" diff --git a/win32/setup.mak b/win32/setup.mak index 71796eae9e..c0074bf963 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -59,8 +59,8 @@ USE_RUBYGEMS = $(USE_RUBYGEMS) !if defined(ENABLE_DEBUG_ENV) ENABLE_DEBUG_ENV = $(ENABLE_DEBUG_ENV) !endif -!if defined(MJIT_SUPPORT) -MJIT_SUPPORT = $(MJIT_SUPPORT) +!if defined(RJIT_SUPPORT) +RJIT_SUPPORT = $(RJIT_SUPPORT) !endif # TOOLS diff --git a/win32/win32.c b/win32/win32.c index b1d644929f..8c13ba7e07 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1355,7 +1355,7 @@ is_batch(const char *cmd) HANDLE rb_w32_start_process(const char *abspath, char *const *argv, int out_fd) { - /* NOTE: This function is used by MJIT worker, so it can be used parallelly with + /* NOTE: This function is used by RJIT worker, so it can be used parallelly with Ruby's main thread. So functions touching things shared with main thread can't be used, like `ALLOCV` that may trigger GC or `FindFreeChildSlot` that finds a slot from shared memory without atomic locks. */ @@ -2222,7 +2222,7 @@ rb_w32_wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen) WCHAR * rb_w32_mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen) { - /* This is used by MJIT worker. Do not trigger GC or call Ruby method here. */ + /* This is used by RJIT worker. Do not trigger GC or call Ruby method here. */ WCHAR *ptr; int len = MultiByteToWideChar(cp, 0, str, clen, NULL, 0); if (!(ptr = malloc(sizeof(WCHAR) * len))) return 0; |