RFR 8136924 Vectorized support for array equals/compare/mismatch using Unsafe

Paul Sandoz paul.sandoz at oracle.com
Wed Nov 25 09:53:36 UTC 2015


And this is the review for the Java part:


Which will be updated to add @HotSpotIntrinsicCandidate when JDK-8143355 is pushed. [1]

The plan is all reviewed changes will be pushed to hs-comp and then we follow up:

  1) adding the intrinsic to other platforms

  2) improving C1 (perhaps even the interpreter?) since the intrinsic is a stub which IIUC makes it easier to plug in.

  3) take a swing at consolidating other equal/compare intrinsics, such as those for char[]/String-based equal/compare

  4) adding methods to String such as mismatch method.

I can help by pushing all reviewed patches. I will kick off a JPRT run with all patches applied.

I did evaluate/test the HotSpot patch (stared at the patch and generated code for UseAVX < 2, and measured) and reviewed with my limited knowledge of HotSpot.


diff -r 01b49c2960fd src/java.base/share/classes/java/util/ArraysSupport.java
--- a/src/java.base/share/classes/java/util/ArraysSupport.java	Tue Nov 17 15:42:53 2015 +0100
+++ b/src/java.base/share/classes/java/util/ArraysSupport.java	Tue Nov 17 17:05:09 2015 +0100
@@ -24,7 +24,7 @@
package java.util;

-//import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.Unsafe;

class ArraysSupport {
@@ -72,7 +72,7 @@
     * If a mismatch is not found the negation of one plus the number of
     * remaining pairs of elements to be checked in the tail of the two arrays.
-//    @HotSpotIntrinsicCandidate
+    @HotSpotIntrinsicCandidate
    static int vectorizedMismatch(Object a, long aOffset,
                                  Object b, long bOffset,
                                  int length,

> On 25 Nov 2015, at 01:00, Deshpande, Vivek R <vivek.r.deshpande at intel.com> wrote:
> Hi all
> We would like to contribute a patch from Intel which optimizes vectorizedMismatch() method in java.util.ArraysSupport.java for X86 architecture using AVX instructions.
> The improvement gives more than 2x gain over Unsafe implementation for long arrays.
> The bug is blocked by bug: vectorized support for array equals/compare/mismatch using Unsafe (https://bugs.openjdk.java.net/browse/JDK-8136924.)
> Could you please review and sponsor this patch.
> Bug-id:
> https://bugs.openjdk.java.net/browse/JDK-8143355
> webrev:
> http://cr.openjdk.java.net/~mcberg/8143355/webrev.01/
> Thanks and regards,
> Vivek

More information about the core-libs-dev mailing list