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

ruby-changes:9578

From: yugui <ko1@a...>
Date: Sun, 28 Dec 2008 18:41:08 +0900 (JST)
Subject: [ruby-changes:9578] Ruby:r21118 (ruby_1_9_1): merges r21088 from trunk into ruby_1_(_1.

yugui	2008-12-28 18:40:46 +0900 (Sun, 28 Dec 2008)

  New Revision: 21118

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21118

  Log:
    merges r21088 from trunk into ruby_1_(_1.
    * iseq.h, iseq.c (rb_iseq_new_main): add a type ISEQ_TYPE_MAIN.
      [ruby-dev:37619]
    * compile.c (rb_dvar_defined, ruby_iseq_compile): ditto.
    * iseq.c (iseq_data_to_ary, iseq_load): ditto.
    * compile.c (iseq_compile_each): fix to check ip->compile_data.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/compile.c
    branches/ruby_1_9_1/iseq.c
    branches/ruby_1_9_1/iseq.h

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 21117)
+++ ruby_1_9_1/ChangeLog	(revision 21118)
@@ -1,3 +1,14 @@
+Sat Dec 27 14:48:26 2008  Koichi Sasada  <ko1@a...>
+
+	* iseq.h, iseq.c (rb_iseq_new_main): add a type ISEQ_TYPE_MAIN.
+	  [ruby-dev:37619]
+
+	* compile.c (rb_dvar_defined, ruby_iseq_compile): ditto.
+
+	* iseq.c (iseq_data_to_ary, iseq_load): ditto.
+
+	* compile.c (iseq_compile_each): fix to check ip->compile_data.
+
 Sat Dec 27 14:29:33 2008  Tanaka Akira  <akr@f...>
 
 	* lib/open-uri.rb (OpenURI.redirectable?): permit https redirection.
Index: ruby_1_9_1/iseq.c
===================================================================
--- ruby_1_9_1/iseq.c	(revision 21117)
+++ ruby_1_9_1/iseq.c	(revision 21118)
@@ -316,7 +316,7 @@
     rb_thread_t *th = GET_THREAD();
     VALUE parent = th->base_block->iseq->self;
     return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), filename,
-				parent, ISEQ_TYPE_EVAL, &COMPILE_OPTION_DEFAULT);
+				parent, ISEQ_TYPE_MAIN, &COMPILE_OPTION_DEFAULT);
 }
 
 static VALUE
@@ -411,6 +411,7 @@
 	st_insert(type_map, ID2SYM(rb_intern("rescue")), ISEQ_TYPE_RESCUE);
 	st_insert(type_map, ID2SYM(rb_intern("ensure")), ISEQ_TYPE_ENSURE);
 	st_insert(type_map, ID2SYM(rb_intern("eval")), ISEQ_TYPE_EVAL);
+	st_insert(type_map, ID2SYM(rb_intern("main")), ISEQ_TYPE_MAIN);
 	st_insert(type_map, ID2SYM(rb_intern("defined_guard")), ISEQ_TYPE_DEFINED_GUARD);
     }
 
@@ -1028,6 +1029,7 @@
     DECL_SYMBOL(rescue);
     DECL_SYMBOL(ensure);
     DECL_SYMBOL(eval);
+    DECL_SYMBOL(main);
     DECL_SYMBOL(defined_guard);
 
     if (sym_top == 0) {
@@ -1042,6 +1044,7 @@
 	INIT_SYMBOL(rescue);
 	INIT_SYMBOL(ensure);
 	INIT_SYMBOL(eval);
+	INIT_SYMBOL(main);
 	INIT_SYMBOL(defined_guard);
     }
 
@@ -1054,6 +1057,7 @@
       case ISEQ_TYPE_RESCUE: type = sym_rescue; break;
       case ISEQ_TYPE_ENSURE: type = sym_ensure; break;
       case ISEQ_TYPE_EVAL:   type = sym_eval;   break;
