diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-08-17 14:09:20 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-08-17 14:25:09 +0900 |
commit | 352e923242a23ba661a8cf91e4c43c156f7d7519 (patch) | |
tree | a0f5cad5ead6738815417429a9670bff80e865c1 | |
parent | 86260ee98663f5cc600c149b8c589f1ae9b1f98a (diff) | |
download | ruby-352e923242a23ba661a8cf91e4c43c156f7d7519.tar.gz |
Revisit "Refactor to reduce "swap" instruction of pattern matching"
Just moved "case base" after allocating cache space.
-rw-r--r-- | compile.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -6333,8 +6333,6 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no INIT_ANCHOR(body_seq); INIT_ANCHOR(cond_seq); - CHECK(COMPILE(head, "case base", node->nd_head)); - branches = decl_branch_base(iseq, node, "case"); node = node->nd_body; @@ -6346,7 +6344,9 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no elselabel = NEW_LABEL(line); ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */ - ADD_INSN(head, line, swap); + + CHECK(COMPILE(head, "case base", orig_node->nd_head)); + ADD_SEQ(ret, head); /* case VAL */ while (type == NODE_IN) { |