anchor.diff:  
   end;
   
  +procedure TFLREDFA.DestroyStatePool(var StatePool:PFLREDFAStatePool);
  +var Pool,NextPool:PFLREDFAStatePool;
  +    State:PFLREDFAState;
  +begin
  + Pool:=StatePool;
  + StatePool:=nil;
  + while assigned(Pool) do begin
  +  NextPool:=Pool^.Next;
  +  State:=Pool^.States;
  +  while assigned(State) and (State<>Pool^.EndState) do begin
  +   FreeState(State);
  +   inc(ptruint(State),StateSize);
  +  end;
  +  FreeMem(Pool^.States);
  +  FreeMem(Pool);
  +  Pool:=NextPool;
  + end;
  +end;
  +
  +procedure TFLREDFA.FreeUsedStatePool;
  +var Pool,NextPool:PFLREDFAStatePool;
  +    State:PFLREDFAState;
  +begin
  + Pool:=StatePoolUsed;
  + StatePoolUsed:=nil;
  + while assigned(Pool) do begin
  +  NextPool:=Pool^.Next;
  +  State:=Pool^.States;
  +  while assigned(State) and (State<>Pool^.EndState) do begin
  +   FreeState(State);
  +   inc(ptruint(State),StateSize);
  +  end;
  +  FillChar(Pool^.States^,StatePoolSize,AnsiChar(#0));
  +  Pool^.Next:=StatePoolFree;
  +  StatePoolFree:=Pool;
  +  Pool:=NextPool;
  + end;
  +end;
  +
  +function TFLREDFA.AllocateNewStatePool:PFLREDFAStatePool;
  +begin
  + if assigned(StatePoolFree) then begin
  +  result:=StatePoolFree;
  +  StatePoolFree:=result^.Next;
  + end else begin
  +  GetMem(result,SizeOf(TFLREDFAStatePool));
  +  FillChar(result^,SizeOf(TFLREDFAStatePool),AnsiChar(#0));
  +  GetMem(result^.States,StatePoolSizePowerOfTwo);
  +  FillChar(result^.States^,StatePoolSize,AnsiChar(#0));
  +  result^.EndState:=pointer(ptruint(ptruint(result^.States)+ptruint(StatePoolSize)));
  + end;
  + result^.Next:=StatePoolUsed;
  + StatePoolUsed:=result;
  + result^.NextState:=result^.States;
  +end;
  +
  +function TFLREDFA.GetState:PFLREDFAState;
  +begin
  + if StatePoolUsed^.NextState=StatePoolUsed^.EndState then begin
  +  AllocateNewStatePool;
  + end;
  + result:=StatePoolUsed^.NextState;
  + inc(ptruint(StatePoolUsed^.NextState),StateSize);
  +end;
  +
  +function TFLREDFA.TakeOverState(TakeOverFrom:PFLREDFAState):PFLREDFAState;
  +begin
  + result:=GetState;
  + result^.Instructions:=TakeOverFrom^.Instructions;
  + result^.CountInstructions:=TakeOverFrom^.CountInstructions;
  + result^.Flags:=TakeOverFrom^.Flags;
  + TakeOverFrom^.Instructions:=nil;
  + TakeOverFrom^.CountInstructions:=0;
  + TakeOverFrom^.Flags:=0;
  +end;
  +
  +procedure TFLREDFA.FreeState(State:PFLREDFAState);
  +begin
  + if assigned(State) then begin
  +  SetLength(State^.Instructions,0);
  +  if assigned(StatePoolUsed) and
  +     ((ptruint(ptruint(State)-ptruint(StatePoolUsed^.States))<StatePoolSize) and
  +      (pointer(ptruint(ptruint(StatePoolUsed^.NextState)-ptruint(StateSize)))=State)) then begin
  +   FillChar(State^,StateSize,AnsiChar(#0));
  +   dec(ptruint(StatePoolUsed^.NextState),StateSize);
  +  end;
  + end;
  +end;
  +
  +procedure TFLREDFA.Reset;
  +var Index:longint;
  +    State:PFLREDFAState;
  +begin
  +
  + // Reset state pools
  + FreeUsedStatePool;
  + AllocateNewStatePool;
  +
  + // Reset state cache
  + StateCache.Clear;
  + CountStatesCached:=0;
  +
  + // Reset and recaching start states
  + for Index:=0 to length(DefaultStates)-1 do begin
  +  State:=DefaultStates[Index];
  +  if assigned(State) then begin
  +   FillChar(State^.NextStates,NextStatesSize,AnsiChar(#0));
  +   StateCache.Add(State);
  +   inc(CountStatesCached);
  +  end;
  + end;
  +
  +end;
  +
  +
   procedure TFLREDFA.FastAddInstructionThread(const State:PFLREDFAState;Instruction:PFLREInstruction);
   var StackPointer:longint;
       Stack:PPFLREInstructionsStatic;
  
positive.code:        WorkQueues:TFLREDFAWorkQueues;
         constructor Create(const AThreadLocalStorageInstance:TFLREThreadLocalStorageInstance);
         destructor Destroy; override;
         function CacheState(const State:PFLREDFAState):PFLREDFAState; {$ifdef caninline}inline;{$endif}
         procedure FastAddInstructionThread(const State:PFLREDFAState;Instruction:PFLREInstruction);
         procedure FullAddInstructionThread(const State:PFLREDFAState;Instruction:PFLREInstruction;const Flags:longword);
         function FastProcessNextState(State:PFLREDFAState;const CurrentChar:ansichar;const Reversed:boolean):PFLREDFAState;
         function FullProcessNextState(State:PFLREDFAState;const Position:longint;const CurrentChar:longword;const Reversed:boolean):PFLREDFAState;
         procedure DestroyStatePool(var StatePool:PFLREDFAStatePool);
         procedure FreeUsedStatePool;
         function AllocateNewStatePool:PFLREDFAStatePool;
  
negative.code:  // Connect the last state to the new state with the current char
   State.NextStates[Instance.ByteMap[byte(ansichar(CurrentChar))]]:=result;
  
  end;
  
  function TFLREDFA.SearchMatchFull(const StartPosition,UntilExcludingPosition:longint;out MatchEnd:longint;const UnanchoredStart:boolean):longint;
  