summaryrefslogtreecommitdiff
path: root/lib/ruby_vm
AgeCommit message (Collapse)Author
2024-06-05merge revision(s) f8abd24b1f28998157da1230b231419ef7b81722: [Backport #20522]Takashi Kokubun
Improve YJIT performance warning regression test [Bug #20522]
2023-12-25Typofix under lib and test, tool directoriesHiroshi SHIBATA
2023-12-22RJIT: Prefer STDERR over $stderrTakashi Kokubun
When $stderr is redirected, you'll have no way to see why RJIT got broken. This reference must always be the actual stderr.
2023-12-22RJIT: Distinguish Pointer with ArrayTakashi Kokubun
This is more convenient for accessing those fields.
2023-12-21RJIT: Avoid retaining unrelated local variables in memoryTakashi Kokubun
2023-12-21RJIT: Minimize string allocations in InsnCompilerTakashi Kokubun
2023-12-21RJIT: Convert opt_case_dispatch keys with #to_valueTakashi Kokubun
comptime_key is a Ruby object and the value is not valid in machine code. This PR also implements `CMP r/m64, imm32 (Mod 01: [reg]+disp8)` that is now needed for running mail.gem benchmark.
2023-12-21RJIT: Clean up unnecessary documentationTakashi Kokubun
2023-12-21RJIT: Fix a wrong comparison in set_local_typeTakashi Kokubun
2023-12-21RJIT: Fix unwanted shadowing in set_local_typeTakashi Kokubun
local_idx should not be overwritten.
2023-12-20RJIT: Print an error message firstTakashi Kokubun
Creating a backtrace can crash if RJIT is triggered by branch_stub_hit. In that case, it's useful to at least print the error message.
2023-12-19RJIT: Avoid retaining comments unless --rjit-dump-disasmTakashi Kokubun
This significantly reduces retained objects on RJIT.
2023-12-18RJIT: Share rb_vm_insns_count for vm_insns_countTakashi Kokubun
2023-12-13RJIT: Just skip generating code for aarch64/arm64 (#9221)Takashi Kokubun
2023-12-02[Fix] Support when nil is assigned to variable `name` (#9105)jinroq
* Add `!name.nil?` to if condition
2023-11-08Refactor rb_shape_transition_shape_capa outJean Boussier
Right now the `rb_shape_get_next` shape caller need to first check if there is capacity left, and if not call `rb_shape_transition_shape_capa` before it can call `rb_shape_get_next`. And on each of these it needs to checks if we got a TOO_COMPLEX back. All this logic is duplicated in the interpreter, YJIT and RJIT. Instead we can have `rb_shape_get_next` do the capacity transition when needed. The caller can compare the old and new shapes capacity to know if resizing is needed. It also can check for TOO_COMPLEX only once.
2023-10-10Refactor rb_shape_transition_shape_capa to not accept capacityJean Boussier
This way the groth factor is encapsulated, which allows rb_shape_transition_shape_capa to be smarter about ideal sizes.
2023-08-28RJIT: Remove Type::CArray and limit use of Type::CStringAlan Wu
See previous similar YJIT commit. Notes: Merged: https://github.com/ruby/ruby/pull/8299
2023-08-08YJIT: Compile exception handlers (#8171)Takashi Kokubun
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-07-17Remove __bp__ and speed-up bmethod calls (#8060)Alan Wu
Remove rb_control_frame_t::__bp__ and optimize bmethod calls This commit removes the __bp__ field from rb_control_frame_t. It was introduced to help MJIT, but since MJIT was replaced by RJIT, we can use vm_base_ptr() to compute it from the SP of the previous control frame instead. Removing the field avoids needing to set it up when pushing new frames. Simply removing __bp__ would cause crashes since RJIT and YJIT used a slightly different stack layout for bmethod calls than the interpreter. At the moment of the call, the two layouts looked as follows: ┌────────────┐ ┌────────────┐ │ frame_base │ │ frame_base │ ├────────────┤ ├────────────┤ │ ... │ │ ... │ ├────────────┤ ├────────────┤ │ args │ │ args │ ├────────────┤ └────────────┘<─prev_frame_sp │ receiver │ prev_frame_sp─>└────────────┘ RJIT & YJIT interpreter Essentially, vm_base_ptr() needs to compute the address to frame_base given prev_frame_sp in the diagrams. The presence of the receiver created an off-by-one situation. Make the interpreter use the layout the JITs use for iseq-to-iseq bmethod calls. Doing so removes unnecessary argument shifting and vm_exec_core() re-entry from the interpreter, yielding a speed improvement visible through `benchmark/vm_defined_method.yml`: patched: 7578743.1 i/s master: 4796596.3 i/s - 1.58x slower C-to-iseq bmethod calls now store one more VALUE than before, but that should have negligible impact on overall performance. Note that re-entering vm_exec_core() used to be necessary for firing TracePoint events, but that's no longer the case since 9121e57a5f50bc91bae48b3b91edb283bf96cb6b. Closes ruby/ruby#6428
2023-07-13Remove RARRAY_CONST_PTR_TRANSIENTPeter Zhu
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT. Notes: Merged: https://github.com/ruby/ruby/pull/8071
2023-07-04YJIT: Fix autosplat miscomp for blocks with optionals (#8006)Alan Wu
* YJIT: Fix autosplat miscomp for blocks with optionals When passing an array as the sole argument to `yield`, and the yieldee takes more than 1 optional parameter, the array is expanded similar to `*array` splat calls. This is called "autosplat" in `setup_parameters_complex()`. Previously, YJIT did not detect this autosplat condition. It passed the array without expanding it, deviating from interpreter behavior. Detect this conditon and refuse to compile it. Fixes: Shopify/yjit#313 * RJIT: Fix autosplat miscomp for blocks with optionals This is mirrors the same issue as YJIT. See previous commit. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-06-06Unify length field for embedded and heap strings (#7908)Peter Zhu
* Unify length field for embedded and heap strings The length field is of the same type and position in RString for both embedded and heap allocated strings, so we can unify it. * Remove RSTRING_EMBED_LEN Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-28Update an Intel SDM link [ci skip]Takashi Kokubun
2023-04-26RJIT: Fix unspecified_bits with localsTakashi Kokubun
2023-04-18Update RJIT to support newarray_sendAaron Patterson
This also adds max / hash support Notes: Merged: https://github.com/ruby/ruby/pull/6090
2023-04-12RJIT: argc check in known cfuncsJohn Hawthorn
Notes: Merged: https://github.com/ruby/ruby/pull/7697
2023-04-05RJIT: Skip a class guard if known to be T_STRINGTakashi Kokubun
2023-04-05RJIT: Handle include_all argument of respond_to?Takashi Kokubun
2023-04-04RJIT: Remove unused variablesTakashi Kokubun
2023-04-04RJIT: Always use guard_two_fixnumsTakashi Kokubun
2023-04-04RJIT: Eliminate known-result guards for blockargTakashi Kokubun
2023-04-04RJIT: Eliminate known-result branchesTakashi Kokubun
2023-04-04RJIT: Propagate argument types on method callsTakashi Kokubun
2023-04-04RJIT: Fix mapping offsets in stack_swapTakashi Kokubun
2023-04-04[Feature #19579] Remove !USE_RVARGC code (#7655)Peter Zhu
Remove !USE_RVARGC code [Feature #19579] The Variable Width Allocation feature was turned on by default in Ruby 3.2. Since then, we haven't received bug reports or backports to the non-Variable Width Allocation code paths, so we assume that nobody is using it. We also don't plan on maintaining the non-Variable Width Allocation code, so we are going to remove it. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-04RJIT: Fix the argument of shift_stackTakashi Kokubun
2023-04-04RJIT: Fix the argument for definedTakashi Kokubun
2023-04-04RJIT: Add --rjit-verify-ctx optionTakashi Kokubun
2023-04-04RJIT: Fix arguments to SPECIAL_CONST_PTakashi Kokubun
2023-04-03RJIT: Update type information on setlocalTakashi Kokubun
2023-04-03RJIT: Fix arguments for shift_stackTakashi Kokubun
2023-04-03Fix a test_rubyoptions failureTakashi Kokubun
2023-04-03RJIT: Propagate self's type informationTakashi Kokubun
2023-04-03RJIT: Upgrade type on jit_guard_known_classTakashi Kokubun
2023-04-03RJIT: Upgrade type to Fixnum after guardTakashi Kokubun
2023-04-02RJIT: Upgrade type to String after guardTakashi Kokubun
2023-04-02RJIT: Upgrade type to Array after guardTakashi Kokubun
2023-04-02RJIT: Limit the number of versions per blockTakashi Kokubun
2023-04-02RJIT: Find a best matching block versionTakashi Kokubun