RJIT: Propagate self's type information

This commit is contained in:
Takashi Kokubun 2023-04-03 00:49:10 -07:00
parent ca8102355a
commit 46e93ef53d

View File

@ -4799,6 +4799,16 @@ module RubyVM::RJIT
return CantCompile
end
# Create a context for the callee
callee_ctx = Context.new
recv_type = if calling.block_handler == :captured
Type::Unknown # we don't track the type information of captured->self for now
else
ctx.get_opnd_type(StackOpnd[argc])
end
callee_ctx.upgrade_opnd_type(SelfOpnd, recv_type)
# Setup the new frame
frame_type ||= C::VM_FRAME_MAGIC_METHOD | C::VM_ENV_FLAG_LOCAL
jit_push_frame(
@ -4810,9 +4820,6 @@ module RubyVM::RJIT
doing_kw_call:,
)
# Create a context for the callee
callee_ctx = Context.new
# Directly jump to the entry point of the callee
pc = (iseq.body.iseq_encoded + start_pc_offset).to_i
jit_direct_jump(iseq, pc, callee_ctx, asm)