@@ -1803,9 +1803,13 @@ public abstract static class ScrubNode extends PrimitiveArrayArgumentsNode {
1803
1803
.create ();
1804
1804
@ Child private RopeNodes .BytesNode bytesNode = RopeNodes .BytesNode .create ();
1805
1805
1806
- @ Specialization (guards = { "isBrokenCodeRange(string.rope, codeRangeNode)" , "isAsciiCompatible(string)" })
1807
- protected RubyString scrubAsciiCompat (RubyString string , RubyProc block ) {
1808
- final Rope rope = string .rope ;
1806
+ @ Specialization (
1807
+ guards = {
1808
+ "isBrokenCodeRange(rope, codeRangeNode)" ,
1809
+ "isAsciiCompatible(rope)" })
1810
+ protected RubyString scrubAsciiCompat (Object string , RubyProc block ,
1811
+ @ CachedLibrary (limit = "2" ) RubyStringLibrary strings ,
1812
+ @ Bind ("strings.getRope(string)" ) Rope rope ) {
1809
1813
final Encoding enc = rope .getEncoding ();
1810
1814
final CodeRange cr = codeRangeNode .execute (rope );
1811
1815
Rope buf = RopeConstants .EMPTY_ASCII_8BIT_ROPE ;
@@ -1874,10 +1878,14 @@ protected RubyString scrubAsciiCompat(RubyString string, RubyProc block) {
1874
1878
return makeStringNode .fromRope (buf );
1875
1879
}
1876
1880
1877
- @ Specialization (guards = { "isBrokenCodeRange(string.rope, codeRangeNode)" , "!isAsciiCompatible(string)" })
1878
- protected RubyString scrubAsciiIncompatible (RubyString string , RubyProc block ,
1881
+ @ Specialization (
1882
+ guards = {
1883
+ "isBrokenCodeRange(rope, codeRangeNode)" ,
1884
+ "!isAsciiCompatible(rope)" })
1885
+ protected RubyString scrubAsciiIncompatible (Object string , RubyProc block ,
1886
+ @ CachedLibrary (limit = "2" ) RubyStringLibrary strings ,
1887
+ @ Bind ("strings.getRope(string)" ) Rope rope ,
1879
1888
@ Cached RopeNodes .CalculateCharacterLengthNode calculateCharacterLengthNode ) {
1880
- final Rope rope = string .rope ;
1881
1889
final Encoding enc = rope .getEncoding ();
1882
1890
final CodeRange cr = codeRangeNode .execute (rope );
1883
1891
Rope buf = RopeConstants .EMPTY_ASCII_8BIT_ROPE ;
0 commit comments