mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
LibRegex: Treat checks against nonexistent checkpoints as empty
Due to optimiser shenanigans in the tree alternative form, some JumpNonEmpty ops might be moved before their Checkpoint instruction. It is safe to assume the distance between the nonexistent checkpoint and the current op is zero, so just do that.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
358378c1c0
commit
eee90f4aa2
@@ -1085,7 +1085,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Checkpoint::execute(MatchInput const&, Matc
|
||||
ALWAYS_INLINE ExecutionResult OpCode_JumpNonEmpty::execute(MatchInput const& input, MatchState& state) const
|
||||
{
|
||||
u64 current_position = state.string_position;
|
||||
auto checkpoint_position = state.checkpoints[checkpoint()];
|
||||
auto checkpoint_position = state.checkpoints.get(checkpoint()).value_or(0);
|
||||
|
||||
if (checkpoint_position != 0 && checkpoint_position != current_position + 1) {
|
||||
auto form = this->form();
|
||||
|
||||
Reference in New Issue
Block a user