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 2022/12/04 17:43:25 UTC

[groovy] branch danielsun/enable-indy-by-default-20221205 created (now ee57f80502)

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

sunlan pushed a change to branch danielsun/enable-indy-by-default-20221205
in repository https://gitbox.apache.org/repos/asf/groovy.git


      at ee57f80502 Enable indy by default

This branch includes the following new commits:

     new ee57f80502 Enable indy by default

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: Enable indy by default

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/enable-indy-by-default-20221205
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit ee57f805023acc7dcb63cec8d6e8457ed18164f6
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Dec 5 01:43:08 2022 +0800

    Enable indy by default
---
 .../java/org/codehaus/groovy/classgen/asm/WriterController.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
index 39f05cb26e..97b7000f87 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
@@ -76,18 +76,20 @@ public class WriterController {
     public void init(final AsmClassGenerator asmClassGenerator, final GeneratorContext gcon, final ClassVisitor cv, final ClassNode cn) {
         CompilerConfiguration config = cn.getCompileUnit().getConfig();
         Map<String,Boolean> optOptions = config.getOptimizationOptions();
-        boolean invokedynamic = false;
+        boolean invokedynamic = true;
         if (optOptions.isEmpty()) {
             // IGNORE
         } else if (Boolean.FALSE.equals(optOptions.get("all"))) {
+            invokedynamic = false;
             this.optimizeForInt = false;
             // set other optimizations options to false here
         } else {
-            if (config.isIndyEnabled()) invokedynamic = true;
+            if (!config.isIndyEnabled()) invokedynamic = false;
             if (Boolean.FALSE.equals(optOptions.get("int"))) this.optimizeForInt = false;
-            if (invokedynamic) this.optimizeForInt = false;
             // set other optimizations options to false here
         }
+        if (invokedynamic) this.optimizeForInt = false;
+
         this.classNode = cn;
         this.outermostClass = null;
         this.internalClassName = BytecodeHelper.getClassInternalName(cn);