RFR: 8330181: Move PcDesc cache from nmethod header
Vladimir Kozlov
kvn at openjdk.org
Mon Apr 22 17:17:30 UTC 2024
On Mon, 22 Apr 2024 16:54:40 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> Currently PcDescCache (32 bytes: PcDesc* _pc_descs[4]) is allocated in `nmethod` header.
>
> Moved PcDescContainer (which includes cache) to C heap similar to ExceptionCache to reduce size of `nmethod` header and remove WXWrite transition when we update the cache in `PcDescCache::add_pc_desc()`.
>
> Removed `PcDescSearch` class which was leftover from `CompiledMethod` days.
>
> Tested tier1-4,stress,xcomp and performance.
src/hotspot/share/code/nmethod.cpp line 351:
> 349: }
> 350:
> 351: void PcDescCache::init_to(PcDesc* initial_pc_desc) {
I renamed method to `init_to()` because it is used only once for initialization.
src/hotspot/share/code/nmethod.cpp line 364:
> 362: PcDesc* PcDescCache::find_pc_desc(int pc_offset, bool approximate) {
> 363: NOT_PRODUCT(++pc_nmethod_stats.pc_desc_queries);
> 364: NOT_PRODUCT(if (approximate) ++pc_nmethod_stats.pc_desc_approx);
Moved to ` PcDescContainer::find_pc_desc()` to have correct statistics because that method does initial check for last cached data.
src/hotspot/share/code/nmethod.cpp line 399:
> 397:
> 398: void PcDescCache::add_pc_desc(PcDesc* pc_desc) {
> 399: MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current());)
No need any more because cache in C heap now instead of `CodeCache`.
src/hotspot/share/code/nmethod.cpp line 1453:
> 1451:
> 1452: // Create cache after PcDesc data is copied - it will be used to initialize cache
> 1453: _pc_desc_container = new PcDescContainer(scopes_pcs_begin());
It was a bug from early HotSpot days. The assert in `PcDescCache::init_to()` checks that initializing data is sentinel but before PcDesc data is copied values in allocated space could be anything. I don't understand how we don't hit this assert before in mainline. We always hit it on Aarch64 in `leyden/premain` repo.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18895#discussion_r1575095093
PR Review Comment: https://git.openjdk.org/jdk/pull/18895#discussion_r1575099082
PR Review Comment: https://git.openjdk.org/jdk/pull/18895#discussion_r1575100409
PR Review Comment: https://git.openjdk.org/jdk/pull/18895#discussion_r1575106074
More information about the hotspot-compiler-dev
mailing list