# HG changeset patch # User never # Date 1233776697 28800 # Node ID 1580954e694cbb13c75731cb8f3facdb38ccb161 # Parent 5bfdb08ea692579337f1600468f142eeda89252c 6798785: Crash in OopFlow::build_oop_map: incorrect comparison of 64bit pointers Reviewed-by: phh, kvn diff -r 5bfdb08ea692 -r 1580954e694c src/share/vm/adlc/dict2.cpp --- a/src/share/vm/adlc/dict2.cpp Tue Feb 03 18:05:19 2009 -0800 +++ b/src/share/vm/adlc/dict2.cpp Wed Feb 04 11:44:57 2009 -0800 @@ -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; } //============================================================================= diff -r 5bfdb08ea692 -r 1580954e694c src/share/vm/libadt/dict.cpp --- a/src/share/vm/libadt/dict.cpp Tue Feb 03 18:05:19 2009 -0800 +++ b/src/share/vm/libadt/dict.cpp Wed Feb 04 11:44:57 2009 -0800 @@ -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; } //=============================================================================