提交 d9238aab 编写于 作者: S stuefe

8244777: ClassLoaderStats VM Op uses constant hash value

Reviewed-by: coleenp, jbachorik
上级 2bf8f849
...@@ -101,8 +101,17 @@ protected: ...@@ -101,8 +101,17 @@ protected:
} }
static unsigned oop_hash(oop const& s1) { static unsigned oop_hash(oop const& s1) {
unsigned hash = (unsigned)((uintptr_t)&s1); // Robert Jenkins 1996 & Thomas Wang 1997
return hash ^ (hash >> LogMinObjAlignment); // 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*, typedef ResourceHashtable<oop, ClassLoaderStats*,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册