RFR: 8316694: Implement relocation of nmethod within CodeCache [v4]

Evgeny Astigeevich eastigeevich at openjdk.org
Mon Mar 17 21:41:11 UTC 2025


On Mon, 17 Mar 2025 20:54:04 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

>> src/hotspot/share/code/nmethod.cpp line 1471:
>> 
>>> 1469:     // Clear inline caches before acquiring any locks
>>> 1470:     VM_ClearNMethodICs clear_nmethod_ics(nm);
>>> 1471:     VMThread::execute(&clear_nmethod_ics);
>> 
>> This does not look correct.
>> Why are you doing this?
>> What are you trying to fix?
>
> [Fix relocation requires](https://github.com/openjdk/jdk/blob/19154f7af34bf6f13d61d7a9f05d6277964845d8/src/hotspot/share/code/relocInfo.hpp#L858-L860) that inline caches be cleared which [must be done at a safepoint](https://github.com/openjdk/jdk/blob/19154f7af34bf6f13d61d7a9f05d6277964845d8/src/hotspot/share/code/nmethod.cpp#L770).

The comment to `fix_relocation_after_move` is 17 year old.
Is it still valid?
We make a copy of nmethod. The copy is not in use. We know call sites might have invalid inline caches. Could we go through the calls sites and clear them?

Requesting a vm operation for each nmethod will be very expensive.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23573#discussion_r1999711219


More information about the hotspot-compiler-dev mailing list