summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-24 06:29:48 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-24 06:29:48 +0000
commit956dead48069a07eb1211283ae5b276ef45f6768 (patch)
treea674d5c63e71b3e1d0544c31786f1f0c52272d30
parentf52d9a169ba5129554f02cbf0a68f48a3c288b1e (diff)
* 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
-rw-r--r--ChangeLog7
-rw-r--r--compile.c24
-rw-r--r--vm.c6
-rw-r--r--vm_insnhelper.c7
4 files changed, 26 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index d0893e37e7..8fbebd7b1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/compile.c b/compile.c
index ec8b26f33b..1e7041a592 100644
--- a/compile.c
+++ b/compile.c
@@ -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) {
diff --git a/vm.c b/vm.c
index 708a6ac76b..c97cd2b3c2 100644
--- a/vm.c
+++ b/vm.c
@@ -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 {
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index bf9ded1313..6fb867a9b9 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -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) {