[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:33

From: ko1 atdot.net
Date: 29 Jun 2005 21:09:02 -0000
Subject: [yarv-diff:33] r188 - in trunk: . rb

Author: ko1
Date: 2005-06-30 06:09:01 +0900 (Thu, 30 Jun 2005)
New Revision: 188

Modified:
   trunk/ChangeLog
   trunk/depend
   trunk/extconf.rb
   trunk/opt_insn_unif.def
   trunk/opt_operand.def
   trunk/rb/insns2vm.rb
   trunk/test.rb
   trunk/vm.c
   trunk/vm.h
   trunk/yarvutil.rb
Log:
	* extconf.rb : add collect-usage-analysis option

	* opt_operand.def, opt_insn_unif.def : add some rules



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/ChangeLog	2005-06-29 21:09:01 UTC (rev 188)
@@ -4,6 +4,13 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2005-06-30(Thu) 06:07:04 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* extconf.rb : add collect-usage-analysis option
+
+	* opt_operand.def, opt_insn_unif.def : add some rules
+
+
 2005-06-29(Wed) 23:28:44 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* yarvcore.h, extconf.rb, vm.h, compile.c :

Modified: trunk/depend
===================================================================
--- trunk/depend	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/depend	2005-06-29 21:09:01 UTC (rev 188)
@@ -1,6 +1,6 @@
 compile.o:   compile.c yarvcore.h compile.h version.h debug.h insns.inc insns_info.inc optinsn.inc opt_sc.inc optunifs.inc
 disasm.o:    disasm.c yarvcore.h version.h debug.h
-vm.o:        vm.c vm.h version.h insnhelper.h insns.inc yarvcore.h debug.h vm.inc vmtc.inc $(srcdir)/vm_evalbody.h
+vm.o:        vm.c vm.h version.h insnhelper.h insns.inc yarvcore.h debug.h vm.inc vmtc.inc vm_evalbody.h
 yarvcore.o:  yarvcore.c yarvcore.h version.h debug.h rev.inc
 debug.o:     debug.h
 yarvsubst.o: yarv.h

Modified: trunk/extconf.rb
===================================================================
--- trunk/extconf.rb	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/extconf.rb	2005-06-29 21:09:01 UTC (rev 188)
@@ -15,9 +15,10 @@
   * opt-instructions-unification
   * opt-stack-caching
   * opt-inline-method-cache
-  
+
   others (default disable):
   * opt-indirect-threaded-code
+  * collect-usage-analysis
   * opt-jit-compile          (experimental, support only few insns)
   * test-aot-compile         (experimental)
   * fake-inline-method-cache (dengerous)
@@ -57,6 +58,7 @@
 
 # danger
 check_arg('opt-jit-compile', false)
+check_arg('collect-usage-analysis', false)
 check_arg('test-aot-compile', false)
 check_arg('fake-inline-method-cache', false)
 check_arg('support-goto', false)

Modified: trunk/opt_insn_unif.def
===================================================================
--- trunk/opt_insn_unif.def	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/opt_insn_unif.def	2005-06-29 21:09:01 UTC (rev 188)
@@ -13,5 +13,15 @@
 putstring setlocal
 putstring setdynamic
 
+putnil end
+
 dup setlocal
 
+# from tarai
+getlocal getlocal
+# getlocal send
+
+# from tak, ackermann
+getlocal putobject
+
+

Modified: trunk/opt_operand.def
===================================================================
--- trunk/opt_operand.def	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/opt_operand.def	2005-06-29 21:09:01 UTC (rev 188)
@@ -7,10 +7,10 @@
 #  wildcard: *
 #
 
-getlocal 1
-setlocal 1
 getlocal 2
 setlocal 2
+getlocal 3
+setlocal 3
 
 getdynamic *, 0
 getdynamic 1, 0
@@ -20,8 +20,17 @@
 putobject Qtrue
 putobject Qfalse
 
+end 5
+
+__END__
+
 send *, *, Qfalse, 0, *
+send *, 0, Qfalse, 0, *
+send *, 1, Qfalse, 0, *
+send *, 2, Qfalse, 0, *
+send *, 3, Qfalse, 0, *
 
+
 __END__
 
 

Modified: trunk/rb/insns2vm.rb
===================================================================
--- trunk/rb/insns2vm.rb	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/rb/insns2vm.rb	2005-06-29 21:09:01 UTC (rev 188)
@@ -71,9 +71,10 @@
     @insn_map = {}
     
     load_insns_def       file
-    load_opt_operand_def optopfile
-    load_insn_unification_def uniffile
-    make_stackcaching_insns if $opts['OPT_STACK_CACHING']
+    
+    load_opt_operand_def optopfile     if $opts['OPT_OPERANDS_UNIFICATION']
+    load_insn_unification_def uniffile if $opts['OPT_INSTRUCTIONS_UNIFICATION']
+    make_stackcaching_insns            if $opts['OPT_STACK_CACHING']
   end
 
   attr_reader :insns

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/test.rb	2005-06-29 21:09:01 UTC (rev 188)
@@ -9,6 +9,108 @@
 ###########################################################
 $prog =<<'__EOP__'
 
+def m
+end
+
+i=0
+while i<10000
+  i+=1
+  m; m; m; m; m; m; m; m; m; m
+end
+__END__
+
+#!/usr/bin/ruby
+# -*- mode: ruby -*-
+# $Id: matrix-ruby.code,v 1.4 2004/11/13 07:42:14 bfulgham Exp $
+# http://www.bagley.org/~doug/shootout/
+
+n = 3 #Integer(ARGV.shift || 1)
+
+size = 30
+
+def mkmatrix(rows, cols)
+    count = 1
+    mx = Array.new(rows)
+    (0 .. (rows - 1)).each do |bi|
+        row = Array.new(cols, 0)
+        (0 .. (cols - 1)).each do |j|
+            row[j] = count
+            count += 1
+        end
+        mx[bi] = row
+    end
+    mx
+end
+
+def mmult(rows, cols, m1, m2)
+    m3 = Array.new(rows)
+    (0 .. (rows - 1)).each do |bi|
+        row = Array.new(cols, 0)
+        (0 .. (cols - 1)).each do |j|
+            val = 0
+            (0 .. (cols - 1)).each do |k|
+                val += m1.at(bi).at(k) * m2.at(k).at(j)
+            end
+            row[j] = val
+        end
+        m3[bi] = row
+    end
+    m3
+end
+
+m1 = mkmatrix(size, size)
+m2 = mkmatrix(size, size)
+mm = Array.new
+n.times do
+    mm = mmult(size, size, m1, m2)
+end
+# puts "#{mm[0][0]} #{mm[2][3]} #{mm[3][2]} #{mm[4][4]}"
+
+
+
+__END__
+def ack(m, n)
+    if m == 0 then
+        n + 1
+    elsif n == 0 then
+        ack(m - 1, 1)
+    else
+        ack(m - 1, ack(m, n - 1))
+    end
+end
+
+NUM = 4
+ack(3, NUM)
+
+__END__
+
+def tak x, y, z
+  unless y < x
+    z
+  else
+    tak( tak(x-1, y, z),
+         tak(y-1, z, x),
+         tak(z-1, x, y))
+  end
+end
+
+tak(9, 6, 0)
+
+
+
+__END__
+
+def tarai( x, y, z )
+  if x <= y
+  then y
+  else tarai(tarai(x-1, y, z),
+             tarai(y-1, z, x),
+             tarai(z-1, x, y))
+  end
+end
+
+tarai(6, 3, 0)
+__END__
 p :a, :b
 p 1+2
 p(/a/ =~ 'b')

Modified: trunk/vm.c
===================================================================
--- trunk/vm.c	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/vm.c	2005-06-29 21:09:01 UTC (rev 188)
@@ -16,8 +16,10 @@
  */
 
 void stack_dump_thobj(struct thread_object *thobj);
+void vm_analysis_operand(int insn, int n, VALUE op);
+void vm_analysis_register(int reg, int isset);
+void vm_analysis_insn(int insn);
 
-
 #ifdef __GCC__
 
 #define LIKELY(x)   (__builtin_expect(x, 1))

Modified: trunk/vm.h
===================================================================
--- trunk/vm.h	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/vm.h	2005-06-29 21:09:01 UTC (rev 188)
@@ -32,9 +32,9 @@
 //#define VMDEBUG 5
 //#define VMDEBUG 10
 
-//#define COLLECT_USAGE_ANALYSIS
+// #define COLLECT_USAGE_ANALYSIS
 
-#ifdef COLLECT_USAGE_ANALYSIS
+#ifdef  COLLECT_USAGE_ANALYSIS
 #define USAGE_ANALYSIS_INSN(insn)           vm_analysis_insn(insn)
 #define USAGE_ANALYSIS_OPERAND(insn, n, op) vm_analysis_operand(insn, n, (VALUE)op)
 #define USAGE_ANALYSIS_REGISTER(reg, s)     vm_analysis_register(reg, s)

Modified: trunk/yarvutil.rb
===================================================================
--- trunk/yarvutil.rb	2005-06-29 14:32:14 UTC (rev 187)
+++ trunk/yarvutil.rb	2005-06-29 21:09:01 UTC (rev 188)
@@ -56,10 +56,11 @@
 
   def self.dump_usage_analisys
     return if YARVCore::USAGE_ANALISYS_INSN.size == 0
+    
     YARVCore::USAGE_ANALISYS_INSN.sort.each{|insn_no, iinfo|
       puts "#{YARVCore::InsnNameArray[insn_no]}\t#{iinfo[-1]}"
     }
-    return
+    # return
     puts "----------------"
     puts "= Usage Analisys"
     puts


--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]