Mercurial > hg > graal-compiler
changeset 14600:d5cae5698316
Truffle: fixed indefinite splitting of recursive calls.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 18 Mar 2014 20:36:31 +0100 |
parents | fdabadc7980d |
children | e845cd0b033f |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNodeProfile.java |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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<OptimizedCallTarget> 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; } }); }
--- 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<OptimizedCallTarget> findCompilationRoots(Node call) { + static List<OptimizedCallTarget> findCompilationRoots(Node call) { RootNode root = call.getRootNode(); if (root == null) { return Collections.emptyList();