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

Vladimir Kozlov kvn at openjdk.org
Sat Mar 15 00:57:59 UTC 2025


On Wed, 12 Mar 2025 19:01:12 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Chad Rakoczy has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix build issues
>
> src/hotspot/share/code/nmethod.cpp line 1399:
> 
>> 1397: {
>> 1398:   debug_only(NoSafepointVerifier nsv;)
>> 1399:   assert_locked_or_safepoint(CodeCache_lock);
> 
> Is this lock enough to prevent GC scan it before you finish initializing it?

My question is related to `_state` field value. During usual nmethod creation the `_state` is `not_installed`.
nmethod you are coping has `in_use` state. Someone may see this state before all fields are set.
That is why I am asking if `CodeCache_lock` prevents any other VM's threads see it.

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

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


More information about the hotspot-compiler-dev mailing list