aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ruby_vm
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-04-03 00:49:32 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-04-04 22:13:25 -0700
commite06bebff5ef57dd4c32acb77001df230520c5449 (patch)
tree9002983dec7d8f6a0379671220955af14741a0bf /lib/ruby_vm
parent6d8875b5d7f8dc4a6435e6fd10c73a1b42541fab (diff)
downloadruby-e06bebff5ef57dd4c32acb77001df230520c5449.tar.gz
RJIT: Propagate argument types on method calls
Diffstat (limited to 'lib/ruby_vm')
-rw-r--r--lib/ruby_vm/rjit/insn_compiler.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb
index 6bb802150a..10222bd8f4 100644
--- a/lib/ruby_vm/rjit/insn_compiler.rb
+++ b/lib/ruby_vm/rjit/insn_compiler.rb
@@ -4815,6 +4815,13 @@ module RubyVM::RJIT
# Create a context for the callee
callee_ctx = Context.new
+ # Set the argument types in the callee's context
+ argc.times do |arg_idx|
+ stack_offs = argc - arg_idx - 1
+ arg_type = ctx.get_opnd_type(StackOpnd[stack_offs])
+ callee_ctx.set_local_type(arg_idx, arg_type)
+ end
+
recv_type = if calling.block_handler == :captured
Type::Unknown # we don't track the type information of captured->self for now
else