[crac] RFR: 8368929: [CRaC] Move CPUFeatures check to C/R engine [v4]

Radim Vansa rvansa at openjdk.org
Mon Oct 6 15:27:06 UTC 2025


On Fri, 3 Oct 2025 10:07:58 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix NoCPUFeaturesTest
>
> src/java.base/share/native/libcrexec/hashtable.hpp line 143:
> 
>> 141:   *value_ptr = std::forward<T>(value);
>> 142:   return true;
>> 143: }
> 
> I believe this usage of `std::forward` is incorrect as `T` is deduced from the hashtable class and not from the `value` parameter, so with this change it is now not possible to pass lvalues as `value`. I think the best would be to leave `T value` as it was and replace `std::forward` with `std::move` — lvalues will be copied then moved, rvalues will be just moved.
> 
> Same for `LinkedList::add`.

This should be a idiomatic use of perfect forwarding, since `T` is deduced the `T &&` is a universal reference and is treated as lvalue, depending on its use. The current code copies the argument; for `std::move` I would have to pass rvalue reference (therefore the method wouldn't be usable with const value).
Sources:
* https://blog.vero.site/post/rvalue-references 
* https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

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

PR Review Comment: https://git.openjdk.org/crac/pull/266#discussion_r2406997116


More information about the crac-dev mailing list