+      case ISEQ_TYPE_MAIN:   type = sym_main;   break;
       case ISEQ_TYPE_DEFINED_GUARD: type = sym_defined_guard; break;
       default: rb_bug("unsupported iseq type");
     };
Index: ruby_1_9_1/iseq.h
===================================================================
--- ruby_1_9_1/iseq.h	(revision 21117)
+++ ruby_1_9_1/iseq.h	(revision 21118)
@@ -30,7 +30,8 @@
 #define ISEQ_TYPE_RESCUE INT2FIX(5)
 #define ISEQ_TYPE_ENSURE INT2FIX(6)
 #define ISEQ_TYPE_EVAL   INT2FIX(7)
-#define ISEQ_TYPE_DEFINED_GUARD INT2FIX(8)
+#define ISEQ_TYPE_MAIN   INT2FIX(8)
+#define ISEQ_TYPE_DEFINED_GUARD INT2FIX(9)
 
 #define CATCH_TYPE_RESCUE INT2FIX(1)
 #define CATCH_TYPE_ENSURE INT2FIX(2)
Index: ruby_1_9_1/compile.c
===================================================================
--- ruby_1_9_1/compile.c	(revision 21117)
+++ ruby_1_9_1/compile.c	(revision 21118)
@@ -469,6 +469,7 @@
 	  case ISEQ_TYPE_CLASS:
 	  case ISEQ_TYPE_BLOCK:
 	  case ISEQ_TYPE_EVAL:
+	  case ISEQ_TYPE_MAIN:
 	  case ISEQ_TYPE_TOP:
 	    rb_compile_error(ERROR_ARGS "compile/should not be reached: %s:%d",
 			     __FILE__, __LINE__);
@@ -3265,6 +3266,11 @@
 	else {
 	    rb_iseq_t *ip = iseq->parent_iseq;
 	    while (ip) {
+		if (!ip->compile_data) {
+		    ip = 0;
+		    break;
+		}
+
 		level++;
 		if (ip->compile_data->redo_label != 0) {
 		    level = 0x8000;
@@ -3281,6 +3287,7 @@
 		else if (ip->type == ISEQ_TYPE_EVAL) {
 		    goto break_in_eval;
 		}
+
 		ip = ip->parent_iseq;
 	    }
 	    COMPILE_ERROR((ERROR_ARGS "Invalid break"));
@@ -3322,6 +3329,11 @@
 	    rb_iseq_t *ip;
 	    ip = iseq;
 	    while (ip) {
+		if (!ip->compile_data) {
+		    ip = 0;
+		    break;
+		}
+
 		level = 0x8000 | 0x4000;
 		if (ip->compile_data->redo_label != 0) {
 		    /* while loop */
@@ -3333,6 +3345,7 @@
 		else if (ip->type == ISEQ_TYPE_EVAL) {
 		    goto next_in_eval;
 		}
+
 		ip = ip->parent_iseq;
 	    }
 	    if (ip != 0) {
@@ -3383,6 +3396,11 @@
 	    level = 0x8000 | 0x4000;
 	    ip = iseq;
 	    while (ip) {
+		if (!ip->compile_data) {
+		    ip = 0;
+		    break;
+		}
+
 		if (ip->compile_data->redo_label != 0) {
 		    break;
 		}
@@ -3392,6 +3410,7 @@
 		else if (ip->type == ISEQ_TYPE_EVAL) {
 		    goto redo_in_eval;
 		}
+
 		ip = ip->parent_iseq;
 	    }
 	    if (ip != 0) {
@@ -5291,7 +5310,9 @@
 	while (iseq->type == ISEQ_TYPE_BLOCK ||
 	       iseq->type == ISEQ_TYPE_RESCUE ||
 	       iseq->type == ISEQ_TYPE_ENSURE ||
-	       iseq->type == ISEQ_TYPE_EVAL) {
+	       iseq->type == ISEQ_TYPE_EVAL ||
+	       iseq->type == ISEQ_TYPE_MAIN
+	       ) {
 	    int i;
 
 	    for (i = 0; i < iseq->local_table_size; i++) {

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

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