diff options
author | Takashi Kokubun <[email protected]> | 2022-12-20 21:54:54 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-03-05 22:11:20 -0800 |
commit | 145c937f3f9600166de7c4c3aceb724d8218cfeb (patch) | |
tree | f15efeaab42ac6a7bb78888a9aab44181b77c179 /lib/mjit/insn_compiler.rb | |
parent | 8deb0438c48c7c140a1aec1eef055d972aff7507 (diff) |
Compile putnil properly
Diffstat (limited to 'lib/mjit/insn_compiler.rb')
-rw-r--r-- | lib/mjit/insn_compiler.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/mjit/insn_compiler.rb b/lib/mjit/insn_compiler.rb index c6f88b37fb..4dbb19a96e 100644 --- a/lib/mjit/insn_compiler.rb +++ b/lib/mjit/insn_compiler.rb @@ -1,14 +1,21 @@ module RubyVM::MJIT + # ec: rdi + # cfp: rsi + # sp: rbx + # scratch regs: rax class InsnCompiler - def putnil(_asm) - # TODO + # Ruby constants + Qnil = Fiddle::Qnil + + def putnil(asm) + asm.mov([:rbx], Qnil) KeepCompiling end def leave(asm) # pop the current frame (ec->cfp++) - asm.add(:rsi, C.rb_control_frame_t.size) - asm.mov([:rdi, C.rb_execution_context_t.offsetof(:cfp)], :rsi) + asm.add(:rsi, C.rb_control_frame_t.size) # rsi = cfp + 1 + asm.mov([:rdi, C.rb_execution_context_t.offsetof(:cfp)], :rsi) # ec->cfp = rsi # return a value asm.mov(:rax, 1001) |