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

Varada M varadam at openjdk.org
Thu May 16 09:17:21 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...

> 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
> 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
> ```

Hi @TheRealMDoerr , I have applied the suggested changes and I have fixed the indentation fixes. Testing is also done.
Thank you

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

PR Comment: https://git.openjdk.org/jdk/pull/19250#issuecomment-2114639380


More information about the hotspot-compiler-dev mailing list