summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/mjit/exit_compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-01-07 21:24:30 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 22:11:20 -0800
commitfa0b9c1c97ba1ab03e2675ce96bceda9ef046127 (patch)
tree358201d8036c7ffba93990d4c740519bebbaa8f5 /lib/ruby_vm/mjit/exit_compiler.rb
parentd09c723975a4386d283ca914a7369340fd07d925 (diff)
Initial implementation of send
Diffstat (limited to 'lib/ruby_vm/mjit/exit_compiler.rb')
-rw-r--r--lib/ruby_vm/mjit/exit_compiler.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ruby_vm/mjit/exit_compiler.rb b/lib/ruby_vm/mjit/exit_compiler.rb
index 3a0c12f525..d49a293399 100644
--- a/lib/ruby_vm/mjit/exit_compiler.rb
+++ b/lib/ruby_vm/mjit/exit_compiler.rb
@@ -24,6 +24,17 @@ module RubyVM::MJIT
asm.ret
end
+ # @param ocb [CodeBlock]
+ def compile_leave_exit(asm)
+ # Restore callee-saved registers
+ asm.pop(SP)
+ asm.pop(EC)
+ asm.pop(CFP)
+
+ # :rax is written by #leave
+ asm.ret
+ end
+
# @param jit [RubyVM::MJIT::JITState]
# @param ctx [RubyVM::MJIT::Context]
# @param asm [RubyVM::MJIT::Assembler]
@@ -44,11 +55,10 @@ module RubyVM::MJIT
asm.ret
end
- # @param jit [RubyVM::MJIT::JITState]
# @param ctx [RubyVM::MJIT::Context]
# @param asm [RubyVM::MJIT::Assembler]
# @param block_stub [RubyVM::MJIT::BlockStub]
- def compile_block_stub(jit, ctx, asm, block_stub)
+ def compile_block_stub(ctx, asm, block_stub)
# Call rb_mjit_block_stub_hit
asm.comment("block stub hit: #{block_stub.iseq.body.location.label}@#{C.rb_iseq_path(block_stub.iseq)}:#{iseq_lineno(block_stub.iseq, block_stub.pc)}")
asm.mov(:rdi, to_value(block_stub))
@@ -98,7 +108,7 @@ module RubyVM::MJIT
# @param asm [RubyVM::MJIT::Assembler]
def save_pc_and_sp(jit, ctx, asm)
# Update pc (TODO: manage PC offset?)
- asm.comment("save pc #{'and sp' if ctx.sp_offset != 0}")
+ asm.comment("save PC#{' and SP' if ctx.sp_offset != 0} to CFP")
asm.mov(:rax, jit.pc) # rax = jit.pc
asm.mov([CFP, C.rb_control_frame_t.offsetof(:pc)], :rax) # cfp->pc = rax