ruby-changes:54103
From: nobu <ko1@a...>
Date: Tue, 11 Dec 2018 13:13:13 +0900 (JST)
Subject: [ruby-changes:54103] nobu:r66324 (trunk): Modify insn list only when compiling
nobu 2018-12-11 13:13:09 +0900 (Tue, 11 Dec 2018) New Revision: 66324 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66324 Log: Modify insn list only when compiling Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 66323) +++ compile.c (revision 66324) @@ -487,6 +487,7 @@ static TRACE *new_trace_body(rb_iseq_t * https://github.com/ruby/ruby/blob/trunk/compile.c#L487 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, c https://github.com/ruby/ruby/blob/trunk/compile.c#L619 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, co https://github.com/ruby/ruby/blob/trunk/compile.c#L734 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 https://github.com/ruby/ruby/blob/trunk/compile.c#L1299 } 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 https://github.com/ruby/ruby/blob/trunk/compile.c#L1329 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/