@@ -69,6 +69,10 @@ public static ToHashByHashCode create() {
69
69
70
70
public abstract int execute (Node node , Object key );
71
71
72
+ public final int executeCached (Object key ) {
73
+ return execute (this , key );
74
+ }
75
+
72
76
@ Specialization
73
77
protected static int hashBoolean (Node node , boolean value ) {
74
78
return (int ) HashOperations .hashBoolean (value , getContext (node ), node );
@@ -113,10 +117,10 @@ protected static int hashSymbol(RubySymbol value,
113
117
}
114
118
115
119
@ Fallback
116
- protected static int hashOther (Object value ,
120
+ protected static int hashOther (Node node , Object value ,
117
121
@ Cached DispatchNode callHash ,
118
122
@ Cached HashCastResultNode cast ) {
119
- return cast .execute (callHash .call (value , "hash" ));
123
+ return cast .execute (node , callHash .call (value , "hash" ));
120
124
}
121
125
}
122
126
@@ -133,35 +137,41 @@ public static ToHashByIdentity getUncached() {
133
137
protected int toHashByIdentity (Object hashed ,
134
138
@ Cached ObjectIDNode objectIDNode ,
135
139
@ Cached HashCastResultNode hashCastResultNode ) {
136
- return hashCastResultNode .execute (objectIDNode .execute (hashed ));
140
+ return hashCastResultNode .execute (this , objectIDNode .execute (hashed ));
137
141
}
138
142
}
139
143
140
144
@ GenerateUncached
145
+ @ GenerateInline (inlineByDefault = true )
141
146
public abstract static class HashCastResultNode extends RubyBaseNode {
142
147
143
- public abstract int execute (Object key );
148
+ public abstract int execute (Node node , Object key );
149
+
150
+ public final int executeCached (Object key ) {
151
+ return execute (null , key );
152
+ }
144
153
145
154
@ Specialization
146
- protected int castInt (int hashed ) {
155
+ protected static int castInt (int hashed ) {
147
156
return hashed ;
148
157
}
149
158
150
159
@ Specialization
151
- protected int castLong (long hashed ) {
160
+ protected static int castLong (long hashed ) {
152
161
return (int ) hashed ;
153
162
}
154
163
155
164
@ Specialization
156
- protected int castBignum (RubyBignum hashed ) {
165
+ protected static int castBignum (RubyBignum hashed ) {
157
166
return BigIntegerOps .hashCode (hashed );
158
167
}
159
168
160
169
@ Specialization (guards = "!isRubyInteger(hashed)" )
161
- protected int castOther (Object hashed ,
170
+ protected static int castOther (Object hashed ,
162
171
@ Cached ToRubyIntegerNode toRubyInteger ,
163
- @ Cached HashCastResultNode hashCastResult ) {
164
- return hashCastResult .execute (toRubyInteger .execute (hashed ));
172
+ //recursive inlining is not supported
173
+ @ Cached (inline = false ) HashCastResultNode hashCastResult ) {
174
+ return hashCastResult .executeCached (toRubyInteger .execute (hashed ));
165
175
}
166
176
}
167
177
}
0 commit comments