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/05/12 14:08:48 UTC

[groovy] branch danielsun/lab-indy-20220512 created (now 48f8e95112)

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

sunlan pushed a change to branch danielsun/lab-indy-20220512
in repository https://gitbox.apache.org/repos/asf/groovy.git


      at 48f8e95112 Remove guards for receiver and parameter

This branch includes the following new commits:

     new 48f8e95112 Remove guards for receiver and parameter

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: Remove guards for receiver and parameter

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

sunlan pushed a commit to branch danielsun/lab-indy-20220512
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 48f8e951121bc6ec56734cde2a8c6b97c6149081
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu May 12 22:08:19 2022 +0800

    Remove guards for receiver and parameter
---
 .../org/codehaus/groovy/vmplugin/v8/Selector.java  | 47 +++++++++++-----------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
index 3301c18225..7090cc519d 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
@@ -85,7 +85,6 @@ import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.MOP
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.MOP_INVOKE_CONSTRUCTOR;
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.MOP_INVOKE_METHOD;
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.NULL_REF;
-import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.SAME_CLASS;
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.SAME_MC;
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.SAM_CONVERSION;
 import static org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.UNWRAP_EXCEPTION;
@@ -922,29 +921,29 @@ public abstract class Selector {
             if (LOG_ENABLED) LOG.info("added switch point guard");
 
             // guards for receiver and parameter
-            Class<?>[] pt = handle.type().parameterArray();
-            for (int i = 0; i < args.length; i++) {
-                Object arg = args[i];
-                Class<?> paramType = pt[i];
-                MethodHandle test;
-
-                if (arg == null) {
-                    test = IS_NULL.asType(MethodType.methodType(boolean.class, paramType));
-                    if (LOG_ENABLED) LOG.info("added null argument check at pos " + i);
-                } else {
-                    Class<?> argClass = arg.getClass();
-                    if (paramType.isPrimitive()) continue;
-                    //if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue;
-                    test = SAME_CLASS.
-                            bindTo(argClass).
-                            asType(MethodType.methodType(boolean.class, paramType));
-                    if (LOG_ENABLED) LOG.info("added same class check at pos " + i);
-                }
-                Class<?>[] drops = new Class[i];
-                System.arraycopy(pt, 0, drops, 0, drops.length);
-                test = MethodHandles.dropArguments(test, 0, drops);
-                handle = MethodHandles.guardWithTest(test, handle, fallback);
-            }
+//            Class<?>[] pt = handle.type().parameterArray();
+//            for (int i = 0; i < args.length; i++) {
+//                Object arg = args[i];
+//                Class<?> paramType = pt[i];
+//                MethodHandle test;
+//
+//                if (arg == null) {
+//                    test = IS_NULL.asType(MethodType.methodType(boolean.class, paramType));
+//                    if (LOG_ENABLED) LOG.info("added null argument check at pos " + i);
+//                } else {
+//                    Class<?> argClass = arg.getClass();
+//                    if (paramType.isPrimitive()) continue;
+//                    //if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue;
+//                    test = SAME_CLASS.
+//                            bindTo(argClass).
+//                            asType(MethodType.methodType(boolean.class, paramType));
+//                    if (LOG_ENABLED) LOG.info("added same class check at pos " + i);
+//                }
+//                Class<?>[] drops = new Class[i];
+//                System.arraycopy(pt, 0, drops, 0, drops.length);
+//                test = MethodHandles.dropArguments(test, 0, drops);
+//                handle = MethodHandles.guardWithTest(test, handle, fallback);
+//            }
         }
 
         /**