changeset 544:bbc497305a84

6798785: Crash in OopFlow::build_oop_map: incorrect comparison of 64bit pointers Reviewed-by: never
author asaha
date Wed, 22 Apr 2009 12:25:30 -0700
parents f927cc0f6d75
children 4fe6a4545fca
files src/share/vm/adlc/dict2.cpp src/share/vm/libadt/dict.cpp
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/adlc/dict2.cpp	Wed Apr 15 20:09:27 2009 -0700
+++ b/src/share/vm/adlc/dict2.cpp	Wed Apr 22 12:25:30 2009 -0700
@@ -316,9 +316,12 @@
   return strcmp((const char *)k1,(const char *)k2);
 }
 
-// Slimey cheap key comparator.
+// Cheap key comparator.
 int cmpkey(const void *key1, const void *key2) {
-  return (int)((intptr_t)key1 - (intptr_t)key2);
+  if (key1 == key2) return 0;
+  intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
+  if (delta > 0) return 1;
+  return -1;
 }
 
 //=============================================================================
--- a/src/share/vm/libadt/dict.cpp	Wed Apr 15 20:09:27 2009 -0700
+++ b/src/share/vm/libadt/dict.cpp	Wed Apr 22 12:25:30 2009 -0700
@@ -346,9 +346,12 @@
   return strcmp((const char *)k1,(const char *)k2);
 }
 
-// Slimey cheap key comparator.
+// Cheap key comparator.
 int32 cmpkey(const void *key1, const void *key2) {
-  return (int32)((intptr_t)key1 - (intptr_t)key2);
+  if (key1 == key2) return 0;
+  intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
+  if (delta > 0) return 1;
+  return -1;
 }
 
 //=============================================================================