Refactor to reduce "swap" instruction of pattern matching

This commit is contained in:
wanabe 2020-08-16 18:53:39 +09:00
Родитель 5c40c88a3e
Коммит 3a4be429b5
1 изменённых файлов: 1 добавлений и 2 удалений

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

@ -6333,6 +6333,7 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
INIT_ANCHOR(body_seq); INIT_ANCHOR(body_seq);
INIT_ANCHOR(cond_seq); INIT_ANCHOR(cond_seq);
ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
CHECK(COMPILE(head, "case base", node->nd_head)); CHECK(COMPILE(head, "case base", node->nd_head));
branches = decl_branch_base(iseq, node, "case"); branches = decl_branch_base(iseq, node, "case");
@ -6345,8 +6346,6 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
endlabel = NEW_LABEL(line); endlabel = NEW_LABEL(line);
elselabel = NEW_LABEL(line); elselabel = NEW_LABEL(line);
ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
ADD_INSN(head, line, swap);
ADD_SEQ(ret, head); /* case VAL */ ADD_SEQ(ret, head); /* case VAL */
while (type == NODE_IN) { while (type == NODE_IN) {