RFR: 8353365: TOUCH_ASSERT_POISON clears GetLastError()

Julian Waters jwaters at openjdk.org
Fri Apr 4 07:41:54 UTC 2025


On Fri, 4 Apr 2025 05:43:36 GMT, David Holmes <dholmes at openjdk.org> wrote:

> This is a very simple fix to save/restore the "last error" value on Windows, so that the TOUCH_ASSERT_POISON mechanism used in assert/guarantee/fatal, does not clear it.
> 
> Testing
>  - new Windows-only gtest added to vmErrors test group
>  - tiers 103 sanity
> 
> Thanks.

test/hotspot/gtest/utilities/test_vmerror.cpp line 38:

> 36:                    "fatal error: GetLastError should be 6 - actually: 6") {
> 37:   SetLastError(6);
> 38:   fatal("GetLastError should be 6 - actually: %d", (int)GetLastError());

I wonder if HotSpot has a preference for the more specific C++ casts. Also, wouldn't it be better to check the value of GetLastError after fatal is called rather than comparing the strings (I assume that's what the TEST_VM_ASSERT_MSG is doing)?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24435#discussion_r2028282409


More information about the hotspot-dev mailing list