RFR: JDK-8303154: Investigate and improve instruction cache flushing during compilation
Tobias Hartmann
thartmann at openjdk.org
Fri Mar 10 10:11:05 UTC 2023
On Mon, 6 Mar 2023 08:37:50 GMT, Damon Fenacci <duke at openjdk.org> wrote:
> It was noticed that we flush the instruction cache too much for a single C1 compilation. The same is true for the C2 compilation.
> There are several places in the code where the instruction cache is called and many of them are very intertwined (see [bug report](https://bugs.openjdk.org/browse/JDK-8303154)).
>
> This PR is meant to be a "minimum" set of changes that improve the situation without introducing excessive extra information to keep track of the origin of the call through call stacks. This is done by avoiding calls to flush the ICache at `Compilation::emit_code_epilog` and when copying from the temporary buffer into the code cache in `CodeBuffer::copy_code_to` if there is a call to `CodeCache::commit` later on. This results in flushing the ICache only once instead of 3 times for a C1 compilation and twice for a C2 compilation respectively.
>
> This change decreases the number of calls to flush the ICache for a simple _Hello world_ program on Mac OSX aarch64 from 3568 to 3487 on C1 (2.27% improvement) and from 3499 to 3415 on C2 (2.40% improvement).
Looks good to me. As we discussed, please file a follow-up RFE for the remaining investigations around excessive icache flushing.
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12877
More information about the hotspot-compiler-dev
mailing list