only add the trailing nop if the catch table is not break / next / redo

We don't need nop padding when the catch tables are only for break /
next / redo, so lets avoid them.  This eliminates nop padding in
many lambdas.

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
This commit is contained in:
Aaron Patterson 2021-01-12 14:47:42 -08:00 коммит произвёл Aaron Patterson
Родитель 589a8026f0
Коммит c8b47eb7c9
1 изменённых файлов: 13 добавлений и 5 удалений

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

@ -1413,6 +1413,13 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq)
LINK_ELEMENT *end = (LINK_ELEMENT *)(ptr[2] & ~1);
LINK_ELEMENT *cont = (LINK_ELEMENT *)(ptr[4] & ~1);
LINK_ELEMENT *e;
enum catch_type ct = (enum catch_type)(ptr[0] & 0xffff);
if (ct != CATCH_TYPE_BREAK
&& ct != CATCH_TYPE_NEXT
&& ct != CATCH_TYPE_REDO) {
for (e = end; e && (IS_LABEL(e) || IS_TRACE(e)); e = e->next) {
if (e == cont) {
INSN *nop = new_insn_core(iseq, 0, BIN(nop), 0, 0);
@ -1422,6 +1429,7 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq)
}
}
}
}
static int
iseq_setup_insn(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)