# HG changeset patch # User stuefe # Date 1589284416 -7200 # Tue May 12 13:53:36 2020 +0200 # Node ID 7d0f70351057132a165a715e2e40d5b0ec9ea889 # Parent 0431aef0e0e1ab11b2883fee5d19a57869eb032c 8244777: ClassLoaderStats VM Op uses constant hash value diff -r 0431aef0e0e1 -r 7d0f70351057 src/hotspot/share/classfile/classLoaderStats.hpp --- a/src/hotspot/share/classfile/classLoaderStats.hpp Tue May 12 07:16:54 2020 +0200 +++ b/src/hotspot/share/classfile/classLoaderStats.hpp Tue May 12 13:53:36 2020 +0200 @@ -102,8 +102,15 @@ } static unsigned oop_hash(oop const& s1) { - unsigned hash = (unsigned)((uintptr_t)&s1); - return hash ^ (hash >> LogMinObjAlignment); + 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