Calling into a C func shouldn't fast path when forwarding
When we forward calls to C functions if the callsite is a forwarding site it might not always be a splat, so we can't use the fast path. Fixes: [ruby-core:118418]
This commit is contained in:
parent
4d94d28a4a
commit
cc8c4a60b7
@ -1344,3 +1344,18 @@ assert_equal 'ok', %q{
|
||||
|
||||
C.new.foo
|
||||
}
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
class C
|
||||
def initialize(a)
|
||||
end
|
||||
end
|
||||
|
||||
def foo(...)
|
||||
C.new(...)
|
||||
:ok
|
||||
end
|
||||
|
||||
foo(*["bar"])
|
||||
foo("baz")
|
||||
}
|
||||
|
@ -3907,7 +3907,7 @@ vm_call_cfunc(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb
|
||||
const struct rb_callinfo *ci = calling->cd->ci;
|
||||
RB_DEBUG_COUNTER_INC(ccf_cfunc);
|
||||
|
||||
if (IS_ARGS_SPLAT(ci)) {
|
||||
if (IS_ARGS_SPLAT(ci) && !(vm_ci_flag(ci) & VM_CALL_FORWARDING)) {
|
||||
if (!IS_ARGS_KW_SPLAT(ci) && vm_ci_argc(ci) == 1) {
|
||||
// f(*a)
|
||||
CC_SET_FASTPATH(calling->cc, vm_call_cfunc_only_splat, TRUE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user