diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-05-02 21:16:27 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-05-02 21:16:27 +0000 |
commit | 6610b77ea85302e33d8cb0a2a082f8bd2b3e2f40 (patch) | |
tree | aca5fdbf32de49da0ec5ea9a2b241bac65a9fb35 /compile.c | |
parent | 764fe09a4b29a4df1163e1dcb3952628db1f6974 (diff) |
merge revision(s) 66324: [Backport #15385]
Modify insn list only when compiling
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -482,6 +482,7 @@ static TRACE *new_trace_body(rb_iseq_t *iseq, rb_event_flag_t event); 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); @@ -611,6 +612,20 @@ validate_labels(rb_iseq_t *iseq, st_table *labels_table) } VALUE +rb_iseq_compile_ifunc(rb_iseq_t *iseq, const struct vm_ifunc *ifunc) +{ + DECL_ANCHOR(ret); + INIT_ANCHOR(ret); + + (*ifunc->func)(iseq, ret, ifunc->data); + + ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, leave); + + CHECK(iseq_setup_insn(iseq, ret)); + return iseq_setup(iseq, ret); +} + +VALUE rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node) { DECL_ANCHOR(ret); @@ -723,6 +738,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); } @@ -1248,7 +1264,7 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq) } 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; @@ -1281,6 +1297,15 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) debugs("[compile step 3.4 (iseq_insert_nop_between_end_and_cont)]\n"); iseq_insert_nop_between_end_and_cont(iseq); + 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) |