You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/04/16 10:54:28 UTC

[groovy] 01/01: GROOVY-9512: Control the fallback threshold of indy with different switch

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY-9512
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 98ca9e41ad2061be592a63c0455d69a6e362cd87
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Apr 16 18:54:14 2020 +0800

    GROOVY-9512: Control the fallback threshold of indy with different switch
---
 src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java
index fb9303e..967cc5f 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/IndyInterface.java
@@ -48,6 +48,7 @@ import java.util.stream.Stream;
  */
 public class IndyInterface {
     private static final long INDY_OPTIMIZE_THRESHOLD = SystemUtil.getLongSafe("groovy.indy.optimize.threshold", 100_000L);
+    private static final long INDY_FALLBACK_THRESHOLD = SystemUtil.getLongSafe("groovy.indy.fallback.threshold", 100_000L);
 
     /**
      * flags for method and property calls
@@ -285,7 +286,7 @@ public class IndyInterface {
 
             final MethodHandle defaultTarget = cacheableCallSite.getDefaultTarget();
             final long fallbackCount = cacheableCallSite.incrementFallbackCount();
-            if ((fallbackCount > INDY_OPTIMIZE_THRESHOLD) && (cacheableCallSite.getTarget() != defaultTarget)) {
+            if ((fallbackCount > INDY_FALLBACK_THRESHOLD) && (cacheableCallSite.getTarget() != defaultTarget)) {
                 cacheableCallSite.setTarget(defaultTarget);
                 if (LOG_ENABLED) LOG.info("call site target reset to default, preparing outside invocation");