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

yarv-diff:378

From: ko1 atdot.net
Date: 1 Sep 2006 22:06:18 +0900
Subject: [yarv-diff:378] r545 - in trunk: . benchmark

Author: ko1
Date: 2006-09-01 22:06:17 +0900 (Fri, 01 Sep 2006)
New Revision: 545

Modified:
   trunk/ChangeLog
   trunk/benchmark/bmx_temp.rb
   trunk/compile.c
Log:
	* compile.c : fix a bug of peephole optimization and enable
	regexp optimization



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-31 10:11:51 UTC (rev 544)
+++ trunk/ChangeLog	2006-09-01 13:06:17 UTC (rev 545)
@@ -4,6 +4,12 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-09-01(Fri) 22:05:28 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* compile.c : fix a bug of peephole optimization and enable
+	regexp optimization
+
+
 2006-08-21(Mon) 05:27:48 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* lib/mathn.rb : remove "remove_method :gcd2"

Modified: trunk/benchmark/bmx_temp.rb
===================================================================
--- trunk/benchmark/bmx_temp.rb	2006-08-31 10:11:51 UTC (rev 544)
+++ trunk/benchmark/bmx_temp.rb	2006-09-01 13:06:17 UTC (rev 545)
@@ -1,5 +1,9 @@
+20000000.times{|i|
+}
+__END__
+
 i=0
-while i<10000000
+while i<20000000
   x = "foo"
   i+=1
 end

Modified: trunk/compile.c
===================================================================
--- trunk/compile.c	2006-08-31 10:11:51 UTC (rev 544)
+++ trunk/compile.c	2006-09-01 13:06:17 UTC (rev 545)
@@ -1483,7 +1483,7 @@
 	if (diobj == niobj) {
 	    REMOVE_ELEM(&iobj->link);
 	}
-	else if (diobj->insn_id == BIN(jump)) {
+	else if (iobj != diobj && diobj->insn_id == BIN(jump)) {
 	    OPERAND_AT(iobj, 0) = OPERAND_AT(diobj, 0);
 	    goto again;
 	}
@@ -3898,25 +3898,27 @@
 	  }
 
 
-#if OPT_BASIC_OPERATIONS
-	  /* TODO: detect by node */
-	  if (recv->last == recv->anchor.next &&
-	      INSN_OF(recv->last) == BIN(putobject) &&
-	      nd_type(node) == NODE_MATCH2) {
-	      ADD_SEQ(ret, val);
-	      ADD_INSN1(ret, nd_line(node), opt_regexpmatch1,
-			OPERAND_AT(recv->last, 0));
+	  if (iseq->compile_data->option->specialized_instruction) {
+	      /* TODO: detect by node */
+	      if (recv->last == recv->anchor.next &&
+		  INSN_OF(recv->last) == BIN(putobject) &&
+		  nd_type(node) == NODE_MATCH2) {
+		  ADD_SEQ(ret, val);
+		  ADD_INSN1(ret, nd_line(node), opt_regexpmatch1,
+			    OPERAND_AT(recv->last, 0));
+	      }
+	      else {
+		  ADD_SEQ(ret, recv);
+		  ADD_SEQ(ret, val);
+		  ADD_INSN(ret, nd_line(node), opt_regexpmatch2);
+	      }
 	  }
 	  else {
 	      ADD_SEQ(ret, recv);
 	      ADD_SEQ(ret, val);
-	      ADD_INSN(ret, nd_line(node), opt_regexpmatch2);
+	      ADD_SEND(ret, nd_line(node), ID2SYM(idEqTilde), INT2FIX(1));
 	  }
-#else
-	  ADD_SEQ(ret, recv);
-	  ADD_SEQ(ret, val);
-	  ADD_SEND(ret, nd_line(node), ID2SYM(idEqTilde), INT2FIX(1));
-#endif
+
 	  if (poped) {
 	      ADD_INSN(ret, nd_line(node), pop);
 	  }


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

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