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

ruby-changes:1743

From: ko1@a...
Date: 23 Aug 2007 15:48:59 +0900
Subject: [ruby-changes:1743] nobu - Ruby:r13234 (trunk): * compile.c (make_masgn_lhs, iseq_compile_each): fixed indent.

nobu	2007-08-23 15:48:28 +0900 (Thu, 23 Aug 2007)

  New Revision: 13234

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/template/insns_info.inc.tmpl
    trunk/template/vmtc.inc.tmpl
    trunk/vm_evalbody.ci

  Log:
    * compile.c (make_masgn_lhs, iseq_compile_each): fixed indent.
    
    * compile.c (iseq_translate_threaded_code),
      vm_evalbody.ci (get_insns_address_table),
      template/vmtc.inc.tmpl (insns_address_table): constified.
    
    * vm_evalbody.ci (vm_eval),
      template/insns_info.inc.tmpl (insn_stack_increase, insn_ret_num):
      suppress warnings.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/vmtc.inc.tmpl?r1=13234&r2=13233
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=13234&r2=13233
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13234&r2=13233
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_evalbody.ci?r1=13234&r2=13233
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/insns_info.inc.tmpl?r1=13234&r2=13233

Index: vm_evalbody.ci
===================================================================
--- vm_evalbody.ci	(revision 13233)
+++ vm_evalbody.ci	(revision 13234)
@@ -102,7 +102,7 @@
 
     /* unreachable */
     rb_bug("vm_eval: unreachable");
-    return Qundef;
+    goto first;
 }
 
 #else
@@ -110,10 +110,10 @@
 #include "vm.inc"
 #include "vmtc.inc"
 
-void **
+const void *const *
 get_insns_address_table()
 {
-    return (void **)insns_address_table;
+    return insns_address_table;
 }
 
 VALUE
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13233)
+++ ChangeLog	(revision 13234)
@@ -1,3 +1,15 @@
+Thu Aug 23 15:48:26 2007  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (make_masgn_lhs, iseq_compile_each): fixed indent.
+
+	* compile.c (iseq_translate_threaded_code),
+	  vm_evalbody.ci (get_insns_address_table),
+	  template/vmtc.inc.tmpl (insns_address_table): constified.
+
+	* vm_evalbody.ci (vm_eval),
+	  template/insns_info.inc.tmpl (insn_stack_increase, insn_ret_num):
+	  suppress warnings.
+
 Thu Aug 23 13:19:43 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (f_norm_arg): check also nested arguments.  [ruby-dev:31502]
Index: compile.c
===================================================================
--- compile.c	(revision 13233)
+++ compile.c	(revision 13234)
@@ -13,6 +13,7 @@
 #include "ruby/ruby.h"
 #include "ruby/node.h"
 
+#define USE_INSN_STACK_INCREASE 1
 #include "vm_core.h"
 #include "compile.h"
 #include "insns.inc"
@@ -226,10 +227,10 @@
 #if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
 
 #if OPT_DIRECT_THREADED_CODE
-    void **table = (void **)vm_eval(0);
+    const void *const *table = (const void **)vm_eval(0);
 #else
-    extern void **get_insns_address_table();
-    void **table = get_insns_address_table();
+    extern const void *const *get_insns_address_table();
+    const void *const *table = get_insns_address_table();
 #endif
     int i;
 
