changeset 18353:12741288374c

invocations of void methods on proxies are not cacheable as void implies that have a side-effect (e.g., Formattable.formatTo)
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Nov 2014 15:07:16 +0100
parents 8904705ea4a8
children df7243c22bad
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Handler.java
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Handler.java	Wed Nov 12 15:05:22 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Handler.java	Wed Nov 12 15:07:16 2014 +0100
@@ -67,12 +67,9 @@
         return res;
     }
 
-    /**
-     * @param method
-     */
     private static boolean isCacheable(Method method) {
         // TODO: use annotations for finer control of what should be cached
-        return true;
+        return method.getReturnType() != Void.TYPE;
     }
 
     @Override
@@ -81,14 +78,13 @@
         boolean isCacheable = isCacheable(method);
         Invocation invocation = new Invocation(method, delegate, args);
         if (isCacheable) {
-            assert method.getReturnType() != Void.TYPE : method;
             if (cachedInvocations.containsKey(invocation)) {
                 Object result = cachedInvocations.get(invocation);
                 // System.out.println(invocation + ": " + result);
                 return result;
             }
         } else {
-            // System.out.println("not pure: " + method);
+            // System.out.println("not cacheable: " + method);
         }
 
         Object result = invocation.invoke();