mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
LibRegex: Move required bytecode.flatten() outside optimization function
Not running the optimization passes should not leave the bytecode in a broken state. Fixes #5146.
This commit is contained in:
parent
423cdd447d
commit
2947ae7d6e
Notes:
github-actions[bot]
2025-06-24 16:44:34 +00:00
Author: https://github.com/alimpfard
Commit: 2947ae7d6e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5200
Reviewed-by: https://github.com/gmta ✅
2 changed files with 2 additions and 2 deletions
|
@ -74,6 +74,7 @@ Regex<Parser>::Regex(ByteString pattern, typename ParserTraits<Parser>::OptionsT
|
||||||
|
|
||||||
Parser parser(lexer, regex_options);
|
Parser parser(lexer, regex_options);
|
||||||
parser_result = parser.parse();
|
parser_result = parser.parse();
|
||||||
|
parser_result.bytecode.flatten();
|
||||||
|
|
||||||
run_optimization_passes();
|
run_optimization_passes();
|
||||||
|
|
||||||
|
@ -90,6 +91,7 @@ Regex<Parser>::Regex(regex::Parser::Result parse_result, ByteString pattern, typ
|
||||||
: pattern_value(move(pattern))
|
: pattern_value(move(pattern))
|
||||||
, parser_result(move(parse_result))
|
, parser_result(move(parse_result))
|
||||||
{
|
{
|
||||||
|
parser_result.bytecode.flatten();
|
||||||
run_optimization_passes();
|
run_optimization_passes();
|
||||||
if (parser_result.error == regex::Error::NoError)
|
if (parser_result.error == regex::Error::NoError)
|
||||||
matcher = make<Matcher<Parser>>(this, regex_options | static_cast<decltype(regex_options.value())>(parser_result.options.value()));
|
matcher = make<Matcher<Parser>>(this, regex_options | static_cast<decltype(regex_options.value())>(parser_result.options.value()));
|
||||||
|
|
|
@ -28,8 +28,6 @@ using Detail::Block;
|
||||||
template<typename Parser>
|
template<typename Parser>
|
||||||
void Regex<Parser>::run_optimization_passes()
|
void Regex<Parser>::run_optimization_passes()
|
||||||
{
|
{
|
||||||
parser_result.bytecode.flatten();
|
|
||||||
|
|
||||||
rewrite_with_useless_jumps_removed();
|
rewrite_with_useless_jumps_removed();
|
||||||
|
|
||||||
auto blocks = split_basic_blocks(parser_result.bytecode);
|
auto blocks = split_basic_blocks(parser_result.bytecode);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue