RFR: 8336421: ciMethod() constructor should use ConditionalMutexLocker(Compile_lock)
Aleksey Shipilev
shade at openjdk.org
Tue Jul 16 09:58:55 UTC 2024
On Tue, 16 Jul 2024 01:01:17 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> During Leyden testing with `-XX:+LogCompilation` flag I hit assert because `ciMethod()` could be called from `ciEnv::register_method()` which already holds `Compile_lock` lock. See call stack in JBS report.
> Use `ConditionalMutexLocker` in `ciMethod()`.
> This is normal code pattern used in other places where we can have nested locking: [compileBroker.cpp#L2847](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/compiler/compileBroker.cpp#L2847).
>
> Tested tier1.
Marked as reviewed by shade (Reviewer).
src/hotspot/share/ci/ciMethod.cpp line 113:
> 111: // 6328518 check hotswap conditions under the right lock.
> 112: bool should_take_Compile_lock = !Compile_lock->owned_by_self();
> 113: ConditionalMutexLocker locker(Compile_lock, should_take_Compile_lock, Mutex::_safepoint_check_flag);
I see no point in making an explicit variable. Most of the uses of `CML` just inline it:
https://github.com/openjdk/jdk/blob/8feabc849ba2f617c8c6dbb2ec5074297beb6437/src/hotspot/share/runtime/deoptimization.cpp#L122
-------------
PR Review: https://git.openjdk.org/jdk/pull/20187#pullrequestreview-2179779928
PR Review Comment: https://git.openjdk.org/jdk/pull/20187#discussion_r1679110677
More information about the hotspot-compiler-dev
mailing list