1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:15:07 +00:00

LibRegex: Use a copy-on-write vector for fork state

This commit is contained in:
Ali Mohammad Pur 2022-11-03 02:36:25 +03:30 committed by Ali Mohammad Pur
parent 48a4c9c1ad
commit f1851346d3
3 changed files with 140 additions and 8 deletions

View file

@ -1060,9 +1060,11 @@ ALWAYS_INLINE ExecutionResult OpCode_Checkpoint::execute(MatchInput const& input
ALWAYS_INLINE ExecutionResult OpCode_JumpNonEmpty::execute(MatchInput const& input, MatchState& state) const
{
auto current_position = state.string_position;
u64 current_position = state.string_position;
auto checkpoint_ip = state.instruction_position + size() + checkpoint();
if (input.checkpoints.get(checkpoint_ip).value_or(current_position) != current_position) {
auto checkpoint_position = input.checkpoints.find(checkpoint_ip);
if (checkpoint_position != input.checkpoints.end() && checkpoint_position->value != current_position) {
auto form = this->form();
if (form == OpCodeId::Jump) {