Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8250928: JFR: Improve hash algorithm for stack traces
Reviewed-by: egahlin
  • Loading branch information
gabrielreid authored and egahlin committed Aug 7, 2020
1 parent 68c08af commit 642343eb67a5956d99a71cb023ed1c3a3466c70f
Showing 1 changed file with 4 additions and 2 deletions.
@@ -240,6 +240,7 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
vfs.next();
}

_hash = 1;
while (!vfs.at_end()) {
if (count >= _max_frames) {
_reached_root = false;
@@ -255,8 +256,9 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
else {
bci = vfs.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, method->method_holder());
vfs.next();
count++;

0 comments on commit 642343e

Please sign in to comment.