mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
Initial support for setivar
This commit is contained in:
parent
eac44ec212
commit
dcdffb1aa0
2 changed files with 32 additions and 3 deletions
|
@ -18,7 +18,7 @@ module RubyVM::MJIT
|
||||||
asm.incr_counter(:mjit_insns_count)
|
asm.incr_counter(:mjit_insns_count)
|
||||||
asm.comment("Insn: #{insn.name}")
|
asm.comment("Insn: #{insn.name}")
|
||||||
|
|
||||||
# 26/101
|
# 28/101
|
||||||
case insn.name
|
case insn.name
|
||||||
when :nop then nop(jit, ctx, asm)
|
when :nop then nop(jit, ctx, asm)
|
||||||
# getlocal
|
# getlocal
|
||||||
|
@ -29,7 +29,7 @@ module RubyVM::MJIT
|
||||||
# getspecial
|
# getspecial
|
||||||
# setspecial
|
# setspecial
|
||||||
when :getinstancevariable then getinstancevariable(jit, ctx, asm)
|
when :getinstancevariable then getinstancevariable(jit, ctx, asm)
|
||||||
# setinstancevariable
|
when :setinstancevariable then setinstancevariable(jit, ctx, asm)
|
||||||
# getclassvariable
|
# getclassvariable
|
||||||
# setclassvariable
|
# setclassvariable
|
||||||
# opt_getconstant_path
|
# opt_getconstant_path
|
||||||
|
@ -163,7 +163,29 @@ module RubyVM::MJIT
|
||||||
jit_getivar(jit, ctx, asm, comptime_obj, id)
|
jit_getivar(jit, ctx, asm, comptime_obj, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# setinstancevariable
|
# @param jit [RubyVM::MJIT::JITState]
|
||||||
|
# @param ctx [RubyVM::MJIT::Context]
|
||||||
|
# @param asm [RubyVM::MJIT::Assembler]
|
||||||
|
def setinstancevariable(jit, ctx, asm)
|
||||||
|
id = jit.operand(0)
|
||||||
|
ivc = jit.operand(1)
|
||||||
|
|
||||||
|
# rb_vm_setinstancevariable could raise exceptions
|
||||||
|
jit_prepare_routine_call(jit, ctx, asm)
|
||||||
|
|
||||||
|
val_opnd = ctx.stack_pop
|
||||||
|
|
||||||
|
asm.comment('rb_vm_setinstancevariable')
|
||||||
|
asm.mov(:rdi, jit.iseq.to_i)
|
||||||
|
asm.mov(:rsi, [CFP, C.rb_control_frame_t.offsetof(:self)])
|
||||||
|
asm.mov(:rdx, id)
|
||||||
|
asm.mov(:rcx, val_opnd)
|
||||||
|
asm.mov(:r8, ivc)
|
||||||
|
asm.call(C.rb_vm_setinstancevariable)
|
||||||
|
|
||||||
|
KeepCompiling
|
||||||
|
end
|
||||||
|
|
||||||
# getclassvariable
|
# getclassvariable
|
||||||
# setclassvariable
|
# setclassvariable
|
||||||
# opt_getconstant_path
|
# opt_getconstant_path
|
||||||
|
|
|
@ -131,6 +131,13 @@ module RubyVM::MJIT # :nodoc: all
|
||||||
Primitive.cexpr! 'SIZET2NUM((size_t)rb_hash_aref)'
|
Primitive.cexpr! 'SIZET2NUM((size_t)rb_hash_aref)'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rb_vm_setinstancevariable
|
||||||
|
Primitive.cstmt! %{
|
||||||
|
extern void rb_vm_setinstancevariable(const rb_iseq_t *iseq, VALUE obj, ID id, VALUE val, IVC ic);
|
||||||
|
return SIZET2NUM((size_t)rb_vm_setinstancevariable);
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
#========================================================================================
|
#========================================================================================
|
||||||
#
|
#
|
||||||
# Old stuff
|
# Old stuff
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue