RFR: 8282365: Consolidate and improve division by constant idealizations [v35]
Quan Anh Mai
qamai at openjdk.org
Tue Dec 12 16:15:23 UTC 2023
On Thu, 7 Dec 2023 21:38:11 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> missing include
>
> src/hotspot/share/opto/divnode.hpp line 40:
>
>> 38: template <class T>
>> 39: void magic_divide_constants(T d, T N_neg, T N_pos, juint min_s, T& c, bool& c_ovf, juint& s);
>> 40: void magic_divide_constants_round_down(juint d, juint& c, juint& s);
>
> The definitions of these are in new file divconstants.cpp. So I think these should be in divconstants.hpp.
I see there are multiple cases where a header is defined in multiple source files, and these are used exclusively for `DivNode`s so putting them here seems logical.
> test/hotspot/gtest/opto/test_constant_division.cpp line 29:
>
>> 27: #include <random>
>> 28: #include <type_traits>
>> 29: #include <vector>
>
> We mostly don't use C++ standard library facilities in HotSpot, even in tests; see the style guide.
> <type_traits> is permitted. We have GrowableArray instead of <vector>. And we have os::random,
> unless this really needs something better (seems unlikely, other than needing to deal with wider
> types than int.) Also, stdlib includes at the end again (except I think unittest.hpp is supposed to
> _really_ be last.)
I see, for `vector` I did not look it up carefully and thought that we need a VM for `GrowableArray`s, and `<random>` is used mainly for wider types and custom bounds. I have changed them to use what are offered by OpenJDK instead.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/9947#discussion_r1424240505
PR Review Comment: https://git.openjdk.org/jdk/pull/9947#discussion_r1424238521
More information about the hotspot-compiler-dev
mailing list