[macruby-changes] [5270] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 9 18:00:14 PST 2011


Revision: 5270
          http://trac.macosforge.org/projects/ruby/changeset/5270
Author:   lsansonetti at apple.com
Date:     2011-03-09 18:00:13 -0800 (Wed, 09 Mar 2011)
Log Message:
-----------
better tco disable check

Modified Paths:
--------------
    MacRuby/trunk/compiler.cpp
    MacRuby/trunk/compiler.h

Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp	2011-03-10 00:01:04 UTC (rev 5269)
+++ MacRuby/trunk/compiler.cpp	2011-03-10 02:00:13 UTC (rev 5270)
@@ -3041,7 +3041,7 @@
 }
 
 Value *
-RoxorCompiler::compile_call(NODE *node)
+RoxorCompiler::compile_call(NODE *node, bool use_tco)
 {
     NODE *recv = node->nd_recv;
     NODE *args = node->nd_args;
@@ -3105,8 +3105,9 @@
     }
 
     // Recursive method call optimization. Not for everyone.
-    if (!block_given && !super_call && !splat_args && !block_declaration
-	    && positive_arity && mid == current_mid && recv == NULL) {
+    if (use_tco && !block_given && !super_call && !splat_args
+	    && !block_declaration && positive_arity && mid == current_mid
+	    && recv == NULL) {
 
 	Function *f = bb->getParent();
 	const unsigned long argc = args == NULL ? 0 : args->nd_alen;
@@ -3146,10 +3147,7 @@
 
 	    // Compile regular dispatch call.
 	    bb = elseBB;
-	    ID old_current_mid = current_mid;
-	    current_mid = 0; // To force a normal dispatch compilation.
-	    Value *unoptz_value = compile_call(node);
-	    current_mid = old_current_mid;
+	    Value *unoptz_value = compile_call(node, false);
 	    elseBB = bb;
 	    BranchInst::Create(mergeBB, bb);
 

Modified: MacRuby/trunk/compiler.h
===================================================================
--- MacRuby/trunk/compiler.h	2011-03-10 00:01:04 UTC (rev 5269)
+++ MacRuby/trunk/compiler.h	2011-03-10 02:00:13 UTC (rev 5270)
@@ -339,7 +339,7 @@
 
 	Value *compile_node0(NODE *node);
 	Function *compile_scope(NODE *node);
-	Value *compile_call(NODE *node);
+	Value *compile_call(NODE *node, bool use_tco=true);
 	Value *compile_yield(NODE *node);
 	Instruction *compile_protected_call(Value *imp, Value **args_begin,
 		Value **args_end);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110309/35601834/attachment.html>


More information about the macruby-changes mailing list