RFR: 8364558: Failure to generate compiler stubs from compiler thread should not crash VM when compilation disabled due to full CodeCache
Andrew Dinn
adinn at openjdk.org
Wed Aug 6 08:38:06 UTC 2025
On Tue, 5 Aug 2025 23:22:34 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> src/hotspot/share/opto/c2compiler.cpp line 95:
>>
>>> 93: // If there was an error generating the blob then UseCompiler will
>>> 94: // have been unset and we need to skip the remaining initialization
>>> 95: if (UseCompiler) {
>>
>> Inverting the if condition here would result in slightly more readable code: you could early return `false`, avoid the additional indentation, and the comment at L93-94 would refer to the true branch of the `if` statement.
>
> Should we also check it before calling `compiler_stubs_init()` too?
We could but I don't think it makes much difference. This is a race we could lose at any time. If we have already lost at the point of call then the called method will attempt the buffer allocate and fail almost immediately. So, checking here doesn't help avoid any real work.
I will modify the logic to return early -- although not because I agree that the current code is difficult to read. But it is important to preserve the current indentation, making the cumulative change history simpler to follow.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26642#discussion_r2256385920
More information about the hotspot-dev
mailing list