RFR: 8339771: RISC-V: Reduce icache flushes [v2]

Robbin Ehn rehn at openjdk.org
Wed Sep 18 08:34:06 UTC 2024


On Wed, 18 Sep 2024 04:10:43 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Comment, moved init after feature enabling
>
> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 3059:
> 
>> 3057: void MacroAssembler::cmodx_fence() {
>> 3058:   BLOCK_COMMENT("cmodx fence");
>> 3059:   if (VM_Version::supports_fencei_barrier()) {
> 
> Seems more reasonable to turn this into an assertion? `assert(VM_Version::supports_fencei_barrier(), "must be");`

The cmodx_fence() is called after a safepoint or thread local handshake.
Even if it costs tens? of cycles it is very little compared to hitting the poll, potentially comming from signal handler, hence therefore I kept it always 'on'.

But we are only guaranteed to have fence.i when running on Linux, this is code is not specific to linux.
I.e. MASM should be OS independent. As we already check this during boot in Linux specific code there is no way that assert can happen on Linux.

But maybe our JDK implementation should require fence.i ?
If we do then doing the assert make more sense, yes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20913#discussion_r1764626510


More information about the hotspot-dev mailing list