blackdrag commented on code in PR #2473:
URL: https://github.com/apache/groovy/pull/2473#discussion_r3107787815


##########
src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java:
##########
@@ -320,48 +320,50 @@ public static Object fromCache(CacheableCallSite 
callSite, Class<?> sender, Stri
      */
     private static MethodHandle fromCacheHandle(CacheableCallSite callSite, 
Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean 
thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments) throws 
Throwable {
         FallbackSupplier fallbackSupplier = new FallbackSupplier(callSite, 
sender, methodName, callID, safeNavigation, thisCall, spreadCall, 
dummyReceiver, arguments);
+        final Object receiver = arguments[0];

Review Comment:
   So what will happen in this case?
   ```
   def foo(receiver){receiver.bar()}
   class A{ static bar(){1} }
   class B{ static bar(){2} }
   foo(A)
   foo(B)
   foo(new A())
   foo(new B())
   ```
   for the first two calls the class is the same, since receiver.getClass will 
return Class for both. But that is imho a bug, that existed already before 
`callSite.getAndPut(receiverClassName,...`. Also I think the later two cases 
are not considered here... why not?  If we really only want to optimize 
`A.bar()` style calls, then we should check the receiver type through the 
callsite type, not the runtime type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to