diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java @ 21077:4cba24bef2ee

Truffle-DSL: fix unnecessary cast in generated isIdentical for types used just in cached expressions .
author Christian Humer <christian.humer@gmail.com>
date Wed, 22 Apr 2015 15:04:01 +0200
parents 82539241ff38
children 23f0f181bc05
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Wed Apr 22 11:00:26 2015 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Wed Apr 22 15:04:01 2015 +0200
@@ -1981,7 +1981,7 @@
         } else {
             castGuards = new HashSet<>();
             for (TypeGuard castGuard : group.getTypeGuards()) {
-                if (isTypeGuardUsedInAnyGuardOrCacheBelow(group, currentValues, castGuard)) {
+                if (isTypeGuardUsedInAnyGuardOrCacheBelow(group, currentValues, castGuard, execution.isFastPath())) {
                     castGuards.add(castGuard);
                 }
             }
@@ -2059,7 +2059,7 @@
         return true;
     }
 
-    private boolean isTypeGuardUsedInAnyGuardOrCacheBelow(SpecializationGroup group, LocalContext currentValues, TypeGuard typeGuard) {
+    private boolean isTypeGuardUsedInAnyGuardOrCacheBelow(SpecializationGroup group, LocalContext currentValues, TypeGuard typeGuard, boolean fastPath) {
         String localName = currentValues.getValue(typeGuard.getSignatureIndex()).getName();
 
         SpecializationData specialization = group.getSpecialization();
@@ -2068,7 +2068,7 @@
                 return true;
             }
         }
-        if (specialization != null) {
+        if (!fastPath && specialization != null) {
             for (CacheExpression cache : specialization.getCaches()) {
                 if (isVariableBoundIn(specialization, cache.getExpression(), localName, currentValues)) {
                     return true;
@@ -2077,7 +2077,7 @@
         }
 
         for (SpecializationGroup child : group.getChildren()) {
-            if (isTypeGuardUsedInAnyGuardOrCacheBelow(child, currentValues, typeGuard)) {
+            if (isTypeGuardUsedInAnyGuardOrCacheBelow(child, currentValues, typeGuard, fastPath)) {
                 return true;
             }
         }