[前][次][番号順一覧][スレッド一覧]

ruby-changes:5073

From: mame <ko1@a...>
Date: Sat, 24 May 2008 15:30:13 +0900 (JST)
Subject: [ruby-changes:5073] Ruby:r16568 (trunk): * compile.c (iseq_set_exception_table, NODE_WHILE, NODE_NEXT): remove

mame	2008-05-24 15:29:48 +0900 (Sat, 24 May 2008)

  New Revision: 16568

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/vm.c
    trunk/vm_insnhelper.c

  Log:
    * 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.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=16568&r2=16567&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16568&r2=16567&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=16568&r2=16567&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_insnhelper.c?r1=16568&r2=16567&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 16567)
+++ ChangeLog	(revision 16568)
@@ -1,3 +1,10 @@
+Sat May 24 15:26:16 2008  Yusuke Endoh  <mame@t...>
+
+	* 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@r...>
 
 	* transcode.c (rb_str_transcode): argc is 1, and argv is &to.
Index: compile.c
===================================================================
--- compile.c	(revision 16567)
+++ compile.c	(revision 16568)
@@ -1317,8 +1317,7 @@
 	    /* 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 @@
 	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 @@
 	    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 @@
 
 	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 @@
 	    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) {
Index: vm.c
===================================================================
--- vm.c	(revision 16567)
+++ vm.c	(revision 16568)
@@ -1259,9 +1259,7 @@
 			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 @@
 	}
 	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 {
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 16567)
+++ vm_insnhelper.c	(revision 16568)
@@ -1204,12 +1204,7 @@
 	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) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]