@@ -1949,36 +1950,36 @@
 {
     switch (nd_type(node)) {
       case NODE_ATTRASGN: {
-	  INSN *iobj;
-	  VALUE dupidx;
+	INSN *iobj;
+	VALUE dupidx;
 
-	  COMPILE_POPED(ret, "masgn lhs (NODE_ATTRASGN)", node);
-	  POP_ELEMENT(ret);        /* pop pop insn */
-	  iobj = (INSN *)POP_ELEMENT(ret); /* pop send insn */
+	COMPILE_POPED(ret, "masgn lhs (NODE_ATTRASGN)", node);
+	POP_ELEMENT(ret);        /* pop pop insn */
+	iobj = (INSN *)POP_ELEMENT(ret); /* pop send insn */
 
-	  dupidx = iobj->operands[1];
-	  dupidx = INT2FIX(FIX2INT(dupidx) + 1);
-	  iobj->operands[1] = dupidx;
+	dupidx = iobj->operands[1];
+	dupidx = INT2FIX(FIX2INT(dupidx) + 1);
+	iobj->operands[1] = dupidx;
 
-	  ADD_INSN1(ret, nd_line(node), topn, dupidx);
-	  ADD_ELEM(ret, (LINK_ELEMENT *)iobj);
-	  ADD_INSN(ret, nd_line(node), pop);	/* result */
-	  ADD_INSN(ret, nd_line(node), pop);	/* rhs    */
-	  break;
+	ADD_INSN1(ret, nd_line(node), topn, dupidx);
+	ADD_ELEM(ret, (LINK_ELEMENT *)iobj);
+	ADD_INSN(ret, nd_line(node), pop);	/* result */
+	ADD_INSN(ret, nd_line(node), pop);	/* rhs    */
+	break;
       }
       case NODE_MASGN: {
-	  COMPILE_POPED(ret, "nest masgn lhs", node);
-	  break;
+	COMPILE_POPED(ret, "nest masgn lhs", node);
+	break;
       }
       default: {
-	  DECL_ANCHOR(anchor);
-	  INIT_ANCHOR(anchor);
-	  COMPILE_POPED(anchor, "masgn lhs", node);
-	  /* dump_disasm_list(FIRST_ELEMENT(anchor)); */
-	  REMOVE_ELEM(FIRST_ELEMENT(anchor));
-	  /* dump_disasm_list(FIRST_ELEMENT(anchor)); */
-	  ADD_SEQ(ret, anchor);
-	  /* ADD_ELEM(ret, LAST_ELEMENT(anchor)); */
+	DECL_ANCHOR(anchor);
+	INIT_ANCHOR(anchor);
+	COMPILE_POPED(anchor, "masgn lhs", node);
+	/* dump_disasm_list(FIRST_ELEMENT(anchor)); */
+	REMOVE_ELEM(FIRST_ELEMENT(anchor));
+	/* dump_disasm_list(FIRST_ELEMENT(anchor)); */
+	ADD_SEQ(ret, anchor);
+	/* ADD_ELEM(ret, LAST_ELEMENT(anchor)); */
       }
     }
 
@@ -2855,41 +2856,41 @@
       }
       case NODE_ITER:
       case NODE_FOR:{
-	  VALUE prevblock = iseq->compile_data->current_block;
-	  LABEL *retry_label = NEW_LABEL(nd_line(node));
-	  LABEL *retry_end_l = NEW_LABEL(nd_line(node));
-	  ID mid = 0;
+	VALUE prevblock = iseq->compile_data->current_block;
+	LABEL *retry_label = NEW_LABEL(nd_line(node));
+	LABEL *retry_end_l = NEW_LABEL(nd_line(node));
+	ID mid = 0;
 
-	  ADD_LABEL(ret, retry_label);
-	  if (nd_type(node) == NODE_FOR) {
-	      COMPILE(ret, "iter caller (for)", node->nd_iter);
+	ADD_LABEL(ret, retry_label);
+	if (nd_type(node) == NODE_FOR) {
+	    COMPILE(ret, "iter caller (for)", node->nd_iter);
 
-	      iseq->compile_data->current_block =
+	    iseq->compile_data->current_block =
 		NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
 				  ISEQ_TYPE_BLOCK);
 
-	      mid = idEach;
-	      ADD_SEND_R(ret, nd_line(node), ID2SYM(idEach), INT2FIX(0),
-			 iseq->compile_data->current_block, INT2FIX(0));
-	  }
-	  else {
-	      iseq->compile_data->current_block =
+	    mid = idEach;
+	    ADD_SEND_R(ret, nd_line(node), ID2SYM(idEach), INT2FIX(0),
+		       iseq->compile_data->current_block, INT2FIX(0));
+	}
+	else {
+	    iseq->compile_data->current_block =
 		NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
 				  ISEQ_TYPE_BLOCK);
-	      COMPILE(ret, "iter caller", node->nd_iter);
-	  }
-	  ADD_LABEL(ret, retry_end_l);
+	    COMPILE(ret, "iter caller", node->nd_iter);
+	}
+	ADD_LABEL(ret, retry_end_l);
 
-	  if (poped) {
-	      ADD_INSN(ret, nd_line(node), pop);
-	  }
+	if (poped) {
+	    ADD_INSN(ret, nd_line(node), pop);
+	}
 
-	  iseq->compile_data->current_block = prevblock;
+	iseq->compile_data->current_block = prevblock;
 
-	  ADD_CATCH_ENTRY(CATCH_TYPE_RETRY, retry_label, retry_end_l, 0, retry_label);
-	  ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, retry_label, retry_end_l, 0, retry_end_l);
+	ADD_CATCH_ENTRY(CATCH_TYPE_RETRY, retry_label, retry_end_l, 0, retry_label);
+	ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, retry_label, retry_end_l, 0, retry_end_l);
 
-	  break;
+	break;
       }
       case NODE_BREAK:{
 	unsigned long level = 0;
Index: template/insns_info.inc.tmpl
===================================================================
--- template/insns_info.inc.tmpl	(revision 13233)
+++ template/insns_info.inc.tmpl	(revision 13234)
@@ -23,10 +23,13 @@
 <%= operands_num_info %>
 };
 
+#ifdef USE_INSN_RET_NUM
 static int insn_stack_push_num_info[] = {
 <%= stack_num_info %>
 };
+#endif
 
+#ifdef USE_INSN_STACK_INCREASE
 static int
 insn_stack_increase(int depth, int insn, VALUE *opes)
 {
@@ -37,6 +40,7 @@
   }
   return 0;
 }
+#endif
 
 /* some utilities */
 
@@ -70,8 +74,10 @@
   }
 }
 
+#ifdef USE_INSN_RET_NUM
 static int
 insn_ret_num(int insn)
 {
   return insn_stack_push_num_info[insn];
 }
+#endif
Index: template/vmtc.inc.tmpl
===================================================================
--- template/vmtc.inc.tmpl	(revision 13233)
+++ template/vmtc.inc.tmpl	(revision 13234)
@@ -12,7 +12,7 @@
   or insns2vm.rb
  */
 
-static const void *insns_address_table[] = {
+static const void *const insns_address_table[] = {
 <%= insns_table %>
 };
 

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

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