compile_call: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
This commit is contained in:
卜部昌平 2020-06-12 13:45:01 +09:00
Родитель aa2cb7f722
Коммит a8d992ac00
1 изменённых файлов: 9 добавлений и 10 удалений

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

@ -7290,16 +7290,10 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
if (bf == NULL) {
if (strcmp("cstmt!", builtin_func) == 0 ||
strcmp("cexpr!", builtin_func) == 0) {
inlinec:;
int inline_index = GET_VM()->builtin_inline_index++;
snprintf(inline_func, 0x20, "_bi%d", inline_index);
builtin_func = inline_func;
args_node = NULL;
goto retry;
// ok
}
else if (strcmp("cconst!", builtin_func) == 0) {
cconst = true;
goto inlinec;
}
else if (strcmp("cinit!", builtin_func) == 0) {
// ignore
@ -7311,16 +7305,21 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
iseq->body->builtin_inline_p = true;
return COMPILE_OK;
}
if (1) {
else if (1) {
rb_bug("can't find builtin function:%s", builtin_func);
}
else {
COMPILE_ERROR(ERROR_ARGS "can't find builtin function:%s", builtin_func);
}
return COMPILE_NG;
}
int inline_index = GET_VM()->builtin_inline_index++;
snprintf(inline_func, 0x20, "_bi%d", inline_index);
builtin_func = inline_func;
args_node = NULL;
goto retry;
}
if (cconst) {
typedef VALUE(*builtin_func0)(void *, VALUE);
VALUE const_val = (*(builtin_func0)bf->func_ptr)(NULL, Qnil);