summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-02-20 23:57:35 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-05 23:28:59 -0800
commit3a97d547257b304d48e6c8a1268e882f9a549d80 (patch)
tree90872fc1a5cfce5f0d9b04cdbe13d4973186f69d /lib
parent993c43e4294cf445e0422f56f1b2d3ac53aa5e84 (diff)
downloadruby-3a97d547257b304d48e6c8a1268e882f9a549d80.tar.gz
Implement adjuststack
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb14
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