RFR: 8331935: Add support for primitive array C1 clone intrinsic in PPC

Martin Doerr mdoerr at openjdk.org
Thu May 16 09:17:20 UTC 2024


On Wed, 15 May 2024 13:50:27 GMT, Varada M <varadam at openjdk.org> wrote:

> https://bugs.openjdk.org/browse/JDK-8302850 port for PPC64
> 
> JMH Benchmark Results
> 
> 
> Before :
> 
> Benchmark                 (size)  Mode  Cnt    Score   Error  Units
> ArrayClone.byteArraycopy       0  avgt   15  114.107 ? 1.337  ns/op
> ArrayClone.byteArraycopy      10  avgt   15  130.492 ? 0.991  ns/op
> ArrayClone.byteArraycopy     100  avgt   15  139.103 ? 1.913  ns/op
> ArrayClone.byteArraycopy    1000  avgt   15  321.688 ? 6.033  ns/op
> ArrayClone.byteClone           0  avgt   15  227.602 ? 3.393  ns/op
> ArrayClone.byteClone          10  avgt   15  237.624 ? 2.996  ns/op
> ArrayClone.byteClone         100  avgt   15  239.219 ? 2.835  ns/op
> 
> ArrayClone.byteClone        1000  avgt   15  355.571 ? 2.946  ns/op
> ArrayClone.intArraycopy        0  avgt   15  113.275 ? 1.099  ns/op
> ArrayClone.intArraycopy       10  avgt   15  129.763 ? 1.458  ns/op
> ArrayClone.intArraycopy      100  avgt   15  213.327 ? 2.524  ns/op
> ArrayClone.intArraycopy     1000  avgt   15  449.650 ? 7.338  ns/op
> ArrayClone.intClone            0  avgt   15  225.682 ? 3.048  ns/op
> ArrayClone.intClone           10  avgt   15  234.532 ? 2.817  ns/op
> ArrayClone.intClone          100  avgt   15  295.934 ? 4.925  ns/op
> ArrayClone.intClone         1000  avgt   15  573.368 ? 5.739  ns/op
> Finished running test 'micro:java.lang.ArrayClone'
> Test report is stored in build/aix-ppc64-server-release/test-results/micro_java_lang_ArrayClone
> 
> ==============================
> Test summary
> ==============================
>    TEST                                              TOTAL  PASS  FAIL ERROR   
>    micro:java.lang.ArrayClone                            1     1     0     0   
> ==============================
> TEST SUCCESS
> 
> Finished building target 'test' in configuration 'aix-ppc64-server-release'
> 
> 
> 
> 
> After:
> 
> Benchmark                 (size)  Mode  Cnt    Score    Error  Units
> ArrayClone.byteArraycopy       0  avgt   15  113.894 ?  0.993  ns/op
> ArrayClone.byteArraycopy      10  avgt   15  131.455 ?  0.956  ns/op
> ArrayClone.byteArraycopy     100  avgt   15  139.145 ?  3.002  ns/op
> ArrayClone.byteArraycopy    1000  avgt   15  315.957 ? 14.591  ns/op
> ArrayClone.byteClone           0  avgt   15   43.753 ?  3.669  ns/op
> ArrayClone.byteClone          10  avgt   15   52.329 ?  1.041  ns/op
> ArrayClone.byteClone         100  avgt   15  127.711 ?  3.938  ns/op
> 
> ArrayClone.byteClone        1000  avgt   15  225.937 ?  1.987  ns/op
> ArrayClone.intArraycopy        0  avgt   15  113.788 ?  0.770  ns/op
> ArrayClone.intArraycopy       10  avgt   1...

This looks good. Please adapt the indentation. You can mark it as ready for review.

I got crashes when testing on linux ppc64le and noticed that we need one more adaptation to handle `stub == nullptr`. I suggest the following addition:

diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
index b6d9200b261..dba662a2212 100644
--- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
@@ -1968,7 +1968,11 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
   int shift = shift_amount(basic_type);
 
   if (!(flags & LIR_OpArrayCopy::type_check)) {
-    __ b(cont);
+    if (stub != nullptr) {
+      __ b(cont);
+      __ bind(slow);
+      __ b(*stub->entry());
+    }
   } else {
     // We don't know the array types are compatible.
     if (basic_type != T_OBJECT) {
@@ -2089,9 +2093,9 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
         __ add(dst_pos, tmp, dst_pos);
       }
     }
+    __ bind(slow);
+    __ b(*stub->entry());
   }
-  __ bind(slow);
-  __ b(*stub->entry());
   __ bind(cont);
 
 #ifdef ASSERT

The test failures will be fixed by https://github.com/openjdk/jdk/pull/19218. Unrelated.

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp line 366:

> 364:       }
> 365: 
> 366:       initialize_body(base, index);

hotspot uses 2 spaces indentation.

-------------

PR Review: https://git.openjdk.org/jdk/pull/19250#pullrequestreview-2058284260
Changes requested by mdoerr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19250#pullrequestreview-2059189398
PR Comment: https://git.openjdk.org/jdk/pull/19250#issuecomment-2112770468
PR Review Comment: https://git.openjdk.org/jdk/pull/19250#discussion_r1601806637


More information about the hotspot-compiler-dev mailing list