diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-17 07:16:50 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-17 07:16:50 +0000 |
commit | e88fd0606b00c6f796d6ce341f400c9f90b90ca1 (patch) | |
tree | 34d8a99e6da9eb95e645116f0f27a14c04b1f60c | |
parent | 1b43644edc85a93bfc9228588c065c87f975cd93 (diff) |
Remove the level information from throw instruction
It is no longer used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | compile.c | 17 | ||||
-rw-r--r-- | vm_core.h | 1 | ||||
-rw-r--r-- | vm_insnhelper.c | 10 |
3 files changed, 9 insertions, 19 deletions
@@ -5361,7 +5361,7 @@ static int compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped) { const int line = nd_line(node); - unsigned long level = 0; + unsigned long throw_flag = 0; if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) { /* while/until */ @@ -5382,7 +5382,7 @@ compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, i break_by_insn: /* escape from block */ CHECK(COMPILE(ret, "break val (block)", node->nd_stts)); - ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_BREAK)); + ADD_INSN1(ret, line, throw, INT2FIX(throw_flag | TAG_BREAK)); if (popped) { ADD_INSN(ret, line, pop); } @@ -5401,13 +5401,11 @@ compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, i break; } - level++; if (ISEQ_COMPILE_DATA(ip)->redo_label != 0) { - level = VM_THROW_NO_ESCAPE_FLAG; + throw_flag = VM_THROW_NO_ESCAPE_FLAG; goto break_by_insn; } else if (ip->body->type == ISEQ_TYPE_BLOCK) { - level <<= VM_THROW_LEVEL_SHIFT; goto break_by_insn; } else if (ip->body->type == ISEQ_TYPE_EVAL) { @@ -5426,7 +5424,7 @@ static int compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped) { const int line = nd_line(node); - unsigned long level = 0; + unsigned long throw_flag = 0; if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) { LABEL *splabel = NEW_LABEL(0); @@ -5470,7 +5468,7 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in break; } - level = VM_THROW_NO_ESCAPE_FLAG; + throw_flag = VM_THROW_NO_ESCAPE_FLAG; if (ISEQ_COMPILE_DATA(ip)->redo_label != 0) { /* while loop */ break; @@ -5486,7 +5484,7 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in } if (ip != 0) { CHECK(COMPILE(ret, "next val", node->nd_stts)); - ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_NEXT)); + ADD_INSN1(ret, line, throw, INT2FIX(throw_flag | TAG_NEXT)); if (popped) { ADD_INSN(ret, line, pop); @@ -5538,7 +5536,6 @@ compile_redo(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in } else { const rb_iseq_t *ip = iseq; - const unsigned long level = VM_THROW_NO_ESCAPE_FLAG; while (ip) { if (!ISEQ_COMPILE_DATA(ip)) { @@ -5560,7 +5557,7 @@ compile_redo(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in } if (ip != 0) { ADD_INSN(ret, line, putnil); - ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_REDO)); + ADD_INSN1(ret, line, throw, INT2FIX(VM_THROW_NO_ESCAPE_FLAG | TAG_REDO)); if (popped) { ADD_INSN(ret, line, pop); @@ -194,7 +194,6 @@ enum ruby_tag_type { enum ruby_vm_throw_flags { VM_THROW_NO_ESCAPE_FLAG = 0x8000, - VM_THROW_LEVEL_SHIFT = 16, VM_THROW_STATE_MASK = 0xff }; diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 7bc868d497..16152a9ba3 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1086,7 +1086,7 @@ vm_throw_continue(const rb_execution_context_t *ec, VALUE err) static VALUE vm_throw_start(const rb_execution_context_t *ec, rb_control_frame_t *const reg_cfp, enum ruby_tag_type state, - const int flag, const rb_num_t level, const VALUE throwobj) + const int flag, const VALUE throwobj) { const rb_control_frame_t *escape_cfp = NULL; const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(ec); /* end of control frame pointer */ @@ -1154,13 +1154,8 @@ vm_throw_start(const rb_execution_context_t *ec, rb_control_frame_t *const reg_c } } else if (state == TAG_RETRY) { - rb_num_t i; const VALUE *ep = VM_ENV_PREV_EP(GET_EP()); - for (i = 0; i < level; i++) { - ep = VM_ENV_PREV_EP(ep); - } - escape_cfp = rb_vm_search_cf_from_ep(ec, reg_cfp, ep); } else if (state == TAG_RETURN) { @@ -1244,10 +1239,9 @@ vm_throw(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, { const int state = (int)(throw_state & VM_THROW_STATE_MASK); const int flag = (int)(throw_state & VM_THROW_NO_ESCAPE_FLAG); - const rb_num_t level = throw_state >> VM_THROW_LEVEL_SHIFT; if (state != 0) { - return vm_throw_start(ec, reg_cfp, state, flag, level, throwobj); + return vm_throw_start(ec, reg_cfp, state, flag, throwobj); } else { return vm_throw_continue(ec, throwobj); |