* valgrind safe primitive move implementation

git-svn-id: trunk@7503 -
This commit is contained in:
florian 2007-05-28 18:21:44 +00:00
parent 48fa078f15
commit a8062fafe7

View File

@ -367,6 +367,41 @@ asm
@@Done:
end; {SmallBackwardMove}
{ at least valgrind up to 3.3 has a bug which prevents the default code to
work so we use a rather simple implementation here
}
procedure Forwards_Valgrind;assembler;nostackframe;
asm
push esi
push edi
mov esi,eax
mov edi,edx
rep movsb
pop edi
pop esi
end;
{ at least valgrind up to 3.3 has a bug which prevents the default code to
work so we use a rather simple implementation here
}
procedure Backwards_Valgrind;assembler;nostackframe;
asm
push esi
push edi
lea esi,[eax+ecx-1]
lea edi,[edx+ecx-1]
@@repeat:
mov al,[esi]
mov [edi],al
dec esi
dec edi
dec ecx
jnz @@repeat
pop edi
pop esi
end;
{-------------------------------------------------------------------------}
{Move ECX Bytes from EAX to EDX, where EAX > EDX and ECX > 36 (SMALLMOVESIZE)}
procedure Forwards_IA32_3;assembler;nostackframe;
@ -840,7 +875,11 @@ procedure setup_fastmove;{$ifdef SYSTEMINLINE}inline;{$endif}
{$ifdef FPC_HAS_VALGRINDBOOL}
{ workaround valgrind bug }
if valgrind_used then
exit;
begin
fastmoveproc_forward:=@Forwards_Valgrind;
fastmoveproc_backward:=@Backwards_Valgrind;
end
else
{$endif FPC_HAS_VALGRINDBOOL}
if has_sse_support then