Skip to content

Commit e95ab59

Browse files
committed
[GR-17601] Enable Truffle Regex by default
PullRequest: truffleruby/2798
2 parents 179369a + 920ccb5 commit e95ab59

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
New features:
44

5+
* [TRegex](https://github.com/oracle/graal/tree/master/regex) is now used by default, which provides large speedups for matching regular expressions.
56

67
Bug fixes:
78

mx.truffleruby/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "regex",
99
"subdir": True,
10-
"version": "42c83e13dc5ef41c5ca63e76175864c3d94626e2",
10+
"version": "d1b1b1f6355682ccbe7976617417397925fcf207",
1111
"urls": [
1212
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
1313
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
@@ -16,7 +16,7 @@
1616
{
1717
"name": "sulong",
1818
"subdir": True,
19-
"version": "42c83e13dc5ef41c5ca63e76175864c3d94626e2",
19+
"version": "d1b1b1f6355682ccbe7976617417397925fcf207",
2020
"urls": [
2121
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
2222
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},

spec/ruby/language/regexp_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@
115115
/foo.(?<=\d)/.match("fooA foo1").to_a.should == ["foo1"]
116116
end
117117

118-
# https://bugs.ruby-lang.org/issues/13671
119-
it "raises a RegexpError for lookbehind with specific characters" do
120-
r = Regexp.new("(?<!dss)", Regexp::IGNORECASE)
121-
-> { r =~ "✨" }.should raise_error(RegexpError)
118+
ruby_bug "#13671", ""..."3.2" do # https://bugs.ruby-lang.org/issues/13671
119+
it "handles a lookbehind with ss characters" do
120+
r = Regexp.new("(?<!dss)", Regexp::IGNORECASE)
121+
r.should =~ "✨"
122+
end
122123
end
123124

124125
it "supports (?<! ) (negative lookbehind)" do

src/main/java/org/truffleruby/options/Options.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public class Options {
129129
public final boolean WARN_DEPRECATED;
130130
/** --warn-experimental=true */
131131
public final boolean WARN_EXPERIMENTAL;
132-
/** --use-truffle-regex=false */
132+
/** --use-truffle-regex=true */
133133
public final boolean USE_TRUFFLE_REGEX;
134134
/** --warn-truffle-regex-compile-fallback=false */
135135
public final boolean WARN_TRUFFLE_REGEX_COMPILE_FALLBACK;

src/options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ EXPERT:
146146
WARN_EXPERIMENTAL: [[warn-experimental, -W], boolean, true, 'Sets experimental Warning category']
147147

148148
# Controlling the regular expression engines
149-
USE_TRUFFLE_REGEX: [use-truffle-regex, boolean, false, 'Use the Truffle regular expression engine for Regexp objects']
149+
USE_TRUFFLE_REGEX: [use-truffle-regex, boolean, true, 'Use the Truffle regular expression engine when possible and fallback to Joni otherwise']
150150
WARN_TRUFFLE_REGEX_COMPILE_FALLBACK: [warn-truffle-regex-compile-fallback, boolean, false, 'Warn when a Ruby Regexp could not be compiled to a Truffle Regex and Joni is used instead']
151151
WARN_TRUFFLE_REGEX_MATCH_FALLBACK: [warn-truffle-regex-match-fallback, boolean, false, 'Warn every time Truffle Regex cannot be used for a Regexp match (and instead Joni is used)']
152152

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class OptionsCatalog {
8383
public static final OptionKey<Boolean> CEXTS_LOG_WARNINGS_KEY = new OptionKey<>(false);
8484
public static final OptionKey<Boolean> WARN_DEPRECATED_KEY = new OptionKey<>(false);
8585
public static final OptionKey<Boolean> WARN_EXPERIMENTAL_KEY = new OptionKey<>(true);
86-
public static final OptionKey<Boolean> USE_TRUFFLE_REGEX_KEY = new OptionKey<>(false);
86+
public static final OptionKey<Boolean> USE_TRUFFLE_REGEX_KEY = new OptionKey<>(true);
8787
public static final OptionKey<Boolean> WARN_TRUFFLE_REGEX_COMPILE_FALLBACK_KEY = new OptionKey<>(false);
8888
public static final OptionKey<Boolean> WARN_TRUFFLE_REGEX_MATCH_FALLBACK_KEY = new OptionKey<>(false);
8989
public static final OptionKey<Boolean> ARGV_GLOBALS_KEY = new OptionKey<>(false);
@@ -604,7 +604,7 @@ public class OptionsCatalog {
604604

605605
public static final OptionDescriptor USE_TRUFFLE_REGEX = OptionDescriptor
606606
.newBuilder(USE_TRUFFLE_REGEX_KEY, "ruby.use-truffle-regex")
607-
.help("Use the Truffle regular expression engine for Regexp objects")
607+
.help("Use the Truffle regular expression engine when possible and fallback to Joni otherwise")
608608
.category(OptionCategory.EXPERT)
609609
.stability(OptionStability.EXPERIMENTAL)
610610
.build();

0 commit comments

Comments
 (0)