Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1321)

Issue 2950783003: VM(RegExp): Allow OSR optimization of RegExp :matcher functions. (Closed)

Created:
3 years, 6 months ago by Vyacheslav Egorov (Google)
Modified:
3 years, 6 months ago
Reviewers:
erikcorry, rmacnak
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM(RegExp): Allow OSR optimization of RegExp :matcher functions. Previously these functions would only contain a single CheckStackOverflowInstr in a backtracking block and that CheckStackOverflowInstr would have a zero loop_depth - which means it would not be considered eligable for OSR. This change: * adds CheckStackOverflowInstr with non-zero loop_depth in two other places (Boyer-Moore lookahead skip loop and greedy loop) where loops arise in the generated IL; * sets non-zero loop depth on the CheckStackOverflowInstr in the backtracking block; * adds a flag on CheckStackOverflowInstr that allows optimizing compiler to optimize away those checks that were inserted solely to serve as OSR entries. We allow the optimizing compiler to remove preemption checks from non-backtracking loops in the regexp code because those loops unlike backtracking have guaranteed O(input_length) time complexity. Performance Implications ------------------------ This change improves performance of regexps in cases where regexp spends a lot of time in the first invocation (either due to backtracking or due to long non matching prefix) by allowing VM to optimize the :matcher while :matcher is running. For example on regex-redux[1] benchmark it improves Dart performance by 3x (from ~18s to ~6s on my Mac Book Pro). [1] https://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexredux&lang=dart&id=2 BUG= R=erikcorry@google.com Committed: https://github.com/dart-lang/sdk/commit/d87cc52c3ee791e4dff9136c5c80353deb0f36a3

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -16 lines) Patch
M runtime/vm/compiler.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M runtime/vm/intermediate_language.h View 3 chunks +19 lines, -2 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/regexp.h View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/regexp.cc View 4 chunks +7 lines, -4 lines 0 comments Download
M runtime/vm/regexp_assembler.h View 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/regexp_assembler_ir.h View 2 chunks +3 lines, -2 lines 0 comments Download
M runtime/vm/regexp_assembler_ir.cc View 4 chunks +12 lines, -5 lines 2 comments Download

Messages

Total messages: 11 (6 generated)
Vyacheslav Egorov (Google)
Hi Erik, Please take a look.
3 years, 6 months ago (2017-06-20 16:38:29 UTC) #3
rmacnak
It might be worth keeping the new StackOverflowChecks in the optimized code to handle interrupt ...
3 years, 6 months ago (2017-06-20 17:57:15 UTC) #5
erikcorry
LGTM The important thing is to have preemption in the backtracking, since that can run ...
3 years, 6 months ago (2017-06-21 07:54:07 UTC) #6
Vyacheslav Egorov (Google)
Thanks. I updated CL description to include the reasoning for removing those preemption checks. https://codereview.chromium.org/2950783003/diff/1/runtime/vm/regexp_assembler_ir.cc ...
3 years, 6 months ago (2017-06-21 11:42:04 UTC) #9
Vyacheslav Egorov (Google)
3 years, 6 months ago (2017-06-21 11:46:52 UTC) #11
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
d87cc52c3ee791e4dff9136c5c80353deb0f36a3 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698