RFR: 8345178: RISC-V: Add gtests for narrow cmpxchg [v2]

Hamlin Li mli at openjdk.org
Mon Dec 2 11:45:38 UTC 2024


On Fri, 29 Nov 2024 14:01:24 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> Hi, please consider.
>> 
>> This adds tests of aligned narrow cmpxchg.
>> 
>> 
>> Note: Google Test filter = *RiscV*
>> [==========] Running 5 tests from 1 test suite.
>> [----------] Global test environment set-up.
>> [----------] 5 tests from RiscV
>> ...
>> [ RUN      ] RiscV.cmpxchg_int16_lr_sc_vm
>> [       OK ] RiscV.cmpxchg_int16_lr_sc_vm (2 ms)
>> [ RUN      ] RiscV.cmpxchg_int8_lr_sc_vm
>> [       OK ] RiscV.cmpxchg_int8_lr_sc_vm (1 ms)
>> [ RUN      ] RiscV.cmpxchg_int16_maybe_zacas_vm
>> [       OK ] RiscV.cmpxchg_int16_maybe_zacas_vm (1 ms)
>> [ RUN      ] RiscV.cmpxchg_int8_maybe_zacas_vm
>> [       OK ] RiscV.cmpxchg_int8_maybe_zacas_vm (1 ms)
>> [----------] 5 tests from RiscV (20831 ms total)
>> 
>> [----------] Global test environment tear-down
>> [==========] 5 tests from 1 test suite ran. (20834 ms total)
>> [  PASSED  ] 5 tests.
>> 
>> 
>> Executed with -XX:+UnlockExperimentalVMOptions -XX:+UseZacas
>> 
>> Thanks, Robbin
>
> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove CMF barrier

Thanks for adding the tests!

The test code looks good. Just some minor comment below.

And one general question, will we consider to add some concurrent tests in the future? Although I don't have a good idea how to implement such tests in a stable way. :)

test/hotspot/gtest/riscv/test_assembler_riscv.cpp line 144:

> 142:     data[i] = 121;
> 143:     ret = NarrowCmpxchgTester<TESTSIZE, ASMSIZE>::narrow_cmpxchg((intptr_t)&data[i], 121, 42, /* result */ 67,
> 144:                                                                           -1, -1, -1, false);

Seems we don't need to put these `-1, -1, -1` as the arguments of `NarrowCmpxchgTester::narrow_cmpxchg`, they could be just local variables in `narrow_cmpxchg`.

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

PR Review: https://git.openjdk.org/jdk/pull/22445#pullrequestreview-2472472430
PR Review Comment: https://git.openjdk.org/jdk/pull/22445#discussion_r1865705023


More information about the hotspot-dev mailing list