Fix issues with TypeIndex on Windows, i.e. hash on the type name where available since this otherwise causes problems when loading different shared libraries with RTLD_LOCAL.
PiperOrigin-RevId: 353279508 Change-Id: I7e5aeb5d043efddf924228517dd9ec93eaaf6c6c
This commit is contained in:
parent
3516dc97f3
commit
e8dd848664
@ -24,9 +24,9 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS)
|
||||
#include "tensorflow/core/platform/hash.h"
|
||||
#endif // defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
#endif // defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS)
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
@ -62,7 +62,7 @@ class TypeIndex {
|
||||
|
||||
#if defined(__GXX_RTTI) || defined(_CPPRTTI)
|
||||
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS)
|
||||
// Use a hash based on the type name to avoid issues due to RTLD_LOCAL on
|
||||
// MacOS (b/156979412).
|
||||
return TypeIndex(Hash64(typeid(T).name()), typeid(T).name());
|
||||
@ -70,7 +70,7 @@ class TypeIndex {
|
||||
// Use the real type name if we have RTTI.
|
||||
return TypeIndex(static_cast<uint64>(reinterpret_cast<intptr_t>(hash_bit)),
|
||||
typeid(T).name());
|
||||
#endif // defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
#endif // defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS)
|
||||
|
||||
#else
|
||||
#if TARGET_OS_OSX
|
||||
|
Loading…
x
Reference in New Issue
Block a user