# HG changeset patch # User Doug Simon # Date 1415801236 -3600 # Node ID 12741288374cc4cf267a891fc7f7c028290c8493 # Parent 8904705ea4a8b310deb3da84a4d176eba60611c4 invocations of void methods on proxies are not cacheable as void implies that have a side-effect (e.g., Formattable.formatTo) diff -r 8904705ea4a8 -r 12741288374c graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Handler.java --- 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();