diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-02-20 23:57:35 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-05 23:28:59 -0800 |
commit | 3a97d547257b304d48e6c8a1268e882f9a549d80 (patch) | |
tree | 90872fc1a5cfce5f0d9b04cdbe13d4973186f69d /lib | |
parent | 993c43e4294cf445e0422f56f1b2d3ac53aa5e84 (diff) | |
download | ruby-3a97d547257b304d48e6c8a1268e882f9a549d80.tar.gz |
Implement adjuststack
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ruby_vm/mjit/insn_compiler.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb index d52c5816b1..bbb2fbf9e5 100644 --- a/lib/ruby_vm/mjit/insn_compiler.rb +++ b/lib/ruby_vm/mjit/insn_compiler.rb @@ -23,7 +23,7 @@ module RubyVM::MJIT asm.incr_counter(:mjit_insns_count) asm.comment("Insn: #{insn.name}") - # 51/101 + # 52/101 case insn.name when :nop then nop(jit, ctx, asm) when :getlocal then getlocal(jit, ctx, asm) @@ -67,7 +67,7 @@ module RubyVM::MJIT # opt_reverse # topn when :setn then setn(jit, ctx, asm) - # adjuststack + when :adjuststack then adjuststack(jit, ctx, asm) # defined # checkmatch # checkkeyword @@ -464,7 +464,15 @@ module RubyVM::MJIT KeepCompiling end - # adjuststack + # @param jit [RubyVM::MJIT::JITState] + # @param ctx [RubyVM::MJIT::Context] + # @param asm [RubyVM::MJIT::Assembler] + def adjuststack(jit, ctx, asm) + n = jit.operand(0) + ctx.stack_pop(n) + KeepCompiling + end + # defined # checkmatch # checkkeyword |