# HG changeset patch # User Christian Humer # Date 1383062142 -3600 # Node ID 02f844c76626ff78564f4db5404839a41047ac80 # Parent 9b23caa3ad317ccd6298a472bb595f4d2bbc3a36 Truffle-DSL: the default polymorphic depth should also include combinations of implicit casts. diff -r 9b23caa3ad31 -r 02f844c76626 graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java Tue Oct 29 16:36:07 2013 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java Tue Oct 29 16:55:42 2013 +0100 @@ -663,7 +663,7 @@ // calculate reachability SpecializationData prev = null; - int specializationCount = 0; + int polymorphicCombinations = 0; boolean reachable = true; for (SpecializationData specialization : specializations) { if (specialization.isUninitialized()) { @@ -680,14 +680,23 @@ reachable = false; } if (!specialization.isGeneric()) { - specializationCount++; + int combinations = 1; + for (ActualParameter parameter : specialization.getParameters()) { + if (!parameter.getSpecification().isSignature()) { + continue; + } + TypeData type = parameter.getTypeSystemType(); + combinations *= node.getTypeSystem().lookupSourceTypes(type).size(); + } + polymorphicCombinations += combinations; } + prev = specialization; } // initialize polymorphic depth if (node.getPolymorphicDepth() < 0) { - node.setPolymorphicDepth(specializationCount - 1); + node.setPolymorphicDepth(polymorphicCombinations - 1); } // reduce polymorphicness if generic is not reachable