Implement splatarray
This commit is contained in:
parent
a666079404
commit
44c4a2d80d
Notes:
git
2023-03-06 07:29:54 +00:00
@ -23,7 +23,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}")
|
||||||
|
|
||||||
# 54/101
|
# 55/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)
|
||||||
@ -57,7 +57,7 @@ module RubyVM::MJIT
|
|||||||
# duphash
|
# duphash
|
||||||
when :expandarray then expandarray(jit, ctx, asm)
|
when :expandarray then expandarray(jit, ctx, asm)
|
||||||
# concatarray
|
# concatarray
|
||||||
# splatarray
|
when :splatarray then splatarray(jit, ctx, asm)
|
||||||
# newhash
|
# newhash
|
||||||
# newrange
|
# newrange
|
||||||
when :pop then pop(jit, ctx, asm)
|
when :pop then pop(jit, ctx, asm)
|
||||||
@ -431,7 +431,31 @@ module RubyVM::MJIT
|
|||||||
end
|
end
|
||||||
|
|
||||||
# concatarray
|
# concatarray
|
||||||
# splatarray
|
|
||||||
|
# @param jit [RubyVM::MJIT::JITState]
|
||||||
|
# @param ctx [RubyVM::MJIT::Context]
|
||||||
|
# @param asm [RubyVM::MJIT::Assembler]
|
||||||
|
def splatarray(jit, ctx, asm)
|
||||||
|
flag = jit.operand(0)
|
||||||
|
|
||||||
|
# Save the PC and SP because the callee may allocate
|
||||||
|
# Note that this modifies REG_SP, which is why we do it first
|
||||||
|
jit_prepare_routine_call(jit, ctx, asm)
|
||||||
|
|
||||||
|
# Get the operands from the stack
|
||||||
|
ary_opnd = ctx.stack_pop(1)
|
||||||
|
|
||||||
|
# Call rb_vm_splat_array(flag, ary)
|
||||||
|
asm.mov(C_ARGS[0], flag)
|
||||||
|
asm.mov(C_ARGS[1], ary_opnd)
|
||||||
|
asm.call(C.rb_vm_splat_array)
|
||||||
|
|
||||||
|
stack_ret = ctx.stack_push
|
||||||
|
asm.mov(stack_ret, C_RET)
|
||||||
|
|
||||||
|
KeepCompiling
|
||||||
|
end
|
||||||
|
|
||||||
# newhash
|
# newhash
|
||||||
# newrange
|
# newrange
|
||||||
|
|
||||||
|
@ -192,6 +192,13 @@ module RubyVM::MJIT # :nodoc: all
|
|||||||
Primitive.cexpr! 'SIZET2NUM((size_t)rb_ec_ary_new_from_values)'
|
Primitive.cexpr! 'SIZET2NUM((size_t)rb_ec_ary_new_from_values)'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rb_vm_splat_array
|
||||||
|
Primitive.cstmt! %{
|
||||||
|
extern VALUE rb_vm_splat_array(VALUE flag, VALUE array);
|
||||||
|
return SIZET2NUM((size_t)rb_vm_splat_array);
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
#========================================================================================
|
#========================================================================================
|
||||||
#
|
#
|
||||||
# Old stuff
|
# Old stuff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user