Skip to content
Permalink
Browse files

8244777: ClassLoaderStats VM Op uses constant hash value

Reviewed-by: coleenp, jbachorik
  • Loading branch information
Thomas Stuefe
Thomas Stuefe committed May 14, 2020
1 parent 587505f commit 5b6f81de071d53a8786f8d90ee18e3d11397fd23
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/hotspot/share/classfile/classLoaderStats.hpp
@@ -102,8 +102,17 @@ class ClassLoaderStatsClosure : public CLDClosure {
}

static unsigned oop_hash(oop const& s1) {
unsigned hash = (unsigned)((uintptr_t)&s1);
return hash ^ (hash >> LogMinObjAlignment);
// Robert Jenkins 1996 & Thomas Wang 1997
// http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
uintptr_t tmp = cast_from_oop<uintptr_t>(s1);
unsigned hash = (unsigned)tmp;
hash = ~hash + (hash << 15);
hash = hash ^ (hash >> 12);
hash = hash + (hash << 2);
hash = hash ^ (hash >> 4);
hash = hash * 2057;
hash = hash ^ (hash >> 16);
return hash;
}

typedef ResourceHashtable<oop, ClassLoaderStats*,

0 comments on commit 5b6f81d

Please sign in to comment.
You can’t perform that action at this time.