43
43
import java .util .Iterator ;
44
44
45
45
import com .oracle .truffle .api .strings .AbstractTruffleString ;
46
+ import com .oracle .truffle .api .strings .TruffleString ;
46
47
import com .oracle .truffle .api .strings .TruffleStringBuilder ;
47
48
import org .jcodings .Encoding ;
48
49
import org .jcodings .specific .EUCJPEncoding ;
@@ -108,11 +109,6 @@ public static String getRegexErrorMessage(AbstractTruffleString source, Exceptio
108
109
return BacktraceFormatter .formatJavaThrowableMessage (e ) + ": /" + source + "/" + options .toOptionsString ();
109
110
}
110
111
111
- private static Regex getRegexpFromCache (TStringBuilder bytes , RubyEncoding encoding , RegexpOptions options ,
112
- AbstractTruffleString source ) throws DeferredRaiseException {
113
- return makeRegexp (null , bytes , options , encoding , source , null );
114
- }
115
-
116
112
public ClassicRegexp (TStringWithEncoding strEnc , RegexpOptions originalOptions )
117
113
throws DeferredRaiseException {
118
114
if (strEnc .encoding .isDummy ) {
@@ -124,11 +120,8 @@ public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
124
120
TStringBuilder unescaped = preprocess (strEnc , strEnc .encoding , fixedEnc , RegexpSupport .ErrorMode .RAISE );
125
121
final RubyEncoding computedEnc = computeRegexpEncoding (optionsArray , strEnc .encoding , fixedEnc );
126
122
final RegexpOptions options = optionsArray [0 ];
127
- this .pattern = getRegexpFromCache (
128
- unescaped ,
129
- computedEnc ,
130
- options ,
131
- strEnc .forceEncoding (computedEnc ).tstring );
123
+ final TruffleString source = strEnc .forceEncoding (computedEnc ).tstring ;
124
+ this .pattern = makeRegexp (null , unescaped , options , computedEnc , source , null );
132
125
this .options = options ;
133
126
this .str = strEnc ;
134
127
}
@@ -1062,7 +1055,6 @@ private static TStringWithEncoding setRegexpEncoding(TStringWithEncoding value,
1062
1055
1063
1056
private static ClassicRegexp checkRegexpSyntax (TStringWithEncoding value , RegexpOptions options )
1064
1057
throws DeferredRaiseException {
1065
- // This is only for syntax checking but this will as a side effect create an entry in the regexp cache.
1066
1058
return new ClassicRegexp (value , options );
1067
1059
}
1068
1060
0 commit comments