Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8299688

Adopt C++14 compatible std::bit_cast introduced in C++20

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • tbd
    • 21
    • hotspot

    Description

      Hotspot currently has many places using C style casts, static_cast, or reinterpret_cast to convert between representations without changing the underlying bit representation.

      C++20 introduced std::bit_cast for this purpose and it is well defined. It is actually possible to implement bit_cast for C++14, without some constexpr support.

      This feature request is to refactor PrimitiveConversions::cast to bit_cast, expand bit_cast to support all compatible types, and use __builtin_bit_cast where available while falling back to the original implementations in PrimitiveConversions::cast. It then will replace some legacy conversion techniques with bit_cast.

      Attachments

        Issue Links

          Activity

            People

              jcking Justin King
              jcking Justin King
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: