diff options
-rw-r--r-- | lib/ruby_vm/rjit/compiler.rb | 14 | ||||
-rw-r--r-- | lib/ruby_vm/rjit/insn_compiler.rb | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/lib/ruby_vm/rjit/compiler.rb b/lib/ruby_vm/rjit/compiler.rb index d69f55cefc..9e0454edaa 100644 --- a/lib/ruby_vm/rjit/compiler.rb +++ b/lib/ruby_vm/rjit/compiler.rb @@ -47,11 +47,6 @@ module RubyVM::RJIT @exit_compiler = ExitCompiler.new @insn_compiler = InsnCompiler.new(@cb, @ocb, @exit_compiler) Invariants.initialize(@cb, @ocb, self, @exit_compiler) - - @leave_exit = Assembler.new.then do |asm| - @exit_compiler.compile_leave_exit(asm) - @ocb.write(asm) - end end # Compile an ISEQ from its entry point. @@ -208,7 +203,7 @@ module RubyVM::RJIT asm.mov(SP, [CFP, C.rb_control_frame_t.offsetof(:sp)]) # rbx = cfp->sp # Setup cfp->jit_return - asm.mov(:rax, @leave_exit) + asm.mov(:rax, leave_exit) asm.mov([CFP, C.rb_control_frame_t.offsetof(:jit_return)], :rax) end @@ -265,6 +260,13 @@ module RubyVM::RJIT set_block(iseq, block) end + def leave_exit + @leave_exit ||= Assembler.new.then do |asm| + @exit_compiler.compile_leave_exit(asm) + @ocb.write(asm) + end + end + def incr_counter(name) if C.rjit_opts.stats C.rb_rjit_counters[name][0] += 1 diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb index 413d781841..761dd8f527 100644 --- a/lib/ruby_vm/rjit/insn_compiler.rb +++ b/lib/ruby_vm/rjit/insn_compiler.rb @@ -6,11 +6,6 @@ module RubyVM::RJIT @ocb = ocb @exit_compiler = exit_compiler - @full_cfunc_return = Assembler.new.then do |asm| - @exit_compiler.compile_full_cfunc_return(asm) - @ocb.write(asm) - end - @cfunc_codegen_table = {} register_cfunc_codegen_funcs # freeze # workaround a binding.irb issue. TODO: resurrect this @@ -3357,7 +3352,7 @@ module RubyVM::RJIT asm.call(:rax) # TODO: use rel32 if close enough ctx.stack_pop(1 + argc) - Invariants.record_global_inval_patch(asm, @full_cfunc_return) + Invariants.record_global_inval_patch(asm, full_cfunc_return) asm.comment('push the return value') stack_ret = ctx.stack_push @@ -3966,5 +3961,12 @@ module RubyVM::RJIT GC_REFS << obj C.to_value(obj) end + + def full_cfunc_return + @full_cfunc_return ||= Assembler.new.then do |asm| + @exit_compiler.compile_full_cfunc_return(asm) + @ocb.write(asm) + end + end end end |