diff -r 0fa4c2b668b9 -r fc1c693e80bb src/share/vm/utilities/nativeCallStack.cpp --- a/src/share/vm/utilities/nativeCallStack.cpp Fri Jun 22 01:55:23 2018 -0700 +++ b/src/share/vm/utilities/nativeCallStack.cpp Mon Jun 25 07:59:51 2018 -0700 @@ -55,6 +55,7 @@ for (; index < NMT_TrackingStackDepth; index ++) { _stack[index] = NULL; } + _hash_value = 0; } // number of stack frames captured @@ -69,19 +70,16 @@ } // Hash code. Any better algorithm? -int NativeCallStack::hash() const { - long hash_val = _hash_value; +unsigned int NativeCallStack::hash() const { + uintptr_t hash_val = _hash_value; if (hash_val == 0) { - long pc; - int index; - for (index = 0; index < NMT_TrackingStackDepth; index ++) { - pc = (long)_stack[index]; - if (pc == 0) break; - hash_val += pc; + for (int index = 0; index < NMT_TrackingStackDepth; index++) { + if (_stack[index] == NULL) break; + hash_val += (uintptr_t)_stack[index]; } NativeCallStack* p = const_cast(this); - p->_hash_value = (int)(hash_val & 0xFFFFFFFF); + p->_hash_value = (unsigned int)(hash_val & 0xFFFFFFFF); } return _hash_value; }