mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 14:05:02 +02:00
Implement opt_newarray_min
This commit is contained in:
parent
42adcd5743
commit
357007626c
Notes:
git
2023-03-06 07:29:47 +00:00
2 changed files with 34 additions and 3 deletions
|
@ -22,7 +22,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}")
|
||||||
|
|
||||||
# 61/101
|
# 62/101
|
||||||
case insn.name
|
case insn.name
|
||||||
when :nop then nop(jit, ctx, asm)
|
when :nop then nop(jit, ctx, asm)
|
||||||
when :getlocal then getlocal(jit, ctx, asm)
|
when :getlocal then getlocal(jit, ctx, asm)
|
||||||
|
@ -81,7 +81,7 @@ module RubyVM::MJIT
|
||||||
when :opt_nil_p then opt_nil_p(jit, ctx, asm)
|
when :opt_nil_p then opt_nil_p(jit, ctx, asm)
|
||||||
# opt_str_uminus
|
# opt_str_uminus
|
||||||
# opt_newarray_max
|
# opt_newarray_max
|
||||||
# opt_newarray_min
|
when :opt_newarray_min then opt_newarray_min(jit, ctx, asm)
|
||||||
when :invokesuper then invokesuper(jit, ctx, asm)
|
when :invokesuper then invokesuper(jit, ctx, asm)
|
||||||
# invokeblock
|
# invokeblock
|
||||||
when :leave then leave(jit, ctx, asm)
|
when :leave then leave(jit, ctx, asm)
|
||||||
|
@ -725,7 +725,31 @@ module RubyVM::MJIT
|
||||||
|
|
||||||
# opt_str_uminus
|
# opt_str_uminus
|
||||||
# opt_newarray_max
|
# opt_newarray_max
|
||||||
# opt_newarray_min
|
|
||||||
|
# @param jit [RubyVM::MJIT::JITState]
|
||||||
|
# @param ctx [RubyVM::MJIT::Context]
|
||||||
|
# @param asm [RubyVM::MJIT::Assembler]
|
||||||
|
def opt_newarray_min(jit, ctx, asm)
|
||||||
|
num = jit.operand(0)
|
||||||
|
|
||||||
|
# Save the PC and SP because we may allocate
|
||||||
|
jit_prepare_routine_call(jit, ctx, asm)
|
||||||
|
|
||||||
|
offset_magnitude = C.VALUE.size * num
|
||||||
|
values_opnd = ctx.sp_opnd(-offset_magnitude)
|
||||||
|
asm.lea(:rax, values_opnd)
|
||||||
|
|
||||||
|
asm.mov(C_ARGS[0], EC)
|
||||||
|
asm.mov(C_ARGS[1], num)
|
||||||
|
asm.mov(C_ARGS[2], :rax)
|
||||||
|
asm.call(C.rb_vm_opt_newarray_min)
|
||||||
|
|
||||||
|
ctx.stack_pop(num)
|
||||||
|
stack_ret = ctx.stack_push
|
||||||
|
asm.mov(stack_ret, C_RET)
|
||||||
|
|
||||||
|
KeepCompiling
|
||||||
|
end
|
||||||
|
|
||||||
# @param jit [RubyVM::MJIT::JITState]
|
# @param jit [RubyVM::MJIT::JITState]
|
||||||
# @param ctx [RubyVM::MJIT::Context]
|
# @param ctx [RubyVM::MJIT::Context]
|
||||||
|
|
|
@ -254,6 +254,13 @@ module RubyVM::MJIT # :nodoc: all
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rb_vm_opt_newarray_min
|
||||||
|
Primitive.cstmt! %{
|
||||||
|
extern VALUE rb_vm_opt_newarray_min(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr);
|
||||||
|
return SIZET2NUM((size_t)rb_vm_opt_newarray_min);
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
#========================================================================================
|
#========================================================================================
|
||||||
#
|
#
|
||||||
# Old stuff
|
# Old stuff
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue