Remove an unneeded function copy

This commit is contained in:
Takashi Kokubun 2023-04-01 23:06:45 -07:00
parent 6c55c3eb7f
commit 1b475fcd10
9 changed files with 13 additions and 25 deletions

11
array.c
View File

@ -1787,7 +1787,7 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
* Related: #push, #pop, #shift.
*/
static VALUE
VALUE
rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary)
{
long len = RARRAY_LEN(ary);
@ -1804,17 +1804,10 @@ rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary)
return ary;
}
/* non-static for yjit */
VALUE
rb_yjit_rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary)
{
return rb_ary_unshift_m(argc, argv, ary);
}
VALUE
rb_ary_unshift(VALUE ary, VALUE item)
{
return rb_ary_unshift_m(1,&item,ary);
return rb_ary_unshift_m(1, &item, ary);
}
/* faster version - use this if you don't need to treat negative offset */

View File

@ -4315,7 +4315,7 @@ module RubyVM::RJIT
asm.mov(C_ARGS[0], diff)
asm.mov(C_ARGS[1], values_ptr)
asm.mov(C_ARGS[2], array)
asm.call(C.rb_yjit_rb_ary_unshift_m)
asm.call(C.rb_ary_unshift_m)
ctx.stack_pop(diff)
stack_ret = ctx.stack_push

View File

@ -514,7 +514,7 @@ extern VALUE rb_str_bytesize(VALUE str);
extern const rb_callable_method_entry_t *rb_callable_method_entry_or_negative(VALUE klass, ID mid);
extern VALUE rb_vm_yield_with_cfunc(rb_execution_context_t *ec, const struct rb_captured_block *captured, int argc, const VALUE *argv);
extern VALUE rb_vm_set_ivar_id(VALUE obj, ID id, VALUE val);
extern VALUE rb_yjit_rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
extern VALUE rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
#include "rjit_c.rbinc"

View File

@ -543,6 +543,10 @@ module RubyVM::RJIT # :nodoc: all
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_tmp_new_from_values) }
end
def C.rb_ary_unshift_m
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_unshift_m) }
end
def C.rb_backref_get
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_backref_get) }
end
@ -731,10 +735,6 @@ module RubyVM::RJIT # :nodoc: all
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_yield_with_cfunc) }
end
def C.rb_yjit_rb_ary_unshift_m
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_yjit_rb_ary_unshift_m) }
end
def C.rjit_full_cfunc_return
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_full_cfunc_return) }
end

View File

@ -565,7 +565,7 @@ generator = BindingGenerator.new(
rb_vm_set_ivar_id
rb_ary_dup
rjit_rb_ary_subseq_length
rb_yjit_rb_ary_unshift_m
rb_ary_unshift_m
],
types: %w[
CALL_DATA

3
yjit.c
View File

@ -845,8 +845,7 @@ rb_yarv_ary_entry_internal(VALUE ary, long offset)
return rb_ary_entry_internal(ary, offset);
}
VALUE
rb_yjit_rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
extern VALUE rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
VALUE
rb_yjit_rb_ary_subseq_length(VALUE ary, long beg)

View File

@ -136,7 +136,7 @@ fn main() {
.allowlist_function("rb_ary_resurrect")
.allowlist_function("rb_ary_clear")
.allowlist_function("rb_ary_dup")
.allowlist_function("rb_yjit_rb_ary_unshift_m")
.allowlist_function("rb_ary_unshift_m")
.allowlist_function("rb_yjit_rb_ary_subseq_length")
// From internal/array.h

View File

@ -5821,7 +5821,7 @@ fn gen_send_iseq(
asm.comment("prepend stack values to rest array");
let array = asm.ccall(
rb_yjit_rb_ary_unshift_m as *const u8,
rb_ary_unshift_m as *const u8,
vec![Opnd::UImm(diff as u64), values_ptr, array],
);
ctx.stack_pop(diff as usize);

View File

@ -1296,11 +1296,7 @@ extern "C" {
pub fn rb_yarv_str_eql_internal(str1: VALUE, str2: VALUE) -> VALUE;
pub fn rb_str_neq_internal(str1: VALUE, str2: VALUE) -> VALUE;
pub fn rb_yarv_ary_entry_internal(ary: VALUE, offset: ::std::os::raw::c_long) -> VALUE;
pub fn rb_yjit_rb_ary_unshift_m(
argc: ::std::os::raw::c_int,
argv: *mut VALUE,
ary: VALUE,
) -> VALUE;
pub fn rb_ary_unshift_m(argc: ::std::os::raw::c_int, argv: *mut VALUE, ary: VALUE) -> VALUE;
pub fn rb_yjit_rb_ary_subseq_length(ary: VALUE, beg: ::std::os::raw::c_long) -> VALUE;
pub fn rb_yarv_fix_mod_fix(recv: VALUE, obj: VALUE) -> VALUE;
pub fn rb_yjit_dump_iseq_loc(iseq: *const rb_iseq_t, insn_idx: u32);