jamesfredley commented on code in PR #2374:
URL: https://github.com/apache/groovy/pull/2374#discussion_r2747961094


##########
src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java:
##########
@@ -940,9 +941,18 @@ public void setGuards(Object receiver) {
                 }
             }
 
-            // handle constant metaclass and category changes
-            handle = switchPoint.guardWithTest(handle, fallback);
-            if (LOG_ENABLED) LOG.info("added switch point guard");
+            // Skip the global switchpoint guard by default.
+            // The switchpoint causes ALL call sites to fail when ANY 
metaclass changes.
+            // In Grails and similar frameworks with frequent metaclass 
changes, this causes
+            // massive guard failures and performance degradation.
+            // The other guards (metaclass identity, class receiver, category) 
should be
+            // sufficient, combined with cache invalidation on metaclass 
changes.
+            // 
+            // If you need strict metaclass change detection, set 
groovy.indy.switchpoint.guard=true
+            if (SystemUtil.getBooleanSafe("groovy.indy.switchpoint.guard")) {

Review Comment:
   If this PRs approach is viable, but does not prove to be generally valuable 
for all/most code run with Indy on, than I think the inverse would be fine for 
Grails and we could set that flag in default generated applications.
   
   



-- 
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