From 762064dc68a703c5010adcfed263393f51c1c28f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 13 Feb 2023 21:15:55 +1100 Subject: [PATCH] Remove scheduled optimization from ThreadedRegexVM This does not seem to actually speed up execution as threads will be dropped on next step anyway --- src/regex_impl.cc | 2 +- src/regex_impl.hh | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 1aa95a82..09efdb75 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -873,7 +873,7 @@ private: const auto res = m_program.instructions.size(); if (res >= max_instructions) throw regex_error(format("regex compiled to more than {} instructions", max_instructions)); - m_program.instructions.push_back({ op, false, 0, param }); + m_program.instructions.push_back({ op, 0, param }); return OpIndex(res); } diff --git a/src/regex_impl.hh b/src/regex_impl.hh index cd6b10c2..3593b9b0 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -112,9 +112,7 @@ struct CompiledRegex : RefCountable, UseMemoryDomain struct Instruction { Op op; - // Those mutables are used during execution - mutable bool scheduled; - mutable uint16_t last_step; + mutable uint16_t last_step; // mutable as used during execution Param param; }; static_assert(sizeof(Instruction) == 8); @@ -349,9 +347,6 @@ private: release_saves(thread.saves); }; auto consumed = [this, &thread]() { - if (m_program.instructions[thread.inst].scheduled) - return release_saves(thread.saves); - m_program.instructions[thread.inst].scheduled = true; m_threads.push_next(thread); }; @@ -479,9 +474,6 @@ private: while (not m_threads.current_is_empty()) step_thread(pos, current_step, m_threads.pop_current(), config); - for (auto& thread : m_threads.next_threads()) - m_program.instructions[thread.inst].scheduled = false; - if (pos == config.end or (m_threads.next_is_empty() and (not search or m_found_match)) or (m_found_match and any_match))