File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
src/main/java/org/truffleruby/core/hash Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
package org .truffleruby .core .hash ;
11
11
12
+ import com .oracle .truffle .api .profiles .BranchProfile ;
12
13
import org .truffleruby .Layouts ;
13
14
import org .truffleruby .RubyContext ;
14
15
import org .truffleruby .core .cast .BooleanCastNode ;
@@ -66,6 +67,7 @@ public static class SmallHashLiteralNode extends HashLiteralNode {
66
67
@ Child private CallDispatchHeadNode equalNode ;
67
68
@ Child private BooleanCastNode booleanCastNode ;
68
69
@ Child private FreezeHashKeyIfNeededNode freezeHashKeyIfNeededNode = FreezeHashKeyIfNeededNodeGen .create ();
70
+ private final BranchProfile duplicateKeyProfile = BranchProfile .create ();
69
71
70
72
public SmallHashLiteralNode (RubyNode [] keyValues ) {
71
73
super (keyValues );
@@ -91,6 +93,7 @@ public Object execute(VirtualFrame frame) {
91
93
if (i < size &&
92
94
hashed == PackedArrayStrategy .getHashed (store , i ) &&
93
95
callEqual (key , PackedArrayStrategy .getKey (store , i ))) {
96
+ duplicateKeyProfile .enter ();
94
97
PackedArrayStrategy .setKey (store , i , key );
95
98
PackedArrayStrategy .setValue (store , i , value );
96
99
duplicateKey = true ;
You can’t perform that action at this time.
0 commit comments