RFR: JDK-8303154: Investigate and improve instruction cache flushing during compilation
Damon Fenacci
duke at openjdk.org
Fri Mar 10 10:11:04 UTC 2023
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).
-------------
Commit messages:
- JDK-8303154: fix syntax and add comment
- JDK-8303154: fix syntax
- JDK-8303154: remove unnecessary icache flushing at the end emit_code_epilog
- JDK-8303154: Investigate and improve instruction cache flushing during compilation
Changes: https://git.openjdk.org/jdk/pull/12877/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12877&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8303154
Stats: 15 lines in 5 files changed: 4 ins; 3 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/12877.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12877/head:pull/12877
PR: https://git.openjdk.org/jdk/pull/12877
More information about the hotspot-compiler-dev
mailing list