|
11 | 11 |
|
12 | 12 | import com.oracle.truffle.api.dsl.Cached;
|
13 | 13 | import com.oracle.truffle.api.dsl.CachedContext;
|
| 14 | +import com.oracle.truffle.api.dsl.Fallback; |
14 | 15 | import com.oracle.truffle.api.dsl.GenerateUncached;
|
15 | 16 | import com.oracle.truffle.api.dsl.Specialization;
|
16 | 17 | import org.truffleruby.RubyContext;
|
|
25 | 26 | import org.truffleruby.core.symbol.SymbolNodes;
|
26 | 27 | import org.truffleruby.core.string.ImmutableRubyString;
|
27 | 28 | import org.truffleruby.language.RubyBaseNode;
|
28 |
| -import org.truffleruby.language.RubyGuards; |
29 | 29 | import org.truffleruby.language.dispatch.DispatchNode;
|
30 | 30 |
|
31 | 31 | public abstract class HashingNodes {
|
@@ -109,24 +109,18 @@ protected int hashImmutableString(ImmutableRubyString value,
|
109 | 109 | return (int) stringHashNode.execute(value);
|
110 | 110 | }
|
111 | 111 |
|
112 |
| - |
113 | 112 | @Specialization
|
114 | 113 | protected int hashSymbol(RubySymbol value,
|
115 | 114 | @Cached SymbolNodes.HashSymbolNode symbolHashNode) {
|
116 | 115 | return (int) symbolHashNode.execute(value);
|
117 | 116 | }
|
118 | 117 |
|
119 |
| - @Specialization(guards = "!isSpecialized(value)") |
| 118 | + @Fallback |
120 | 119 | protected int hash(Object value,
|
121 | 120 | @Cached DispatchNode callHash,
|
122 | 121 | @Cached HashCastResultNode cast) {
|
123 | 122 | return cast.execute(callHash.call(value, "hash"));
|
124 | 123 | }
|
125 |
| - |
126 |
| - protected static boolean isSpecialized(Object value) { |
127 |
| - return RubyGuards.isPrimitive(value) || value instanceof RubyBignum || value instanceof RubyString || |
128 |
| - value instanceof ImmutableRubyString || value instanceof RubySymbol; |
129 |
| - } |
130 | 124 | }
|
131 | 125 |
|
132 | 126 | @GenerateUncached
|
|
0 commit comments