RFR: 8370500: Change windows x64 implementation of os::current_stack_pointer() [v2]
Erik Österlund
eosterlund at openjdk.org
Mon Oct 27 08:53:46 UTC 2025
On Mon, 27 Oct 2025 05:07:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Erik Österlund has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Comment
>
> src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp line 346:
>
>> 344: __declspec(noinline)
>> 345: address os::current_stack_pointer() {
>> 346: return ((address)_AddressOfReturnAddress()) + sizeof(void*);
>
> The document for this function explicitly states
>> This address may not be used to access other memory locations (for example, the function's arguments).
>
> yet here we seem to be using it to then get the SP?
>
> A comment explaining why this yields the SP would also useful. Thanks.
Thanks for the review. I added a comment.
Regarding using this API to access other memory locations - I can see why they don't want us to do that. We are not accessing any memory locations here though. We are just doing some calculations about what the stack pointer must have been before the call instruction that transferred control to the os::current_stack_pointer() method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27956#discussion_r2464843874
More information about the hotspot-dev
mailing list