|
@@ -293,7 +293,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
|
|
|
if (recursion_level > c_max_recursion)
|
|
|
return false;
|
|
|
|
|
|
- Vector<MatchState> fork_low_prio_states;
|
|
|
+ Vector<MatchState, 64> reversed_fork_low_prio_states;
|
|
|
MatchState fork_high_prio_state;
|
|
|
Optional<bool> success;
|
|
|
|
|
@@ -323,7 +323,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
|
|
|
|
|
|
switch (result) {
|
|
|
case ExecutionResult::Fork_PrioLow:
|
|
|
- fork_low_prio_states.prepend(state);
|
|
|
+ reversed_fork_low_prio_states.append(state);
|
|
|
continue;
|
|
|
case ExecutionResult::Fork_PrioHigh:
|
|
|
fork_high_prio_state = state;
|
|
@@ -344,8 +344,13 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta
|
|
|
return true;
|
|
|
case ExecutionResult::Failed:
|
|
|
return false;
|
|
|
- case ExecutionResult::Failed_ExecuteLowPrioForks:
|
|
|
- return execute_low_prio_forks(input, state, output, fork_low_prio_states, recursion_level + 1);
|
|
|
+ case ExecutionResult::Failed_ExecuteLowPrioForks: {
|
|
|
+ Vector<MatchState> fork_low_prio_states;
|
|
|
+ fork_low_prio_states.ensure_capacity(reversed_fork_low_prio_states.size());
|
|
|
+ for (ssize_t i = reversed_fork_low_prio_states.size() - 1; i >= 0; i--)
|
|
|
+ fork_low_prio_states.unchecked_append(move(reversed_fork_low_prio_states[i]));
|
|
|
+ return execute_low_prio_forks(input, state, output, move(fork_low_prio_states), recursion_level + 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|