changeset 10831:04b1e9e7509d

8252754: Hash code calculation of JfrStackTrace is inconsistent Reviewed-by: shade
author jbachorik
date Thu, 24 Sep 2020 13:19:11 +0200
parents a3ac2e49cb4f
children 49dcf5b44dcb
files src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Thu Sep 24 13:19:09 2020 +0200
+++ b/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Thu Sep 24 13:19:11 2020 +0200
@@ -409,6 +409,7 @@
   u4 count = 0;
   _reached_root = true;
 
+  _hash = 1;
   while (!st.at_end()) {
     if (count >= _max_frames) {
       _reached_root = false;
@@ -430,7 +431,9 @@
     }
     const int lineno = method->line_number_from_bci(bci);
     // Can we determine if it's inlined?
-    _hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
+    _hash = (_hash * 31) + mid;
+    _hash = (_hash * 31) + bci;
+    _hash = (_hash * 31) + type;
     _frames[count] = JfrStackFrame(mid, bci, type, lineno);
     st.samples_next();
     count++;