RFR: JDK-8299386: Refactor metaprogramming to use <type_traits>

Justin King jcking at openjdk.org
Thu Dec 29 03:07:49 UTC 2022


On Wed, 28 Dec 2022 08:02:21 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Cleanup `metaprogramming/` to just use implementations from `<type_traits>` that are available in C++11 and onward.
>
> I started out intending to suggest replacing some of these changes by instead
> updating the uses of a couple that are rarely used, and getting rid of the
> associated pre-C++11 synonyms entirely. But it turns out most are rarely used,
> leading me to question this change almost in its entirety.
> 
> I think better would be a series of changes to replace uses of the synonyms
> with the corresponding element from <type_traits> and delete the synonyms.  I
> say "a series of changes" because I would prefer it not be done all in one
> changeset, for easier reviewing.
> 
> I suggest making an exception for EnableIf, because of the number of uses and
> because I'm hoping we'll be able to revise them in a better way in the not too
> distant future. Many of the uses are for function SFINAE, where the syntax is
> pretty horrible. We have the newer form of function SFINAE available (see
> ENABLE_IF), but I think in many/most cases even better would be to use C++17
> constexpr if. That's why I haven't proposed rewriting any of them using
> ENABLE_IF. I'm hopeful that using C++17 isn't too far away, now that there
> seems to be a compiler available for the aix-ppc port.

@kimbarrett I created 6 separate issues and associated PRs to deal with parts of them in isolation, so far.

JDK-8299399, JDK-8299396, JDK-8299395, JDK-8299398, JDK-8299402, and JDK-8299397.

Once those are in I'll re-visit this and see how we can chop the remaining work and remove most of what remains of `metaprogramming/`, minus `enableIf.hpp`, `logic.hpp`, and `primitiveConversions.hpp`.

@kimbarrett Though once its just those three files, it begs the question of whether having `metaprogramming/` itself is necessary. Maybe it makes more sense to have a single header under `utilities/`?

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

PR: https://git.openjdk.org/jdk/pull/11794


More information about the hotspot-dev mailing list