Skip to content

Commit 5f2e980

Browse files
committed
Remove getRegexpFromCache(), there is no cache and it just calls makeRegexp()
1 parent d45a5a4 commit 5f2e980

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/main/java/org/truffleruby/core/regexp/ClassicRegexp.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.util.Iterator;
4444

4545
import com.oracle.truffle.api.strings.AbstractTruffleString;
46+
import com.oracle.truffle.api.strings.TruffleString;
4647
import com.oracle.truffle.api.strings.TruffleStringBuilder;
4748
import org.jcodings.Encoding;
4849
import org.jcodings.specific.EUCJPEncoding;
@@ -108,11 +109,6 @@ public static String getRegexErrorMessage(AbstractTruffleString source, Exceptio
108109
return BacktraceFormatter.formatJavaThrowableMessage(e) + ": /" + source + "/" + options.toOptionsString();
109110
}
110111

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-
116112
public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
117113
throws DeferredRaiseException {
118114
if (strEnc.encoding.isDummy) {
@@ -124,11 +120,8 @@ public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
124120
TStringBuilder unescaped = preprocess(strEnc, strEnc.encoding, fixedEnc, RegexpSupport.ErrorMode.RAISE);
125121
final RubyEncoding computedEnc = computeRegexpEncoding(optionsArray, strEnc.encoding, fixedEnc);
126122
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);
132125
this.options = options;
133126
this.str = strEnc;
134127
}
@@ -1062,7 +1055,6 @@ private static TStringWithEncoding setRegexpEncoding(TStringWithEncoding value,
10621055

10631056
private static ClassicRegexp checkRegexpSyntax(TStringWithEncoding value, RegexpOptions options)
10641057
throws DeferredRaiseException {
1065-
// This is only for syntax checking but this will as a side effect create an entry in the regexp cache.
10661058
return new ClassicRegexp(value, options);
10671059
}
10681060

0 commit comments

Comments
 (0)