6798785: Crash in OopFlow::build_oop_map: incorrect comparison of 64bit pointers

Wed, 04 Feb 2009 11:44:57 -0800

author
never
date
Wed, 04 Feb 2009 11:44:57 -0800
changeset 997
1580954e694c
parent 996
5bfdb08ea692
child 998
1b9fc6e3171b

6798785: Crash in OopFlow::build_oop_map: incorrect comparison of 64bit pointers
Reviewed-by: phh, kvn

src/share/vm/adlc/dict2.cpp file | annotate | diff | comparison | revisions
src/share/vm/libadt/dict.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/adlc/dict2.cpp	Tue Feb 03 18:05:19 2009 -0800
     1.2 +++ b/src/share/vm/adlc/dict2.cpp	Wed Feb 04 11:44:57 2009 -0800
     1.3 @@ -316,9 +316,12 @@
     1.4    return strcmp((const char *)k1,(const char *)k2);
     1.5  }
     1.6  
     1.7 -// Slimey cheap key comparator.
     1.8 +// Cheap key comparator.
     1.9  int cmpkey(const void *key1, const void *key2) {
    1.10 -  return (int)((intptr_t)key1 - (intptr_t)key2);
    1.11 +  if (key1 == key2) return 0;
    1.12 +  intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
    1.13 +  if (delta > 0) return 1;
    1.14 +  return -1;
    1.15  }
    1.16  
    1.17  //=============================================================================
     2.1 --- a/src/share/vm/libadt/dict.cpp	Tue Feb 03 18:05:19 2009 -0800
     2.2 +++ b/src/share/vm/libadt/dict.cpp	Wed Feb 04 11:44:57 2009 -0800
     2.3 @@ -346,9 +346,12 @@
     2.4    return strcmp((const char *)k1,(const char *)k2);
     2.5  }
     2.6  
     2.7 -// Slimey cheap key comparator.
     2.8 +// Cheap key comparator.
     2.9  int32 cmpkey(const void *key1, const void *key2) {
    2.10 -  return (int32)((intptr_t)key1 - (intptr_t)key2);
    2.11 +  if (key1 == key2) return 0;
    2.12 +  intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
    2.13 +  if (delta > 0) return 1;
    2.14 +  return -1;
    2.15  }
    2.16  
    2.17  //=============================================================================

mercurial