@@ -206,7 +206,7 @@ protected int countFast(Object string, TStringWithEncoding[] args,
206
206
@ Cached ("libString.getEncoding(string)" ) RubyEncoding cachedEncoding ,
207
207
@ Cached (value = "squeeze()" , dimensions = 1 ) boolean [] squeeze ,
208
208
@ Cached ("findEncoding(libString.getTString(string), libString.getEncoding(string), cachedArgs, checkEncodingNode)" ) RubyEncoding compatEncoding ,
209
- @ Cached ("makeTables(cachedArgs, squeeze, compatEncoding)" ) StringSupport .TrTables tables ,
209
+ @ Cached ("makeTables(this, cachedArgs, squeeze, compatEncoding)" ) StringSupport .TrTables tables ,
210
210
@ Cached @ Shared TruffleString .GetInternalByteArrayNode byteArrayNode ,
211
211
@ Cached @ Shared TruffleString .GetByteCodeRangeNode getByteCodeRangeNode ) {
212
212
var byteArray = byteArrayNode .execute (tstring , encoding .tencoding );
@@ -239,7 +239,7 @@ protected int count(Object string, TStringWithEncoding[] tstringsWithEncs,
239
239
private int countSlow (InternalByteArray byteArray , TruffleString .CodeRange codeRange ,
240
240
TStringWithEncoding [] tstringsWithEncs , RubyEncoding enc ) {
241
241
final boolean [] table = squeeze ();
242
- final StringSupport .TrTables tables = makeTables (tstringsWithEncs , table , enc );
242
+ final StringSupport .TrTables tables = makeTables (this , tstringsWithEncs , table , enc );
243
243
return StringSupport .strCount (byteArray , codeRange , table , tables , enc .jcoding , this );
244
244
}
245
245
}
@@ -250,7 +250,7 @@ protected boolean[] squeeze() {
250
250
return new boolean [StringSupport .TRANS_SIZE + 1 ];
251
251
}
252
252
253
- protected RubyEncoding findEncoding (AbstractTruffleString tstring , RubyEncoding encoding ,
253
+ protected static RubyEncoding findEncoding (AbstractTruffleString tstring , RubyEncoding encoding ,
254
254
TStringWithEncoding [] tstringsWithEncs , EncodingNodes .CheckStringEncodingNode checkEncodingNode ) {
255
255
RubyEncoding enc = checkEncodingNode .executeCheckEncoding (tstring , encoding , tstringsWithEncs [0 ].tstring ,
256
256
tstringsWithEncs [0 ].encoding );
@@ -261,8 +261,8 @@ protected RubyEncoding findEncoding(AbstractTruffleString tstring, RubyEncoding
261
261
return enc ;
262
262
}
263
263
264
- protected StringSupport .TrTables makeTables (TStringWithEncoding [] tstringsWithEncs , boolean [] squeeze ,
265
- RubyEncoding enc ) {
264
+ protected static StringSupport .TrTables makeTables (Node node , TStringWithEncoding [] tstringsWithEncs ,
265
+ boolean [] squeeze , RubyEncoding enc ) {
266
266
// The trSetupTable method will consume the bytes from the rope one encoded character at a time and
267
267
// build a TrTable from this. Previously we started with the encoding of rope zero, and at each
268
268
// stage found a compatible encoding to build that TrTable with. Although we now calculate a single
@@ -275,12 +275,12 @@ protected StringSupport.TrTables makeTables(TStringWithEncoding[] tstringsWithEn
275
275
null ,
276
276
true ,
277
277
enc .jcoding ,
278
- this );
278
+ node );
279
279
280
280
for (int i = 1 ; i < tstringsWithEncs .length ; i ++) {
281
281
tables = StringSupport
282
282
.trSetupTable (tstringsWithEncs [i ].tstring , tstringsWithEncs [i ].encoding , squeeze , tables , false ,
283
- enc .jcoding , this );
283
+ enc .jcoding , node );
284
284
}
285
285
return tables ;
286
286
}
@@ -312,15 +312,17 @@ protected Object deleteBangEmpty(RubyString string, Object[] args) {
312
312
@ Specialization
313
313
protected Object deleteBangString (RubyString string , TStringWithEncoding [] args ,
314
314
@ Cached DeleteBangStringsNode deleteBangStringsNode ) {
315
- return deleteBangStringsNode .execute (string , args );
315
+ return deleteBangStringsNode .execute (this , string , args );
316
316
}
317
317
}
318
318
319
319
320
320
@ ImportStatic (StringGuards .class )
321
+ @ GenerateCached (false )
322
+ @ GenerateInline
321
323
public abstract static class DeleteBangStringsNode extends TrTableNode {
322
324
323
- public abstract Object execute (RubyString string , TStringWithEncoding [] tstringsWithEncs );
325
+ public abstract Object execute (Node node , RubyString string , TStringWithEncoding [] tstringsWithEncs );
324
326
325
327
@ Specialization (
326
328
guards = {
@@ -330,17 +332,16 @@ public abstract static class DeleteBangStringsNode extends TrTableNode {
330
332
"argsMatch(cachedArgs, args, equalNode)" ,
331
333
"libString.getEncoding(string) == cachedEncoding" },
332
334
limit = "getDefaultCacheLimit()" )
333
- protected static Object deleteBangFast (RubyString string , TStringWithEncoding [] args ,
335
+ protected static Object deleteBangFast (Node node , RubyString string , TStringWithEncoding [] args ,
334
336
@ Cached (value = "args" , dimensions = 1 ) TStringWithEncoding [] cachedArgs ,
335
337
@ Cached TruffleString .EqualNode equalNode ,
336
338
@ Cached @ Shared EncodingNodes .CheckStringEncodingNode checkEncodingNode ,
337
339
@ Cached @ Shared RubyStringLibrary libString ,
338
340
@ Cached ("libString.getEncoding(string)" ) RubyEncoding cachedEncoding ,
339
341
@ Cached (value = "squeeze()" , dimensions = 1 ) boolean [] squeeze ,
340
342
@ Cached ("findEncoding(libString.getTString(string), libString.getEncoding(string), cachedArgs, checkEncodingNode)" ) RubyEncoding compatEncoding ,
341
- @ Cached ("makeTables(cachedArgs, squeeze, compatEncoding)" ) StringSupport .TrTables tables ,
342
- @ Cached @ Exclusive InlinedBranchProfile nullProfile ,
343
- @ Bind ("this" ) Node node ) {
343
+ @ Cached ("makeTables(node, cachedArgs, squeeze, compatEncoding)" ) StringSupport .TrTables tables ,
344
+ @ Cached @ Exclusive InlinedBranchProfile nullProfile ) {
344
345
var processedTString = processStr (node , string , squeeze , compatEncoding , tables );
345
346
if (processedTString == null ) {
346
347
nullProfile .enter (node );
@@ -352,28 +353,28 @@ protected static Object deleteBangFast(RubyString string, TStringWithEncoding[]
352
353
}
353
354
354
355
@ Specialization (guards = "!string.tstring.isEmpty()" , replaces = "deleteBangFast" )
355
- protected Object deleteBangSlow (RubyString string , TStringWithEncoding [] args ,
356
+ protected static Object deleteBangSlow (Node node , RubyString string , TStringWithEncoding [] args ,
356
357
@ Cached @ Shared RubyStringLibrary libString ,
357
358
@ Cached @ Shared EncodingNodes .CheckStringEncodingNode checkEncodingNode ,
358
359
@ Cached @ Exclusive InlinedBranchProfile errorProfile ) {
359
360
if (args .length == 0 ) {
360
- errorProfile .enter (this );
361
- throw new RaiseException (getContext (), coreExceptions ().argumentErrorEmptyVarargs (this ));
361
+ errorProfile .enter (node );
362
+ throw new RaiseException (getContext (node ), coreExceptions (node ).argumentErrorEmptyVarargs (node ));
362
363
}
363
364
364
365
RubyEncoding enc = findEncoding (string .tstring , libString .getEncoding (string ), args , checkEncodingNode );
365
366
366
- return deleteBangSlow (string , args , enc );
367
+ return deleteBangSlow (node , string , args , enc );
367
368
}
368
369
369
370
@ TruffleBoundary
370
- private Object deleteBangSlow (RubyString string , TStringWithEncoding [] tstringsWithEncs ,
371
+ private static Object deleteBangSlow (Node node , RubyString string , TStringWithEncoding [] tstringsWithEncs ,
371
372
RubyEncoding enc ) {
372
373
final boolean [] squeeze = new boolean [StringSupport .TRANS_SIZE + 1 ];
373
374
374
- final StringSupport .TrTables tables = makeTables (tstringsWithEncs , squeeze , enc );
375
+ final StringSupport .TrTables tables = makeTables (node , tstringsWithEncs , squeeze , enc );
375
376
376
- var processedTString = processStr (this , string , squeeze , enc , tables );
377
+ var processedTString = processStr (node , string , squeeze , enc , tables );
377
378
if (processedTString == null ) {
378
379
return nil ;
379
380
}
0 commit comments