RFR: 8316694: Implement relocation of nmethod within CodeCache [v46]
Chad Rakoczy
duke at openjdk.org
Tue Sep 9 23:22:52 UTC 2025
On Sat, 30 Aug 2025 00:32:02 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> It failed on linux-x64 and linux-aarch64. I tried locally on linux-x64 but it passed.
Sorry for the late response I have been on vacation.
The test failed due to a race condition involving the de-optimization of a `not_installed` nmethod.
`CompiledICLocker` uses `CompiledICProtectionBehaviour::is_safe(nm)` to determine whether it needs to acquire the `CompiledIC_lock`. If the nmethod `not_installed` at the time of the check, the lock is not acquired. However, if the nmethod is de-optimized and its state transitions to `not_entrant`, the next evaluation of `is_safe(nm)` will return false because the nmethod is no longer `not_installed`.
The fix is to ensure that the `NMethodState_lock` is held when checking `nmethod::is_not_installed`, to prevent concurrent state changes that could lead to this race.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23573#issuecomment-3272584418
More information about the hotspot-compiler-dev
mailing list