@@ -2248,23 +2248,28 @@ protected RubyString undumpNonAsciiCompatible(Object string,
2248
2248
@ NodeChild (value = "index" , type = RubyBaseNodeWithExecute .class )
2249
2249
@ NodeChild (value = "value" , type = RubyBaseNodeWithExecute .class )
2250
2250
@ ImportStatic (StringGuards .class )
2251
- public abstract static class SetByteNode extends CoreMethodNode {
2251
+ public abstract static class StringSetByteNode extends CoreMethodNode {
2252
2252
2253
- @ Child private StringHelperNodes .CheckIndexNode checkIndexNode = StringHelperNodesFactory .CheckIndexNodeGen
2254
- .create ();
2255
-
2256
- @ CreateCast ("index" )
2257
- protected ToIntNode coerceIndexToInt (RubyBaseNodeWithExecute index ) {
2258
- return ToIntNode .create (index );
2253
+ @ Specialization
2254
+ protected int doSetByte (RubyString string , Object indexObject , Object valueObject ,
2255
+ @ Cached ToIntNode toIntIndexNode ,
2256
+ @ Cached ToIntNode toIntValueNode ,
2257
+ @ Cached SetByteNode setByteNode ) {
2258
+ int index = toIntIndexNode .execute (indexObject );
2259
+ int value = toIntValueNode .execute (valueObject );
2260
+ return setByteNode .execute (this , string , index , value );
2259
2261
}
2262
+ }
2260
2263
2261
- @ CreateCast ("value" )
2262
- protected ToIntNode coerceValueToInt (RubyBaseNodeWithExecute value ) {
2263
- return ToIntNode .create (value );
2264
- }
2264
+ @ GenerateInline
2265
+ @ GenerateCached (false )
2266
+ public abstract static class SetByteNode extends RubyBaseNode {
2267
+
2268
+ public abstract int execute (Node node , RubyString string , int index , int value );
2265
2269
2266
2270
@ Specialization (guards = "tstring.isMutable()" )
2267
- protected int mutable (RubyString string , int index , int value ,
2271
+ protected static int mutable (RubyString string , int index , int value ,
2272
+ @ Cached @ Shared StringHelperNodes .CheckIndexNode checkIndexNode ,
2268
2273
@ Cached @ Shared RubyStringLibrary libString ,
2269
2274
@ Bind ("string.tstring" ) AbstractTruffleString tstring ,
2270
2275
@ Cached @ Shared MutableTruffleString .WriteByteNode writeByteNode ) {
@@ -2276,7 +2281,8 @@ protected int mutable(RubyString string, int index, int value,
2276
2281
}
2277
2282
2278
2283
@ Specialization (guards = "!tstring.isMutable()" )
2279
- protected int immutable (RubyString string , int index , int value ,
2284
+ protected static int immutable (RubyString string , int index , int value ,
2285
+ @ Cached @ Shared StringHelperNodes .CheckIndexNode checkIndexNode ,
2280
2286
@ Cached @ Shared RubyStringLibrary libString ,
2281
2287
@ Bind ("string.tstring" ) AbstractTruffleString tstring ,
2282
2288
@ Cached MutableTruffleString .AsMutableTruffleStringNode asMutableTruffleStringNode ,
0 commit comments