Skip to content

Commit 9350593

Browse files
cgrandrichhickey
authored andcommitted
align the structure of hasheq/dohasheq with equiv/pcequiv to avoid deoptimization of hash by hotspot
Signed-off-by: Rich Hickey <richhickey@gmail.com>
1 parent d77489d commit 9350593

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/jvm/clojure/lang/Util.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ static public int hasheq(Object o){
122122
if(o instanceof Number)
123123
return Numbers.hasheq((Number)o);
124124
else if(o instanceof IHashEq)
125-
return ((IHashEq)o).hasheq();
125+
return dohasheq(o);
126126
return o.hashCode();
127127
}
128128

129+
public static int dohasheq(Object o) {
130+
return ((IHashEq)o).hasheq();
131+
}
132+
129133
static public int hashCombine(int seed, int hash){
130134
//a la boost
131135
seed ^= hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);

0 commit comments

Comments
 (0)