YJIT: No need to reject splat+zsuper
There is nothing special about argument handling when it comes to zsuper if you look around in the VM. Everything passes removing these fallback reasons. It was ~16% on `railsbench`.
This commit is contained in:
parent
c42b1029d9
commit
bae3e5b29a
@ -2444,6 +2444,18 @@ assert_equal '[0, 2]', %q{
|
|||||||
B.new.foo
|
B.new.foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# invokesuper zsuper in a bmethod
|
||||||
|
assert_equal 'ok', %q{
|
||||||
|
class Foo
|
||||||
|
define_method(:itself) { super }
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
Foo.new.itself
|
||||||
|
rescue RuntimeError
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
# Call to fixnum
|
# Call to fixnum
|
||||||
assert_equal '[true, false]', %q{
|
assert_equal '[true, false]', %q{
|
||||||
def is_odd(obj)
|
def is_odd(obj)
|
||||||
|
@ -5887,15 +5887,6 @@ fn gen_send_cfunc(
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags & VM_CALL_ARGS_SPLAT != 0 && flags & VM_CALL_ZSUPER != 0 {
|
|
||||||
// zsuper methods are super calls without any arguments.
|
|
||||||
// They are also marked as splat, but don't actually have an array
|
|
||||||
// they pull arguments from, instead we need to change to call
|
|
||||||
// a different method with the current stack.
|
|
||||||
gen_counter_incr(asm, Counter::send_args_splat_cfunc_zuper);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let kw_arg = unsafe { vm_ci_kwarg(ci) };
|
let kw_arg = unsafe { vm_ci_kwarg(ci) };
|
||||||
let kw_arg_num = if kw_arg.is_null() {
|
let kw_arg_num = if kw_arg.is_null() {
|
||||||
0
|
0
|
||||||
@ -6425,7 +6416,6 @@ fn gen_send_iseq(
|
|||||||
exit_if_has_rest_and_supplying_kws(asm, iseq_has_rest, iseq, supplying_kws)?;
|
exit_if_has_rest_and_supplying_kws(asm, iseq_has_rest, iseq, supplying_kws)?;
|
||||||
exit_if_supplying_kw_and_has_no_kw(asm, supplying_kws, iseq)?;
|
exit_if_supplying_kw_and_has_no_kw(asm, supplying_kws, iseq)?;
|
||||||
exit_if_supplying_kws_and_accept_no_kwargs(asm, supplying_kws, iseq)?;
|
exit_if_supplying_kws_and_accept_no_kwargs(asm, supplying_kws, iseq)?;
|
||||||
exit_if_splat_and_zsuper(asm, flags)?;
|
|
||||||
exit_if_doing_kw_and_splat(asm, doing_kw_call, flags)?;
|
exit_if_doing_kw_and_splat(asm, doing_kw_call, flags)?;
|
||||||
exit_if_wrong_number_arguments(asm, arg_setup_block, opts_filled, flags, opt_num, iseq_has_rest)?;
|
exit_if_wrong_number_arguments(asm, arg_setup_block, opts_filled, flags, opt_num, iseq_has_rest)?;
|
||||||
exit_if_doing_kw_and_opts_missing(asm, doing_kw_call, opts_missing)?;
|
exit_if_doing_kw_and_opts_missing(asm, doing_kw_call, opts_missing)?;
|
||||||
@ -7327,15 +7317,6 @@ fn exit_if_supplying_kws_and_accept_no_kwargs(asm: &mut Assembler, supplying_kws
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
fn exit_if_splat_and_zsuper(asm: &mut Assembler, flags: u32) -> Option<()> {
|
|
||||||
// zsuper methods are super calls without any arguments.
|
|
||||||
// They are also marked as splat, but don't actually have an array
|
|
||||||
// they pull arguments from, instead we need to change to call
|
|
||||||
// a different method with the current stack.
|
|
||||||
exit_if(asm, flags & VM_CALL_ARGS_SPLAT != 0 && flags & VM_CALL_ZSUPER != 0, Counter::send_iseq_zsuper)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn exit_if_doing_kw_and_splat(asm: &mut Assembler, doing_kw_call: bool, flags: u32) -> Option<()> {
|
fn exit_if_doing_kw_and_splat(asm: &mut Assembler, doing_kw_call: bool, flags: u32) -> Option<()> {
|
||||||
exit_if(asm, doing_kw_call && flags & VM_CALL_ARGS_SPLAT != 0, Counter::send_iseq_splat_with_kw)
|
exit_if(asm, doing_kw_call && flags & VM_CALL_ARGS_SPLAT != 0, Counter::send_iseq_splat_with_kw)
|
||||||
|
@ -321,7 +321,6 @@ make_counters! {
|
|||||||
send_kw_splat,
|
send_kw_splat,
|
||||||
send_singleton_class,
|
send_singleton_class,
|
||||||
send_args_splat_super,
|
send_args_splat_super,
|
||||||
send_iseq_zsuper,
|
|
||||||
send_block_arg,
|
send_block_arg,
|
||||||
send_ivar_set_method,
|
send_ivar_set_method,
|
||||||
send_zsuper_method,
|
send_zsuper_method,
|
||||||
@ -378,7 +377,6 @@ make_counters! {
|
|||||||
send_args_splat_aset,
|
send_args_splat_aset,
|
||||||
send_args_splat_opt_call,
|
send_args_splat_opt_call,
|
||||||
send_args_splat_cfunc_var_args,
|
send_args_splat_cfunc_var_args,
|
||||||
send_args_splat_cfunc_zuper,
|
|
||||||
send_iseq_splat_arity_error,
|
send_iseq_splat_arity_error,
|
||||||
send_splat_too_long,
|
send_splat_too_long,
|
||||||
send_send_not_imm,
|
send_send_not_imm,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user