mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
26 lines
531 B
Ruby
26 lines
531 B
Ruby
module RubyVM::MJIT
|
|
# ec: rdi
|
|
# cfp: rsi
|
|
# sp: rbx
|
|
# scratch regs: rax
|
|
class InsnCompiler
|
|
# 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) # rsi = cfp + 1
|
|
asm.mov([:rdi, C.rb_execution_context_t.offsetof(:cfp)], :rsi) # ec->cfp = rsi
|
|
|
|
# return a value
|
|
asm.mov(:rax, 1001)
|
|
asm.ret
|
|
EndBlock
|
|
end
|
|
end
|
|
end
|