RFR: JDK-8303154: Investigate and improve instruction cache flushing during compilation [v2]
Damon Fenacci
duke at openjdk.org
Mon Mar 13 13:52:59 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).
Damon Fenacci has updated the pull request incrementally with one additional commit since the last revision:
JDK-8303154: remove flush in CodeCache::commit() instead of CodeBuffer::copy_code_to()
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12877/files
- new: https://git.openjdk.org/jdk/pull/12877/files/85eb7914..2e119cb1
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12877&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12877&range=00-01
Stats: 15 lines in 5 files changed: 0 ins; 7 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