(groovy) branch GROOVY_4_0_X updated: GROOVY-11415: Tweak bytecode for identity
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_4_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push: new 4cf5196cac GROOVY-11415: Tweak bytecode for identity 4cf5196cac is described below commit 4cf5196cace32ecb837d2f3b4885be1cc176f7a3 Author: Daniel Sun AuthorDate: Mon Jul 1 15:51:21 2024 + GROOVY-11415: Tweak bytecode for identity (cherry picked from commit 5ec593d588badb99daa48dde9f9242ea6291f1ba) --- .../classgen/asm/BinaryExpressionHelper.java | 7 +-- .../classgen/asm/StatementMetaTypeChooser.java | 3 ++- src/test-resources/core/IdenticalOp_01x.groovy | 24 ++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java index 8434c3975a..724a060498 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java @@ -345,14 +345,17 @@ public class BinaryExpressionHelper { AsmClassGenerator acg = controller.getAcg(); MethodVisitor mv = controller.getMethodVisitor(); OperandStack operandStack = controller.getOperandStack(); +TypeChooser typeChooser = controller.getTypeChooser(); Expression lhs = expression.getLeftExpression(); lhs.visit(acg); -if (ClassHelper.isPrimitiveType(lhs.getType())) operandStack.box(); +ClassNode leftType = typeChooser.resolveType(lhs, controller.getClassNode()); +if (ClassHelper.isPrimitiveType(leftType)) operandStack.box(); Expression rhs = expression.getRightExpression(); rhs.visit(acg); -if (ClassHelper.isPrimitiveType(rhs.getType())) operandStack.box(); +ClassNode rightType = typeChooser.resolveType(rhs, controller.getClassNode()); +if (ClassHelper.isPrimitiveType(rightType)) operandStack.box(); Label trueCase = operandStack.jump(identical ? IF_ACMPEQ : IF_ACMPNE); ConstantExpression.PRIM_FALSE.visit(acg); diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java b/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java index 99611b5c2b..6cf35b31b9 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java @@ -33,7 +33,8 @@ public class StatementMetaTypeChooser implements TypeChooser { @Override public ClassNode resolveType(final Expression exp, final ClassNode current) { ClassNode type = null; -if (exp instanceof ClassExpression) { type = exp.getType(); +if (exp instanceof ClassExpression) { +type = exp.getType(); ClassNode classType = ClassHelper.makeWithoutCaching("java.lang.Class"); classType.setGenericsTypes(new GenericsType[] {new GenericsType(type)}); classType.setRedirect(ClassHelper.CLASS_Type); diff --git a/src/test-resources/core/IdenticalOp_01x.groovy b/src/test-resources/core/IdenticalOp_01x.groovy index 9efe74daca..d4998d4e27 100644 --- a/src/test-resources/core/IdenticalOp_01x.groovy +++ b/src/test-resources/core/IdenticalOp_01x.groovy @@ -40,6 +40,18 @@ def c() { assert 0 === 0 assert 0 !== null assert null !== 0 + +int e = 1 +int f = 1 +assert e === f + +int g = 1 +Integer h = 1 +assert g === h + +Integer j = 1 +int k = 1 +assert j === k } c() @@ -65,5 +77,17 @@ def c_cs() { assert 0 === 0 assert 0 !== null assert null !== 0 + +int e = 1 +int f = 1 +assert e === f + +int g = 1 +Integer h = 1 +assert g === h + +Integer j = 1 +int k = 1 +assert j === k } c_cs()
(groovy) branch master updated: GROOVY-11415: Tweak bytecode for identity
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new 5ec593d588 GROOVY-11415: Tweak bytecode for identity 5ec593d588 is described below commit 5ec593d588badb99daa48dde9f9242ea6291f1ba Author: Daniel Sun AuthorDate: Mon Jul 1 15:51:21 2024 + GROOVY-11415: Tweak bytecode for identity --- .../classgen/asm/BinaryExpressionHelper.java | 7 +-- .../classgen/asm/StatementMetaTypeChooser.java | 3 ++- src/test-resources/core/IdenticalOp_01x.groovy | 24 ++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java index e9beddd1af..6e5d562c5c 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionHelper.java @@ -367,14 +367,17 @@ public class BinaryExpressionHelper { AsmClassGenerator acg = controller.getAcg(); MethodVisitor mv = controller.getMethodVisitor(); OperandStack operandStack = controller.getOperandStack(); +TypeChooser typeChooser = controller.getTypeChooser(); Expression lhs = expression.getLeftExpression(); lhs.visit(acg); -if (ClassHelper.isPrimitiveType(lhs.getType())) operandStack.box(); +ClassNode leftType = typeChooser.resolveType(lhs, controller.getClassNode()); +if (ClassHelper.isPrimitiveType(leftType)) operandStack.box(); Expression rhs = expression.getRightExpression(); rhs.visit(acg); -if (ClassHelper.isPrimitiveType(rhs.getType())) operandStack.box(); +ClassNode rightType = typeChooser.resolveType(rhs, controller.getClassNode()); +if (ClassHelper.isPrimitiveType(rightType)) operandStack.box(); Label trueCase = operandStack.jump(identical ? IF_ACMPEQ : IF_ACMPNE); ConstantExpression.PRIM_FALSE.visit(acg); diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java b/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java index 99611b5c2b..6cf35b31b9 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/StatementMetaTypeChooser.java @@ -33,7 +33,8 @@ public class StatementMetaTypeChooser implements TypeChooser { @Override public ClassNode resolveType(final Expression exp, final ClassNode current) { ClassNode type = null; -if (exp instanceof ClassExpression) { type = exp.getType(); +if (exp instanceof ClassExpression) { +type = exp.getType(); ClassNode classType = ClassHelper.makeWithoutCaching("java.lang.Class"); classType.setGenericsTypes(new GenericsType[] {new GenericsType(type)}); classType.setRedirect(ClassHelper.CLASS_Type); diff --git a/src/test-resources/core/IdenticalOp_01x.groovy b/src/test-resources/core/IdenticalOp_01x.groovy index 9efe74daca..d4998d4e27 100644 --- a/src/test-resources/core/IdenticalOp_01x.groovy +++ b/src/test-resources/core/IdenticalOp_01x.groovy @@ -40,6 +40,18 @@ def c() { assert 0 === 0 assert 0 !== null assert null !== 0 + +int e = 1 +int f = 1 +assert e === f + +int g = 1 +Integer h = 1 +assert g === h + +Integer j = 1 +int k = 1 +assert j === k } c() @@ -65,5 +77,17 @@ def c_cs() { assert 0 === 0 assert 0 !== null assert null !== 0 + +int e = 1 +int f = 1 +assert e === f + +int g = 1 +Integer h = 1 +assert g === h + +Integer j = 1 +int k = 1 +assert j === k } c_cs()
(groovy-dev-site) branch asf-site updated: 2024/07/01 07:30:44: Generated dev website from groovy-website@fe422ae
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 5bf7e2e 2024/07/01 07:30:44: Generated dev website from groovy-website@fe422ae 5bf7e2e is described below commit 5bf7e2e880771ec1433d6ab1db276da03b4b3be1 Author: jenkins AuthorDate: Mon Jul 1 07:30:44 2024 + 2024/07/01 07:30:44: Generated dev website from groovy-website@fe422ae --- blog/adventures-with-groovyfx.html | 2 +- blog/classifying-iris-flowers-with-deep.html | 2 +- blog/comparators-and-sorting-in-groovy.html | 2 +- blog/deck-of-cards-with-groovy.html | 2 +- blog/deep-learning-and-eclipse-collections.html | 2 +- blog/detecting-objects-with-groovy-the.html | 2 +- blog/feed.atom | 12 +- blog/fruity-eclipse-collections.html | 2 +- blog/gmavenplus-1-6-2-released.html | 2 +- blog/groovy-2-4-16-released.html | 2 +- blog/groovy-2-4-16-windows.html | 2 +- blog/groovy-2-4-17-released.html | 2 +- blog/groovy-2-5-0-released.html | 2 +- blog/groovy-2-5-1-released.html | 2 +- blog/groovy-2-5-2-released.html | 2 +- blog/groovy-2-5-2-windows.html | 2 +- blog/groovy-2-5-3-released.html | 2 +- blog/groovy-2-5-3-windows.html | 2 +- blog/groovy-2-5-4-released.html | 2 +- blog/groovy-2-5-4-windows.html | 2 +- blog/groovy-2-5-5-released.html | 2 +- blog/groovy-2-5-5-windows.html | 2 +- blog/groovy-2-5-6-released.html | 2 +- blog/groovy-2-5-7-and.html | 2 +- blog/groovy-2-5-7-released.html | 2 +- blog/groovy-2-5-clibuilder-renewal.html | 2 +- blog/groovy-3-0-0-alpha.html | 2 +- blog/groovy-3-0-0-alpha1.html| 2 +- blog/groovy-3-0-0-beta.html | 2 +- blog/groovy-3-0-0-beta1.html | 2 +- blog/groovy-3-0-0-beta2.html | 2 +- blog/groovy-4-0-3-released.html | 2 +- blog/groovy-dauphine.html| 2 +- blog/groovy-haiku-processing.html| 2 +- blog/groovy-list-processing-cheat-sheet.html | 2 +- blog/groovy-null-processing.html | 2 +- blog/groovy-oracle23ai.html | 29 --- blog/groovy-record-performance.html | 2 +- blog/groovy-records.html | 2 +- blog/groovy-release-train-4-0.html | 2 +- blog/groovy-sequenced-collections.html | 2 +- blog/helloworldemoji.html| 2 +- blog/img/iris_closest10points.png| Bin 0 -> 110968 bytes blog/index.html | 4 ++-- blog/lego-bricks-with-groovy.html| 2 +- blog/matrix-calculations-with-groovy-apache.html | 2 +- blog/parsing-json-with-groovy.html | 2 +- blog/reading-and-writing-csv-files.html | 2 +- blog/seasons-greetings-emoji.html| 2 +- blog/set-operations-with-groovy.html | 2 +- blog/using-groovy-with-apache-wayang.html| 2 +- blog/whiskey-clustering-with-groovy-and.html | 2 +- blog/wordle-checker.html | 2 +- blog/zipping-collections-with-groovy.html| 2 +- 54 files changed, 84 insertions(+), 61 deletions(-) diff --git a/blog/adventures-with-groovyfx.html b/blog/adventures-with-groovyfx.html index baceda3..a599efe 100644 --- a/blog/adventures-with-groovyfx.html +++ b/blog/adventures-with-groovyfx.html @@ -53,7 +53,7 @@ -Blog indexAdventures with GroovyFXFurther informationRelated postsBlog indexAdventures with GroovyFXFurther informationRelated postsBlog indexClassifying Iris Flowers with Deep Learning, Groovy and GraalVMDeep LearningEncogEclipse DeepLe [...] +Blog indexClassifying Iris Flowers with Deep Learning, Groovy and GraalVMDeep LearningEncogEclipse DeepLe [...] diff --git a/blog/comparators-and-sorting-in-groovy.html b/blog/comparators-and-sorting-in-groovy.html index 7450ca9..eef0d55 100644 --- a/blog/comparators-and-sorting-in-groovy.html +++ b/blog/comparators-and-sorting-in-groovy.html @@ -53,7 +53,7 @@ -Blog indexComparators and Sorti
(groovy-website) branch asf-site updated: Oracle 23ai blog post (add PCA plot)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-website.git The following commit(s) were added to refs/heads/asf-site by this push: new fe422ae Oracle 23ai blog post (add PCA plot) fe422ae is described below commit fe422ae9d356baa10a9a9c9e7a91f3f0f9fa3b0c Author: Paul King AuthorDate: Mon Jul 1 17:13:48 2024 +1000 Oracle 23ai blog post (add PCA plot) --- site/src/site/blog/groovy-oracle23ai.adoc | 25 +--- site/src/site/blog/img/iris_closest10points.png | Bin 0 -> 110968 bytes 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/site/src/site/blog/groovy-oracle23ai.adoc b/site/src/site/blog/groovy-oracle23ai.adoc index 473a6ec..6e0d421 100644 --- a/site/src/site/blog/groovy-oracle23ai.adoc +++ b/site/src/site/blog/groovy-oracle23ai.adoc @@ -168,7 +168,7 @@ Iris-setosa Iris-setosa 100 Iris-virginica Iris-virginica100 Iris-versicolor Iris-versicolor 100 Iris-versicolor Iris-versicolor 100 -Iris-versicolor Iris-versicolor70 +*Iris-versicolor Iris-versicolor70* Iris-virginica Iris-virginica100 Iris-virginica Iris-virginica100 Iris-setosa Iris-setosa 100 @@ -187,8 +187,27 @@ Iris-virginica Iris-virginica100 Iris-virginica Iris-virginica100 -Only one result was incorrect. Since we randomly shuffled the data, -we might get a different number of incorrect results for other runs. +Only one result was incorrect (first *bold* line above). +Since we randomly shuffled the data, we might get a +different number of incorrect results for other runs. + +We can visualize how the distance query works +by plotting the closest 10 points in a 3D plot. +We'll do this for the points returned for the 70% +confidence case (second *bold* line above): + +image:img/iris_closest10points.png[closest 10 points] + +This is a Principal Component Analysis (PCA) plot +which projects our 4 dimensions (Petal width and length, +Sepal width and length) down onto 3 dimensions. + +The large red dot is the projection for our test query characteristics. +The small dots are the unselected points in our dataset. +The medium dots are the dots returned by our `vector_distance` +query. +7 Versicolor points (blue) were returned and 3 Virginica points (orange) were returned. +We know the result was Versicolor for that data point. == More Information diff --git a/site/src/site/blog/img/iris_closest10points.png b/site/src/site/blog/img/iris_closest10points.png new file mode 100644 index 000..e522ecc Binary files /dev/null and b/site/src/site/blog/img/iris_closest10points.png differ