1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* compile.c (iseq_set_exception_table, NODE_WHILE, NODE_NEXT): remove

special handling that decrements sp in CATCH_TYPE_NEXT for NODE_WHILE.

* vm.c (vm_eval_body), vm_insnhelper.c (vm_throw): remove unused code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-05-24 06:29:48 +00:00
parent f52d9a169b
commit 956dead480
4 changed files with 26 additions and 18 deletions

View file

@ -1,3 +1,10 @@
Sat May 24 15:26:16 2008 Yusuke Endoh <mame@tsg.ne.jp>
* compile.c (iseq_set_exception_table, NODE_WHILE, NODE_NEXT): remove
special handling that decrements sp in CATCH_TYPE_NEXT for NODE_WHILE.
* vm.c (vm_eval_body), vm_insnhelper.c (vm_throw): remove unused code.
Sat May 24 08:13:34 2008 NARUSE, Yui <naruse@ruby-lang.org>
* transcode.c (rb_str_transcode): argc is 1, and argv is &to.

View file

@ -1317,8 +1317,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
/* TODO: Dirty Hack! Fix me */
if (entry->type == CATCH_TYPE_RESCUE ||
entry->type == CATCH_TYPE_BREAK ||
(((ptr[0] & 0x10000) == 0)
&& entry->type == CATCH_TYPE_NEXT)) {
entry->type == CATCH_TYPE_NEXT) {
entry->sp--;
}
}
@ -2935,12 +2934,24 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(nd_line(node)); /* break */
LABEL *end_label = NEW_LABEL(nd_line(node));
LABEL *next_catch_label = NEW_LABEL(nd_line(node));
LABEL *tmp_label = NULL;
iseq->compile_data->loopval_popped = 0;
iseq->compile_data->ensure_node_stack = 0;
if (type == NODE_OPT_N || node->nd_state == 1) {
ADD_INSNL(ret, nd_line(node), jump, next_label);
}
else {
tmp_label = NEW_LABEL(nd_line(node));
ADD_INSNL(ret, nd_line(node), jump, tmp_label);
}
ADD_INSN(ret, nd_line(node), putnil);
ADD_LABEL(ret, next_catch_label);
ADD_INSN(ret, nd_line(node), pop);
ADD_INSNL(ret, nd_line(node), jump, next_label);
if (tmp_label) ADD_LABEL(ret, tmp_label);
ADD_LABEL(ret, redo_label);
COMPILE_POPED(ret, "while body", node->nd_body);
@ -2972,7 +2983,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, nd_line(node), putnil);
}
ADD_LABEL(ret, break_label); /* braek */
ADD_LABEL(ret, break_label); /* break */
if (poped) {
ADD_INSN(ret, nd_line(node), pop);
@ -2980,8 +2991,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, redo_label, break_label,
0, break_label);
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT | 0x10000, redo_label,
break_label, 0, iseq->compile_data->start_label);
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, redo_label, break_label, 0,
next_catch_label);
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, redo_label, break_label, 0,
iseq->compile_data->redo_label);
@ -3119,13 +3130,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
rb_iseq_t *ip;
ip = iseq;
while (ip) {
level = 0x8000;
level = 0x8000 | 0x4000;
if (ip->compile_data->redo_label != 0) {
/* while loop */
break;
}
else if (ip->type == ISEQ_TYPE_BLOCK) {
level |= 0x4000;
break;
}
else if (ip->type == ISEQ_TYPE_EVAL) {

6
vm.c
View file

@ -1259,9 +1259,7 @@ vm_eval_body(rb_thread_t *th)
cfp->pc = cfp->iseq->iseq_encoded + entry->cont;
cfp->sp = cfp->bp + entry->sp;
if (!(state == TAG_REDO) &&
!(state == TAG_NEXT && !escape_dfp) &&
!(state == TAG_BREAK && !escape_dfp)) {
if (state != TAG_REDO) {
#if OPT_STACK_CACHING
initial = (GET_THROWOBJ_VAL(err));
#else
@ -1276,12 +1274,10 @@ vm_eval_body(rb_thread_t *th)
}
else if (state == TAG_REDO) {
type = CATCH_TYPE_REDO;
escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
goto search_restart_point;
}
else if (state == TAG_NEXT) {
type = CATCH_TYPE_NEXT;
escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
goto search_restart_point;
}
else {

View file

@ -1204,12 +1204,7 @@ vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
VALUE *pt = 0;
int i;
if (flag != 0) {
if (throw_state & 0x4000) {
pt = (void *)1;
}
else {
pt = 0;
}
pt = (void *) 1;
}
else {
if (state == TAG_BREAK) {