75
75
@ CoreModule ("Truffle::RegexpOperations" )
76
76
public class TruffleRegexpNodes {
77
77
78
- @ TruffleBoundary
79
78
public static Matcher createMatcher (RubyContext context , RubyRegexp regexp , Rope stringRope , byte [] stringBytes ,
80
79
boolean encodingConversion , int start , Node currentNode ) {
81
80
final Encoding enc = checkEncoding (regexp , stringRope .getEncoding (), stringRope .getCodeRange ());
@@ -86,10 +85,9 @@ public static Matcher createMatcher(RubyContext context, RubyRegexp regexp, Rope
86
85
regex = encodingCache .getOrCreate (enc , e -> makeRegexpForEncoding (context , regexp , e , currentNode ));
87
86
}
88
87
89
- return regex . matcher ( stringBytes , start , stringBytes . length );
88
+ return getMatcher ( regex , stringBytes , start );
90
89
}
91
90
92
- @ TruffleBoundary
93
91
public static Encoding checkEncoding (RubyRegexp regexp , Encoding strEnc , CodeRange codeRange ) {
94
92
final Encoding regexEnc = regexp .regex .getEncoding ();
95
93
@@ -103,6 +101,12 @@ public static Encoding checkEncoding(RubyRegexp regexp, Encoding strEnc, CodeRan
103
101
return strEnc ;
104
102
}
105
103
104
+ @ TruffleBoundary
105
+ private static Matcher getMatcher (Regex regex , byte [] stringBytes , int start ) {
106
+ return regex .matcher (stringBytes , start , stringBytes .length );
107
+ }
108
+
109
+ @ TruffleBoundary
106
110
private static Regex makeRegexpForEncoding (RubyContext context , RubyRegexp regexp , Encoding enc , Node currentNode ) {
107
111
final Encoding [] fixedEnc = new Encoding []{ null };
108
112
final Rope sourceRope = regexp .source ;
0 commit comments