Skip to content

Commit 34651a1

Browse files
author
Nicolas Laurent
committed
Revert "ensure primitive map keys are promoted to the widest possible type to avoid"
This reverts commit b98b0545de1d9977665a0cf4544d01391f162339.
1 parent d3c0e2e commit 34651a1

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

src/main/java/org/truffleruby/core/objectspace/WeakMapNodes.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ protected int size(RubyWeakMap map) {
5555
@CoreMethod(names = { "key?", "member?", "include?" }, required = 1)
5656
public abstract static class MemberNode extends CoreMethodArrayArgumentsNode {
5757

58-
@Specialization // ensures all integer keys are promoted to long
59-
protected Object isMember(RubyWeakMap map, long key) {
60-
return isMember(map, (Object) key);
61-
}
62-
63-
@Specialization // ensures all floating keys are promoted to double
64-
protected Object isMember(RubyWeakMap map, double key) {
65-
return isMember(map, (Object) key);
66-
}
67-
6858
@Specialization
6959
protected boolean isMember(RubyWeakMap map, Object key) {
7060
return map.storage.get(key) != null;
@@ -74,16 +64,6 @@ protected boolean isMember(RubyWeakMap map, Object key) {
7464
@CoreMethod(names = "[]", required = 1)
7565
public abstract static class GetIndexNode extends CoreMethodArrayArgumentsNode {
7666

77-
@Specialization // ensures all integer keys are promoted to long
78-
protected Object get(RubyWeakMap map, long key) {
79-
return get(map, (Object) key);
80-
}
81-
82-
@Specialization // ensures all floating keys are promoted to double
83-
protected Object get(RubyWeakMap map, double key) {
84-
return get(map, (Object) key);
85-
}
86-
8767
@Specialization
8868
protected Object get(RubyWeakMap map, Object key) {
8969
Object value = map.storage.get(key);
@@ -94,16 +74,6 @@ protected Object get(RubyWeakMap map, Object key) {
9474
@Primitive(name = "weakmap_aset")
9575
public abstract static class SetIndexNode extends CoreMethodArrayArgumentsNode {
9676

97-
@Specialization // ensures all integer keys are promoted to long
98-
protected Object set(RubyWeakMap map, long key, Object value) {
99-
return set(map, (Object) key, value);
100-
}
101-
102-
@Specialization // ensures all floating keys are promoted to double
103-
protected Object set(RubyWeakMap map, double key, Object value) {
104-
return set(map, (Object) key, value);
105-
}
106-
10777
@Specialization
10878
protected Object set(RubyWeakMap map, Object key, Object value) {
10979
map.storage.put(key, value);

0 commit comments

Comments
 (0)