Permalink
Browse files

better tco disable check

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5270 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent c3fac48 commit da50a49fff6b01f6e2d2b8813a0a67d83b1c7bae @lrz lrz committed Mar 10, 2011
Showing with 6 additions and 8 deletions.
  1. +5 −7 compiler.cpp
  2. +1 −1 compiler.h
View
12 compiler.cpp
@@ -3041,7 +3041,7 @@ RoxorCompiler::compile_scope(NODE *node)
}
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 @@ RoxorCompiler::compile_call(NODE *node)
}
// 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 @@ RoxorCompiler::compile_call(NODE *node)
// 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);
View
2 compiler.h
@@ -339,7 +339,7 @@ class RoxorCompiler {
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);

0 comments on commit da50a49

Please sign in to comment.