163 |
163 |
164 // hash a given key (oop) with the specified size |
164 // hash a given key (oop) with the specified size |
165 static unsigned int hash(oop key, int size) { |
165 static unsigned int hash(oop key, int size) { |
166 // shift right to get better distribution (as these bits will be zero |
166 // shift right to get better distribution (as these bits will be zero |
167 // with aligned addresses) |
167 // with aligned addresses) |
168 unsigned int addr = (unsigned int)((intptr_t)key); |
168 unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key)); |
169 #ifdef _LP64 |
169 #ifdef _LP64 |
170 return (addr >> 3) % size; |
170 return (addr >> 3) % size; |
171 #else |
171 #else |
172 return (addr >> 2) % size; |
172 return (addr >> 2) % size; |
173 #endif |
173 #endif |