changeset 12638:02f844c76626

Truffle-DSL: the default polymorphic depth should also include combinations of implicit casts.
author Christian Humer <christian.humer@gmail.com>
date Tue, 29 Oct 2013 16:55:42 +0100
parents 9b23caa3ad31
children 50aca0c0dff4
files graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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