src/share/vm/utilities/nativeCallStack.cpp

changeset 9337
fc1c693e80bb
parent 7078
c6211b707068
child 9485
7a6239517d46
     1.1 --- a/src/share/vm/utilities/nativeCallStack.cpp	Fri Jun 22 01:55:23 2018 -0700
     1.2 +++ b/src/share/vm/utilities/nativeCallStack.cpp	Mon Jun 25 07:59:51 2018 -0700
     1.3 @@ -55,6 +55,7 @@
     1.4    for (; index < NMT_TrackingStackDepth; index ++) {
     1.5      _stack[index] = NULL;
     1.6    }
     1.7 +  _hash_value = 0;
     1.8  }
     1.9  
    1.10  // number of stack frames captured
    1.11 @@ -69,19 +70,16 @@
    1.12  }
    1.13  
    1.14  // Hash code. Any better algorithm?
    1.15 -int NativeCallStack::hash() const {
    1.16 -  long hash_val = _hash_value;
    1.17 +unsigned int NativeCallStack::hash() const {
    1.18 +  uintptr_t hash_val = _hash_value;
    1.19    if (hash_val == 0) {
    1.20 -    long pc;
    1.21 -    int  index;
    1.22 -    for (index = 0; index < NMT_TrackingStackDepth; index ++) {
    1.23 -      pc = (long)_stack[index];
    1.24 -      if (pc == 0) break;
    1.25 -      hash_val += pc;
    1.26 +    for (int index = 0; index < NMT_TrackingStackDepth; index++) {
    1.27 +      if (_stack[index] == NULL) break;
    1.28 +      hash_val += (uintptr_t)_stack[index];
    1.29      }
    1.30  
    1.31      NativeCallStack* p = const_cast<NativeCallStack*>(this);
    1.32 -    p->_hash_value = (int)(hash_val & 0xFFFFFFFF);
    1.33 +    p->_hash_value = (unsigned int)(hash_val & 0xFFFFFFFF);
    1.34    }
    1.35    return _hash_value;
    1.36  }

mercurial