RFR: 8269466: Factor out the common code for initializing and starting internal VM JavaThreads [v3]

David Holmes david.holmes at oracle.com
Thu Jul 1 21:58:07 UTC 2021


On 2/07/2021 3:36 am, Coleen Phillimore wrote:
> On Thu, 1 Jul 2021 16:14:22 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> 
>>> David Holmes has updated the pull request incrementally with three additional commits since the last revision:
>>>
>>>   - Rename vm_exit_on_thread_allocation_failure to vm_exit_on_osthread_failure
>>>   - Adjust comment
>>>   - Comments from PR review:
>>>     - remove unnecessary new_thread NULL checks
>>>     - adjust some comments
>>>     - fix whitespace
>>
>> src/hotspot/share/compiler/compileBroker.cpp line 909:
>>
>>> 907:   // JavaThread due to lack of resources. We will handle that failure below.
>>> 908:
>>> 909:   if (new_thread->osthread() != NULL) {
>>
>> I think you do need to check `new_thread != NULL` here to please Parfait for `default:` case.
> 
> Really?  We have this sort of code everywhere.  We don't check the result of a new expression anywhere else.

It isn't the result of the new expression that needs checking. The 
switch statement has a default: clause which calls ShouldNotReachHere(). 
IIRC Parfait does not understand things like ShouldNotReachHere() never 
return, and so it thinks "new_thread" may still be NULL if we followed 
the default: path through the switch.

I will restore this NULL check with a comment.

Thanks,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/4629
> 


More information about the hotspot-compiler-dev mailing list