RFR: 8304939: os::win32::exit_process_or_thread should be marked noreturn [v5]

Kim Barrett kbarrett at openjdk.org
Mon Oct 30 09:34:36 UTC 2023


On Mon, 30 Oct 2023 08:26:09 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/os/windows/os_windows.cpp line 571:
>> 
>>> 569:   // let it proceed to exit normally
>>> 570:   exit_process_or_thread(EPT_THREAD, res);
>>> 571:   return res;
>> 
>> exit_process_or_thread is now marked noreturn.  So it looks like thread_native_entry never returns either
>> now, making the return of res (and res itself) effectively unused, and the comment obsolete.
>> 
>> I don't know what the implications of marking thread_native_entry noreturn might be.  Passing it as a
>> parameter to _beginthreadex might be a problem.  But it kind of seems like thread_native_entry shouldn't
>> be calling exit_process_or_thread?  The semantics of the "start_address" function for _beginthreadex
>> are rather lightly documented so far as I could find.
>
> It has to call `exit_process_or_thread` because of the exit bug. That means we will directly call `_endthreadex` instead of implicitly doing that by having the entry function return. The `return res` is redundant but keeps the compiler happy given the required declaration of the entry method.

I've been perusing the exit bug info, and ugh!  But okay.  The `return res` might *not* make the compiler happy
anymore, and might instead be cause for complaint by the compiler, now that `exit_process_or_thread` is marked
noreturn.  I guess use whichever form is needed to keep the compiler from complaining...

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16303#discussion_r1375913280


More information about the hotspot-dev mailing list