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 15:14:42 UTC

[groovy] branch GROOVY_3_0_X updated: GROOVY-9512: Control the fallback threshold of indy with different switch (#1224)

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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 31d0c62  GROOVY-9512: Control the fallback threshold of indy with different switch (#1224)
31d0c62 is described below

commit 31d0c62d51a33d27ac8cc5ff8da9be327b939205
Author: Daniel.Sun <su...@apache.org>
AuthorDate: Thu Apr 16 23:11:47 2020 +0800

    GROOVY-9512: Control the fallback threshold of indy with different switch (#1224)
    
    (cherry picked from commit bd4e734f6824d72e009f5cc7fc2c1d7d96184bba)
---
 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");