+{"files":[{"patch":"@@ -1212,1 +1212,1 @@\n- fvalue.j = u.long_value;\n+ fvalue.j = u.long_value();\n","filename":"src\/hotspot\/share\/interpreter\/interpreterRuntime.cpp","additions":1,"deletions":1,"binary":false,"changes":2,"status":"modified"},{"patch":"@@ -956,2 +956,1 @@\n- jlong_accessor acc;\n- acc.long_value = jlong_cast(d);\n+ jlong_accessor acc(jlong_cast(d));\n@@ -976,2 +975,1 @@\n- jlong_accessor acc;\n- acc.long_value = d;\n+ jlong_accessor acc(d);\n","filename":"src\/hotspot\/share\/opto\/output.cpp","additions":2,"deletions":4,"binary":false,"changes":6,"status":"modified"},{"patch":"@@ -1000,7 +1000,0 @@\n-template<typename T, typename F> T bit_cast(F from) { \/\/ replace with the real thing when we can use c++20\n- T to;\n- static_assert(sizeof(to) == sizeof(from), \"must be of the same size\");\n- memcpy(&to, &from, sizeof(to));\n- return to;\n-}\n-\n","filename":"src\/hotspot\/share\/services\/heapDumper.cpp","additions":0,"deletions":7,"binary":false,"changes":7,"status":"modified"},{"patch":"@@ -38,0 +38,1 @@\n+#include <type_traits>\n@@ -608,10 +609,11 @@\n-typedef union {\n- jfloat f;\n- jint i;\n-} FloatIntConv;\n-\n-typedef union {\n- jdouble d;\n- jlong l;\n- julong ul;\n-} DoubleLongConv;\n+template<typename T, typename F>\n+inline T bit_cast(const F& from) noexcept { \/\/ replace with the real thing when we can use c++20\n+ static_assert(sizeof(T) == sizeof(F), \"must be of the same size\");\n+ static_assert(std::is_trivially_copyable<T>(), \"output type must be trivially copyable\");\n+ static_assert(std::is_trivially_copyable<F>(), \"input type must be trivially copyable\");\n+ static_assert(std::is_default_constructible<T>() &&\n+ std::is_trivially_copy_assignable<T>(), \"implementation limits\");\n+ T to;\n+ memcpy(&to, &from, sizeof(T));\n+ return to;\n+}\n@@ -619,2 +621,2 @@\n-inline jint jint_cast (jfloat x) { return ((FloatIntConv*)&x)->i; }\n-inline jfloat jfloat_cast (jint x) { return ((FloatIntConv*)&x)->f; }\n+inline jint jint_cast (jfloat x) { return bit_cast<jint> (x); }\n+inline jfloat jfloat_cast (jint x) { return bit_cast<jfloat> (x); }\n@@ -622,3 +624,3 @@\n-inline jlong jlong_cast (jdouble x) { return ((DoubleLongConv*)&x)->l; }\n-inline julong julong_cast (jdouble x) { return ((DoubleLongConv*)&x)->ul; }\n-inline jdouble jdouble_cast (jlong x) { return ((DoubleLongConv*)&x)->d; }\n+inline jlong jlong_cast (jdouble x) { return bit_cast<jlong> (x); }\n+inline julong julong_cast (jdouble x) { return bit_cast<julong> (x); }\n+inline jdouble jdouble_cast (jlong x) { return bit_cast<jdouble>(x); }\n@@ -644,3 +646,13 @@\n-union jlong_accessor {\n- jint words[2];\n- jlong long_value;\n+#ifndef _LP64\n+\n+struct jlong_accessor {\n+ jint words[2];\n+\n+ jlong_accessor() = default;\n+ jlong_accessor(jlong j) {\n+ static_assert(sizeof(this->words) == sizeof(jlong), \"\");\n+ memcpy(&(words), &j, sizeof(jlong));\n+ }\n+ jlong long_value() const {\n+ bit_cast<jlong>(words);\n+ }\n@@ -649,0 +661,2 @@\n+#endif \/\/ !_LP64\n+\n","filename":"src\/hotspot\/share\/utilities\/globalDefinitions.hpp","additions":32,"deletions":18,"binary":false,"changes":50,"status":"modified"}]}
0 commit comments