groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [1/2] groovy git commit: GROOVY-7542: CompileStatic class generation bug 'register with message: rightShiftUnsigned and arguments X'
Date Tue, 09 Aug 2016 07:55:01 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 584d4d405 -> a1eb2ae58


GROOVY-7542: CompileStatic class generation bug 'register with message: rightShiftUnsigned
and arguments X'


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cba9b426
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cba9b426
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cba9b426

Branch: refs/heads/master
Commit: cba9b426b47cfb57c36ed2f80229b3ad09d0b74c
Parents: 584d4d4
Author: antoaravinth <anto.aravinth.cse@gmail.com>
Authored: Sun Aug 16 18:24:47 2015 +0530
Committer: paulk <paulk@asert.com.au>
Committed: Tue Aug 9 17:20:08 2016 +1000

----------------------------------------------------------------------
 .../classgen/asm/sc/StaticTypesCallSiteWriter.java | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/cba9b426/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
index 74a8895..79dea7d 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
@@ -650,6 +650,11 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter implements
Opcodes
                 writeModCall(receiver, arguments, rType, aType);
                 return true;
             }
+            else if("rightShiftUnsigned".equals(message))
+            {
+                writeShiftOperatorCall(receiver, arguments, rType, aType);
+                return true;
+            }
         } else if (STRING_TYPE.equals(rType) && "plus".equals(message)) {
             writeStringPlusCall(receiver, message, arguments);
             return true;
@@ -749,7 +754,17 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter implements
Opcodes
         mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/NumberMath",
"mod", "(Ljava/lang/Number;Ljava/lang/Number;)Ljava/lang/Number;", false);
         controller.getOperandStack().replace(Number_TYPE, 2);
     }
-    
+
+    private void writeShiftOperatorCall(Expression receiver, Expression arguments, ClassNode
rType, ClassNode aType) {
+        prepareSiteAndReceiver(receiver, "rightShiftUnsigned", false, controller.getCompileStack().isLHS());
+        controller.getOperandStack().doGroovyCast(Number_TYPE);
+        visitBoxedArgument(arguments);
+        controller.getOperandStack().doGroovyCast(Number_TYPE);
+        MethodVisitor mv = controller.getMethodVisitor();
+        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/NumberMath",
"rightShiftUnsigned", "(Ljava/lang/Number;Ljava/lang/Number;)Ljava/lang/Number;", false);
+        controller.getOperandStack().replace(Number_TYPE, 2);
+    }
+
     private void writePowerCall(Expression receiver, Expression arguments, final ClassNode
rType, ClassNode aType) {
         OperandStack operandStack = controller.getOperandStack();
         int m1 = operandStack.getStackLength();


Mime
View raw message