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

ruby-changes:5058

From: nobu <ko1@a...>
Date: Fri, 23 May 2008 12:24:29 +0900 (JST)
Subject: [ruby-changes:5058] Ruby:r16551 (trunk): * vm_core.h (rb_num_t): moved form vm.h.

nobu	2008-05-23 12:23:08 +0900 (Fri, 23 May 2008)

  New Revision: 16551

  Modified files:
    trunk/ChangeLog
    trunk/tool/instruction.rb
    trunk/vm.h
    trunk/vm_core.h

  Log:
    * vm_core.h (rb_num_t): moved form vm.h.
    
    * tool/instruction.rb (RubyVM::Instruction#sp_increase_c_expr),
      tool/instruction.rb (RubyVM::VmBodyGenerator#make_header_operands):
      omit unused variables.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.h?r1=16551&r2=16550&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/tool/instruction.rb?r1=16551&r2=16550&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16551&r2=16550&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_core.h?r1=16551&r2=16550&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 16550)
+++ ChangeLog	(revision 16551)
@@ -1,3 +1,11 @@
+Fri May 23 12:23:05 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_core.h (rb_num_t): moved form vm.h.
+
+	* tool/instruction.rb (RubyVM::Instruction#sp_increase_c_expr),
+	  tool/instruction.rb (RubyVM::VmBodyGenerator#make_header_operands):
+	  omit unused variables.
+
 Fri May 23 06:15:20 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* iseq.c (rb_iseq_compile_with_option): get rid of segv.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 16550)
+++ vm_core.h	(revision 16551)
@@ -88,6 +88,8 @@
 #define UNLIKELY(x) (x)
 #endif /* __GNUC__ >= 3 */
 
+typedef unsigned long rb_num_t;
+
 #define ISEQ_TYPE_TOP    INT2FIX(1)
 #define ISEQ_TYPE_METHOD INT2FIX(2)
 #define ISEQ_TYPE_BLOCK  INT2FIX(3)
Index: vm.h
===================================================================
--- vm.h	(revision 16550)
+++ vm.h	(revision 16551)
@@ -13,7 +13,6 @@
 #define RUBY_VM_H
 
 typedef long OFFSET;
-typedef unsigned long rb_num_t;
 typedef unsigned long lindex_t;
 typedef unsigned long dindex_t;
 typedef rb_num_t GENTRY;
Index: tool/instruction.rb
===================================================================
--- tool/instruction.rb	(revision 16550)
+++ tool/instruction.rb	(revision 16551)
@@ -66,13 +66,14 @@
         ret = "int inc = 0;\n"
 
         @opes.each_with_index{|(t, v), i|
-          if t == 'rb_num_t'
-            ret << "        unsigned long #{v} = FIX2INT(opes[#{i}]);\n"
+          if t == 'rb_num_t' && ((re = /\b#{v}\b/n) =~ @sp_inc ||
+                                 @defopes.any?{|t, val| re =~ val})
+            ret << "        #{t} #{v} = FIX2INT(opes[#{i}]);\n"
           end
         }
         @defopes.each_with_index{|((t, var), val), i|
-          if t == 'rb_num_t' && val != '*'
-            ret << "        unsigned long #{var} = #{val};\n"
+          if t == 'rb_num_t' && val != '*' && /\b#{var}\b/ =~ @sp_inc
+            ret << "        #{t} #{var} = #{val};\n"
           end
         }
 
@@ -707,7 +708,10 @@
           break
         end
 
-        ops << "  #{type} #{var} = (#{type})GET_OPERAND(#{i+1});"
+        re = /\b#{var}\b/n
+        if re =~ insn.body or re =~ insn.sp_inc or insn.rets.any?{|t, v| re =~ v}
+          ops << "  #{type} #{var} = (#{type})GET_OPERAND(#{i+1});"
+        end
         n   += 1
       }
       @opn = n

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

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