# HG changeset patch # User Christian Humer # Date 1395171391 -3600 # Node ID d5cae569831649ec4a4a040f93647c88e966817e # Parent fdabadc7980d2dfa866503922a00b531697275cf Truffle: fixed indefinite splitting of recursive calls. diff -r fdabadc7980d -r d5cae5698316 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java Tue Mar 18 20:35:55 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java Tue Mar 18 20:36:31 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.truffle; +import java.util.*; import java.util.concurrent.atomic.*; import com.oracle.truffle.api.*; @@ -136,6 +137,16 @@ // return false; // } + // disable recursive splitting for now + OptimizedCallTarget splitTarget = getCallTarget(); + List compilationRoots = OptimizedCallNodeProfile.findCompilationRoots(this); + for (OptimizedCallTarget compilationRoot : compilationRoots) { + if (compilationRoot == splitTarget || compilationRoot.getSplitSource() == splitTarget) { + // recursive call found + return false; + } + } + // max one child call and callCount > 2 and kind of small number of nodes if (isMaxSingleCall()) { return true; @@ -166,7 +177,8 @@ return NodeUtil.countNodes(getCallTarget().getRootNode(), new NodeCountFilter() { public boolean isCounted(Node node) { NodeCost cost = node.getCost(); - return cost == NodeCost.POLYMORPHIC || cost == NodeCost.MEGAMORPHIC; + boolean polymorphic = cost == NodeCost.POLYMORPHIC || cost == NodeCost.MEGAMORPHIC; + return polymorphic; } }); } diff -r fdabadc7980d -r d5cae5698316 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNodeProfile.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNodeProfile.java Tue Mar 18 20:35:55 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNodeProfile.java Tue Mar 18 20:36:31 2014 +0100 @@ -191,7 +191,7 @@ return callNode.getCallCount() / (double) callTarget.getCompilationProfile().getCallCount(); } - private static List findCompilationRoots(Node call) { + static List findCompilationRoots(Node call) { RootNode root = call.getRootNode(); if (root == null) { return Collections.emptyList();