Bug 1434726 - Avoid SIGBUS on SPARC systems in HashIIDPtrKey r=froydnj
authorPetr Sumbera <petr.sumbera@oracle.com>
Tue, 02 Apr 2019 17:27:23 +0000
changeset 467707 3b847ff23be24d5ea114872a9cde5ce582a9f64a
parent 467706 48f0ab684d3facb118a545dd2ca27dfb1394c4cd
child 467708 acce10271d625dffea6b3d4440612093edbfb947
push id112658
push useraciure@mozilla.com
push dateThu, 04 Apr 2019 04:41:45 +0000
treeherdermozilla-inbound@a36718c8163e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1434726
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1434726 - Avoid SIGBUS on SPARC systems in HashIIDPtrKey r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D25429
js/xpconnect/src/XPCMaps.cpp
--- a/js/xpconnect/src/XPCMaps.cpp
+++ b/js/xpconnect/src/XPCMaps.cpp
@@ -16,17 +16,19 @@ using namespace mozilla;
 
 /***************************************************************************/
 // static shared...
 
 // Note this is returning the hash of the bit pattern of the first part of the
 // nsID, not the hash of the pointer to the nsID.
 
 static PLDHashNumber HashIIDPtrKey(const void* key) {
-  return HashGeneric(*((uintptr_t*)key));
+  uintptr_t v;
+  memcpy(&v, key, sizeof(v));
+  return HashGeneric(v);
 }
 
 static bool MatchIIDPtrKey(const PLDHashEntryHdr* entry, const void* key) {
   return ((const nsID*)key)
       ->Equals(*((const nsID*)((PLDHashEntryStub*)entry)->key));
 }
 
 static PLDHashNumber HashNativeKey(const void* data) {