On Wed, 16 Sep 2026 00:13:45 GMT, John R Rose <[email protected]> wrote:
>> Vladimir Kozlov has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> More cleanups and fixes. Includes RISC-V suggested changes.
>
> src/hotspot/share/compiler/compileBroker.cpp line 863:
>
>> 861: if (is_aot_thread) {
>> 862: int num = comp->num_aot_compiler_threads() + 1;
>> 863: comp->set_num_aot_compiler_threads(num);
>
> How is this update serialized relative to other threads which might be
> creating threads? Or is this only done in a single-threaded context? It’s
> not clear from reading the code locally – par for HotSpot, I guess.
>
> (My little nightmare here is that we could get here from a place like
> `possibly_add_compiler_threads`. Perhaps an assert-lock would be helpful?
> Or is there already such a thing in dominating code? I scanned upward about
> 50 lines and didn’t see anything like that.)
`CompileBroker::make_thread()` is called only once in
`CompileBroker::init_compiler_threads()` for C2 and C1 with
`_ac2_compile_queue` and `_ac1_compile_queue` as argument. See lines 992 and
1004. No other `make_thread()` calls passed these queue.
`possibly_add_compiler_threads()` passed `_c2_compile_queue` or
`_c1_compile_queue`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r4021641931