YJIT: Allow VM_CALL_ARGS_BLOCKARG on invokesuper (#8198)

This commit is contained in:
Takashi Kokubun 2023-08-10 08:59:52 -07:00 коммит произвёл GitHub
Родитель 5397fc315a
Коммит 92cf14b4c5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -7426,10 +7426,6 @@ fn gen_invokesuper_specialized(
gen_counter_incr(asm, Counter::invokesuper_kw_splat);
return None;
}
if ci_flags & VM_CALL_ARGS_BLOCKARG != 0 {
gen_counter_incr(asm, Counter::invokesuper_blockarg);
return None;
}
// Ensure we haven't rebound this method onto an incompatible class.
// In the interpreter we try to avoid making this check by performing some
@ -7469,13 +7465,15 @@ fn gen_invokesuper_specialized(
asm.cmp(ep_me_opnd, me_as_value.into());
asm.jne(Target::side_exit(Counter::guard_invokesuper_me_changed));
if block.is_none() {
// Guard no block passed
// gen_send_* currently support the first two branches in vm_caller_setup_arg_block:
// * VM_CALL_ARGS_BLOCKARG
// * blockiseq
if ci_flags & VM_CALL_ARGS_BLOCKARG == 0 && block.is_none() {
// TODO: gen_send_* does not support the last branch, GET_BLOCK_HANDLER().
// For now, we guard no block passed.
//
// rb_vm_frame_block_handler(GET_EC()->cfp) == VM_BLOCK_HANDLER_NONE
// note, we assume VM_ASSERT(VM_ENV_LOCAL_P(ep))
//
// TODO: this could properly forward the current block handler, but
// would require changes to gen_send_*
asm.comment("guard no block given");
let ep_specval_opnd = Opnd::mem(
64,
@ -7483,7 +7481,7 @@ fn gen_invokesuper_specialized(
SIZEOF_VALUE_I32 * VM_ENV_DATA_INDEX_SPECVAL,
);
asm.cmp(ep_specval_opnd, VM_BLOCK_HANDLER_NONE.into());
asm.jne(Target::side_exit(Counter::guard_invokesuper_block_given));
asm.jne(Target::side_exit(Counter::guard_invokesuper_block_handler));
}
// We need to assume that both our current method entry and the super

Просмотреть файл

@ -274,7 +274,6 @@ make_counters! {
send_bmethod_ractor,
send_bmethod_block_arg,
invokesuper_blockarg,
invokesuper_defined_class_mismatch,
invokesuper_kw_splat,
invokesuper_kwarg,
@ -313,7 +312,7 @@ make_counters! {
guard_send_respond_to_mid_mismatch,
guard_invokesuper_me_changed,
guard_invokesuper_block_given,
guard_invokesuper_block_handler,
guard_invokeblock_tag_changed,
guard_invokeblock_iseq_block_changed,