diff --git a/src/share/vm/classfile/classLoaderStats.hpp b/src/share/vm/classfile/classLoaderStats.hpp index 72904c12d7c529acc0c95400032b06210f8f07c2..b9e0fc2cd758fd7a8b4cd32596a107e9bb52e5f1 100644 --- a/src/share/vm/classfile/classLoaderStats.hpp +++ b/src/share/vm/classfile/classLoaderStats.hpp @@ -101,8 +101,17 @@ protected: } 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(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