RFR: 8315841: RISC-V: Check for hardware TSO support [v4]
Ludovic Henry
luhenry at openjdk.org
Thu Sep 7 13:04:09 UTC 2023
On Thu, 7 Sep 2023 12:52:53 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
>> @theRealAph this way we will miss fence completely when UseZtso is false
>
> I prefer:
>
> {
> if (UseZtso) {
> ....
> return;
> }
> <the other code path without else>
> }
We still need to generate the fence in case of non-TSO, so with that code structure, it would look like that:
void fence(uint32_t predecessor, uint32_t successor) {
if (UseZtso) {
if (pred_succ_to_membar_mask(predecessor, successor) & StoreLoad) {
// TSO allows for stores to be reordered after loads. When the compiler
// generates a fence to disallow that, we are required to generate the
// fence for correctness.
Assembler::fence(predecessor, successor);
} else {
// TSO guarantees other fences already.
}
} else {
Assembler::fence(predecessor, successor);
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15613#discussion_r1318564436
More information about the hotspot-dev
mailing list