From 28eb147484575525336ca5614aa387f37054f506 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 11 Dec 2018 04:13:09 +0000 Subject: [PATCH] Modify insn list only when compiling git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 0069e23774..64d4fdc3d4 100644 --- a/compile.c +++ b/compile.c @@ -487,6 +487,7 @@ static TRACE *new_trace_body(rb_iseq_t *iseq, rb_event_flag_t event, long data); static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *anchor, const NODE *n, int); static int iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor); +static int iseq_setup_insn(rb_iseq_t *iseq, LINK_ANCHOR *const anchor); static int iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *const anchor); static int iseq_insns_unification(rb_iseq_t *iseq, LINK_ANCHOR *const anchor); @@ -618,6 +619,7 @@ rb_iseq_compile_ifunc(rb_iseq_t *iseq, const struct vm_ifunc *ifunc) ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, leave); + CHECK(iseq_setup_insn(iseq, ret)); return iseq_setup(iseq, ret); } @@ -732,6 +734,7 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node) validate_labels(iseq, labels_table); } #endif + CHECK(iseq_setup_insn(iseq, ret)); return iseq_setup(iseq, ret); } @@ -1296,7 +1299,7 @@ update_catch_except_flags(struct rb_iseq_constant_body *body) } static int -iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) +iseq_setup_insn(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) { if (RTEST(ISEQ_COMPILE_DATA(iseq)->err_info)) return COMPILE_NG; @@ -1326,6 +1329,15 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) dump_disasm_list(FIRST_ELEMENT(anchor)); } + return COMPILE_OK; +} + +static int +iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) +{ + if (RTEST(ISEQ_COMPILE_DATA(iseq)->err_info)) + return COMPILE_NG; + debugs("[compile step 4.1 (iseq_set_sequence)]\n"); if (!iseq_set_sequence(iseq, anchor)) return COMPILE_NG; if (compile_debug > 5)