RFR: JDK-8283326: Implement SafeFetch statically [v3]
Thomas Stuefe
stuefe at openjdk.java.net
Tue Apr 12 15:52:00 UTC 2022
On Tue, 12 Apr 2022 14:16:22 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
> It's very unfortunate that such a simple task requires so much platform code. Would be nice if the Windows implementation would work everywhere :-) I'm not aware of a simple implementation which works reliably on all platforms, so LGTM.
Thanks Martin!
Honestly, the new implementation does not add much complexity which has not been there before. Discounting test addition, we have about 150 locs more, most caused by the unfortunate code duplication between bsd and Linux. But as you said, there is no easy separation here. I have fought with this aspect of the patch for too long now, and I think this is the cleanest and least surprising solution. It also follows what the copy_bytes_ assembly routines did before.
> Would it make sense to add a test case which uses a negative int as default value for SafeFetch32? Just to make sure the signed int gets passed correctly through the assembler stubs and reaches C++ code without loss of sign extension.
I fixed the indentations and extended the gtest as you proposed. I re-ran tests on x64, x86, arm-32 and aarch64, looks good.
Thanks!
Cheers Thomas
-------------
PR: https://git.openjdk.java.net/jdk/pull/7865
More information about the hotspot-dev
mailing list