Copilot commented on code in PR #2233:
URL: https://github.com/apache/groovy/pull/2233#discussion_r2105677220


##########
src/main/java/org/codehaus/groovy/vmplugin/v8/CacheableCallSite.java:
##########
@@ -119,6 +120,11 @@ public long incrementFallbackCount() {
 
     public void resetFallbackCount() {
         fallbackCount.set(0);
+        fallbackRound.incrementAndGet();

Review Comment:
   Consider adding a comment clarifying the purpose and difference between 
fallbackCount and fallbackRound to prevent confusion for future maintainers.



##########
src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java:
##########
@@ -327,8 +329,15 @@ public static Object fromCache(CacheableCallSite callSite, 
Class<?> sender, Stri
         }
 
         if (mhw.isCanSetTarget() && (callSite.getTarget() != 
mhw.getTargetMethodHandle()) && (mhw.getLatestHitCount() > 
INDY_OPTIMIZE_THRESHOLD)) {
-            callSite.setTarget(mhw.getTargetMethodHandle());
-            if (LOG_ENABLED) LOG.info("call site target set, preparing outside 
invocation");
+            if (callSite.getFallbackRound().get() > INDY_FALLBACK_CUTOFF) {

Review Comment:
   Consider adding a comment explaining the rationale behind permanently 
resetting the call site target when the fallback round exceeds the 
INDY_FALLBACK_CUTOFF to improve code clarity and maintainability.



-- 
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: notifications-unsubscr...@groovy.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to