@@ -622,10 +622,10 @@ protected Object slice(Object string, Object start, Object length) {
622
622
623
623
@ Specialization (guards = "isRubyRange(range)" )
624
624
protected Object sliceRange (Object string , Object range , NotProvided other ,
625
- @ Cached @ Exclusive RubyStringLibrary libString ,
625
+ @ Cached @ Shared RubyStringLibrary strings ,
626
626
@ Cached RangeNodes .NormalizedStartLengthNode startLengthNode ,
627
627
@ Cached @ Exclusive ConditionProfile negativeStart ) {
628
- final int stringLength = codePointLength (libString .getTString (string ), libString .getEncoding (string ));
628
+ final int stringLength = codePointLength (strings .getTString (string ), strings .getEncoding (string ));
629
629
final int [] startLength = startLengthNode .execute (range , stringLength );
630
630
631
631
int start = startLength [0 ];
@@ -1536,7 +1536,7 @@ protected Object initializeCopySelfIsSameAsFrom(RubyString self, Object from) {
1536
1536
"!tstring.isNative()" ,
1537
1537
"tstring.isImmutable()" }, limit = "1" )
1538
1538
protected Object initializeCopyImmutable (RubyString self , Object from ,
1539
- @ Cached @ Exclusive RubyStringLibrary stringsFrom ,
1539
+ @ Cached @ Shared RubyStringLibrary stringsFrom ,
1540
1540
@ Cached @ Shared StringHelperNodes .StringGetAssociatedNode stringGetAssociatedNode ,
1541
1541
@ Bind ("stringsFrom.getTString(from)" ) AbstractTruffleString tstring ) {
1542
1542
self .setTString (tstring , stringsFrom .getEncoding (from ));
@@ -1552,7 +1552,7 @@ protected Object initializeCopyImmutable(RubyString self, Object from,
1552
1552
"!tstring.isNative()" ,
1553
1553
"tstring.isMutable()" }, limit = "1" )
1554
1554
protected Object initializeCopyMutable (RubyString self , Object from ,
1555
- @ Cached @ Exclusive RubyStringLibrary stringsFrom ,
1555
+ @ Cached @ Shared RubyStringLibrary stringsFrom ,
1556
1556
@ Cached @ Shared StringHelperNodes .StringGetAssociatedNode stringGetAssociatedNode ,
1557
1557
@ Cached MutableTruffleString .SubstringByteIndexNode copyMutableTruffleStringNode ,
1558
1558
@ Bind ("stringsFrom.getTString(from)" ) AbstractTruffleString tstring ) {
@@ -1570,12 +1570,12 @@ protected Object initializeCopyMutable(RubyString self, Object from,
1570
1570
1571
1571
@ Specialization (guards = { "!areEqual(self, from)" , "tstring.isNative()" })
1572
1572
protected Object initializeCopyNative (RubyString self , RubyString from ,
1573
- @ Cached @ Exclusive RubyStringLibrary libString ,
1573
+ @ Cached @ Shared RubyStringLibrary stringsFrom ,
1574
1574
@ Cached @ Shared StringHelperNodes .StringGetAssociatedNode stringGetAssociatedNode ,
1575
1575
@ Cached TruffleString .GetInternalNativePointerNode getInternalNativePointerNode ,
1576
1576
@ Cached MutableTruffleString .FromNativePointerNode fromNativePointerNode ,
1577
1577
@ Bind ("from.tstring" ) AbstractTruffleString tstring ) {
1578
- var encoding = libString .getEncoding (from );
1578
+ var encoding = stringsFrom .getEncoding (from );
1579
1579
var tencoding = encoding .tencoding ;
1580
1580
final Pointer fromPointer = (Pointer ) getInternalNativePointerNode .execute (tstring , tencoding );
1581
1581
@@ -1744,8 +1744,8 @@ protected RubyString replace(RubyString string, RubyString other,
1744
1744
1745
1745
@ Specialization
1746
1746
protected RubyString replace (RubyString string , ImmutableRubyString other ,
1747
- @ Cached @ Exclusive RubyStringLibrary libString ) {
1748
- string .setTString (other .tstring , libString .getEncoding (other ));
1747
+ @ Cached @ Exclusive RubyStringLibrary libOther ) {
1748
+ string .setTString (other .tstring , libOther .getEncoding (other ));
1749
1749
return string ;
1750
1750
}
1751
1751
@@ -1860,7 +1860,7 @@ public abstract static class ScrubNode extends PrimitiveArrayArgumentsNode {
1860
1860
limit = "1" )
1861
1861
protected RubyString scrubAsciiCompat (Object string , RubyProc block ,
1862
1862
@ Cached @ Shared RubyStringLibrary strings ,
1863
- @ Cached @ Shared TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
1863
+ @ Cached @ Exclusive TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
1864
1864
@ Bind ("strings.getTString(string)" ) AbstractTruffleString tstring ,
1865
1865
@ Bind ("strings.getEncoding(string)" ) RubyEncoding encoding ) {
1866
1866
final Encoding enc = encoding .jcoding ;
@@ -1945,7 +1945,7 @@ protected RubyString scrubAsciiCompat(Object string, RubyProc block,
1945
1945
limit = "1" )
1946
1946
protected RubyString scrubAsciiIncompatible (Object string , RubyProc block ,
1947
1947
@ Cached @ Shared RubyStringLibrary strings ,
1948
- @ Cached @ Shared TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
1948
+ @ Cached @ Exclusive TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
1949
1949
@ Bind ("strings.getTString(string)" ) AbstractTruffleString tstring ,
1950
1950
@ Bind ("strings.getEncoding(string)" ) RubyEncoding encoding ) {
1951
1951
final Encoding enc = encoding .jcoding ;
@@ -3209,7 +3209,7 @@ protected Object stringAwkSplitAsciiOnly(Object string, int limit, Object block,
3209
3209
@ Cached @ Exclusive ConditionProfile trailingEmptyStringProfile ,
3210
3210
@ Cached TruffleString .MaterializeNode materializeNode ,
3211
3211
@ Cached TruffleString .ReadByteNode readByteNode ,
3212
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringNode ,
3212
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringNode ,
3213
3213
@ Cached @ Exclusive LoopConditionProfile loopProfile ,
3214
3214
@ Bind ("strings.getTString(string)" ) AbstractTruffleString tstring ,
3215
3215
@ Bind ("strings.getEncoding(string)" ) RubyEncoding encoding ) {
@@ -3285,7 +3285,7 @@ protected Object stringAwkSplit(Object string, int limit, Object block,
3285
3285
@ Cached @ Exclusive ConditionProfile trailingSubstringProfile ,
3286
3286
@ Cached CreateCodePointIteratorNode createCodePointIteratorNode ,
3287
3287
@ Cached TruffleStringIterator .NextNode nextNode ,
3288
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringNode ,
3288
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringNode ,
3289
3289
@ Cached @ Exclusive LoopConditionProfile loopProfile ,
3290
3290
@ Bind ("strings.getTString(string)" ) AbstractTruffleString tstring ,
3291
3291
@ Bind ("strings.getEncoding(string)" ) RubyEncoding encoding ) {
@@ -3458,7 +3458,7 @@ protected Object stringChrAtOutOfBounds(Object string, int byteIndex,
3458
3458
protected Object stringChrAtSingleByte (Object string , int byteIndex ,
3459
3459
@ Cached @ Shared RubyStringLibrary strings ,
3460
3460
@ Cached @ Shared TruffleString .GetByteCodeRangeNode codeRangeNode ,
3461
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringByteIndexNode ,
3461
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringByteIndexNode ,
3462
3462
@ Bind ("strings.getTString(string)" ) AbstractTruffleString tstring ,
3463
3463
@ Bind ("strings.getEncoding(string)" ) RubyEncoding encoding ) {
3464
3464
return createSubString (substringByteIndexNode , tstring , encoding , byteIndex , 1 );
@@ -3473,7 +3473,7 @@ protected Object stringChrAt(Object string, int byteIndex,
3473
3473
@ Cached @ Shared RubyStringLibrary strings ,
3474
3474
@ Cached @ Shared TruffleString .GetByteCodeRangeNode codeRangeNode ,
3475
3475
@ Cached GetActualEncodingNode getActualEncodingNode ,
3476
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringByteIndexNode ,
3476
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringByteIndexNode ,
3477
3477
@ Cached TruffleString .ForceEncodingNode forceEncodingNode ,
3478
3478
@ Cached TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
3479
3479
@ Cached ConditionProfile brokenProfile ,
@@ -3647,7 +3647,7 @@ protected Object stringFindCharacterOffsetTooLarge(Object string, int offset,
3647
3647
protected Object stringFindCharacterSingleByte (Object string , int offset ,
3648
3648
@ Cached @ Shared RubyStringLibrary strings ,
3649
3649
@ Cached @ Shared SingleByteOptimizableNode singleByteOptimizableNode ,
3650
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringNode ) {
3650
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringNode ) {
3651
3651
// Taken from Rubinius's String::find_character.
3652
3652
return createSubString (substringNode , strings , string , offset , 1 );
3653
3653
}
@@ -3662,7 +3662,7 @@ protected Object stringFindCharacter(Object string, int offset,
3662
3662
@ Cached @ Shared RubyStringLibrary strings ,
3663
3663
@ Cached TruffleString .ByteLengthOfCodePointNode byteLengthOfCodePointNode ,
3664
3664
@ Cached @ Shared SingleByteOptimizableNode singleByteOptimizableNode ,
3665
- @ Cached @ Shared TruffleString .SubstringByteIndexNode substringNode ) {
3665
+ @ Cached @ Exclusive TruffleString .SubstringByteIndexNode substringNode ) {
3666
3666
// Taken from Rubinius's String::find_character.
3667
3667
var tstring = strings .getTString (string );
3668
3668
var tencoding = strings .getTEncoding (string );
@@ -3685,7 +3685,7 @@ protected RubyString stringFromCodepointSimple(int code, RubyEncoding encoding,
3685
3685
@ Cached ConditionProfile isUTF8Profile ,
3686
3686
@ Cached ConditionProfile isUSAsciiProfile ,
3687
3687
@ Cached ConditionProfile isAscii8BitProfile ,
3688
- @ Cached @ Shared TruffleString .FromCodePointNode fromCodePointNode ) {
3688
+ @ Cached @ Exclusive TruffleString .FromCodePointNode fromCodePointNode ) {
3689
3689
final TruffleString tstring ;
3690
3690
if (isUTF8Profile .profile (encoding == Encodings .UTF_8 )) {
3691
3691
tstring = TStringConstants .UTF8_SINGLE_BYTE [code ];
@@ -4169,7 +4169,7 @@ public abstract static class StringToInumPrimitiveNode extends PrimitiveArrayArg
4169
4169
protected Object base10 (Object string , int base , boolean strict , boolean raiseOnError ,
4170
4170
@ Cached @ Shared RubyStringLibrary libString ,
4171
4171
@ Cached @ Shared TruffleString .ParseLongNode parseLongNode ,
4172
- @ Cached BranchProfile notLazyLongProfile ,
4172
+ @ Cached @ Shared BranchProfile notLazyLongProfile ,
4173
4173
@ Cached @ Shared FixnumOrBignumNode fixnumOrBignumNode ,
4174
4174
@ Cached @ Shared BranchProfile exceptionProfile ) {
4175
4175
var tstring = libString .getTString (string );
@@ -4188,7 +4188,7 @@ protected Object base0(Object string, int base, boolean strict, boolean raiseOnE
4188
4188
@ Cached @ Shared TruffleString .ParseLongNode parseLongNode ,
4189
4189
@ Cached TruffleString .CodePointAtByteIndexNode codePointNode ,
4190
4190
@ Cached ConditionProfile notEmptyProfile ,
4191
- @ Cached @ Exclusive BranchProfile notLazyLongProfile ,
4191
+ @ Cached @ Shared BranchProfile notLazyLongProfile ,
4192
4192
@ Cached @ Shared FixnumOrBignumNode fixnumOrBignumNode ,
4193
4193
@ Cached @ Shared BranchProfile exceptionProfile ) {
4194
4194
var tstring = libString .getTString (string );
0 commit comments