Simplify Split regex op handling by swapping target

This commit is contained in:
Maxime Coste 2024-03-11 21:47:14 +11:00
parent 84fc2844a1
commit e06acd3dc8

View File

@ -408,18 +408,14 @@ private:
thread.inst = inst.param.jump_target; thread.inst = inst.param.jump_target;
break; break;
case CompiledRegex::Split: case CompiledRegex::Split:
if (instructions[inst.param.split.target].last_step == current_step) if (auto target = inst.param.split.target;
break; instructions[target].last_step != current_step)
if (thread.saves >= 0)
++m_saves[thread.saves].refcount;
if (inst.param.split.prioritize_parent)
m_threads.push_current({inst.param.split.target, thread.saves});
else
{ {
m_threads.push_current(thread); if (thread.saves >= 0)
thread.inst = inst.param.split.target; ++m_saves[thread.saves].refcount;
if (not inst.param.split.prioritize_parent)
std::swap(thread.inst, target);
m_threads.push_current({target, thread.saves});
} }
break; break;
case CompiledRegex::Save: case CompiledRegex::Save: