Procházet zdrojové kódy

* basic work to make Move() and FillChar() internal under ifdef INTERNALMOVEFILLCHAR

git-svn-id: trunk@3021 -
peter před 19 roky
rodič
revize
2d3c01d83a
6 změnil soubory, kde provedl 105 přidání a 1 odebrání
  1. 2 0
      rtl/i386/fastmove.inc
  2. 83 1
      rtl/i386/i386.inc
  3. 2 0
      rtl/inc/generic.inc
  4. 2 0
      rtl/inc/innr.inc
  5. 2 0
      rtl/inc/system.inc
  6. 14 0
      rtl/inc/systemh.inc

+ 2 - 0
rtl/i386/fastmove.inc

@@ -796,6 +796,7 @@ const
    fastmoveproc_forward : pointer = @Forwards_IA32_3;
    fastmoveproc_forward : pointer = @Forwards_IA32_3;
    fastmoveproc_backward : pointer = @Backwards_IA32_3;
    fastmoveproc_backward : pointer = @Backwards_IA32_3;
 
 
+{$ifndef INTERNALMOVEFILLCHAR}
 procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe;
 procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;nostackframe;
 asm
 asm
   cmp     ecx,SMALLMOVESIZE
   cmp     ecx,SMALLMOVESIZE
@@ -826,6 +827,7 @@ asm
   jmp     dword ptr fastmoveproc_backward {Source/Dest Overlap}
   jmp     dword ptr fastmoveproc_backward {Source/Dest Overlap}
 @Done:
 @Done:
 end;
 end;
+{$endif INTERNALMOVEFILLCHAR}
 
 
 {$asmmode att}
 {$asmmode att}
 
 

+ 83 - 1
rtl/i386/i386.inc

@@ -88,8 +88,10 @@ function mmx_support : boolean;
        mmx_support:=false;
        mmx_support:=false;
   end;
   end;
 
 
+{$ifndef INTERNALMOVEFILLCHAR}
 {$define USE_FASTMOVE}
 {$define USE_FASTMOVE}
 {$i fastmove.inc}
 {$i fastmove.inc}
+{$endif INTERNALMOVEFILLCHAR}
 
 
 procedure fpc_cpuinit;
 procedure fpc_cpuinit;
   begin
   begin
@@ -105,6 +107,81 @@ procedure fpc_cpuinit;
 
 
 {$ifndef FPC_SYSTEM_HAS_MOVE}
 {$ifndef FPC_SYSTEM_HAS_MOVE}
 {$define FPC_SYSTEM_HAS_MOVE}
 {$define FPC_SYSTEM_HAS_MOVE}
+{$ifdef INTERNALMOVEFILLCHAR}
+
+procedure SysMoveForward(const source;var dest;count:SizeInt);assembler;
+var
+  saveesi,saveedi : longint;
+asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %eax,%esi
+        movl    %edx,%edi
+        movl    %ecx,%edx
+        cld
+        cmpl    $15,%edx
+        jl      .LFMove1
+        movl    %edi,%ecx       { Align on 32bits }
+        negl    %ecx
+        andl    $3,%ecx
+        subl    %ecx,%edx
+        rep
+        movsb
+        movl    %edx,%ecx
+        andl    $3,%edx
+        shrl    $2,%ecx
+        rep
+        movsl
+.LFMove1:
+        movl    %edx,%ecx
+        rep
+        movsb
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
+
+procedure SysMoveBackward(const source;var dest;count:SizeInt);assembler;
+var
+  saveesi,saveedi : longint;
+asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %eax,%esi
+        movl    %edx,%edi
+        movl    %ecx,%edx
+        std
+        addl    %edx,%esi
+        addl    %edx,%edi
+        movl    %edi,%ecx
+        decl    %esi
+        decl    %edi
+        cmpl    $15,%edx
+        jl      .LBMove1
+        negl    %ecx            { Align on 32bits }
+        andl    $3,%ecx
+        subl    %ecx,%edx
+        rep
+        movsb
+        movl    %edx,%ecx
+        andl    $3,%edx
+        shrl    $2,%ecx
+        subl    $3,%esi
+        subl    $3,%edi
+        rep
+        movsl
+        addl    $3,%esi
+        addl    $3,%edi
+.LBMove1:
+        movl    %edx,%ecx
+        rep
+        movsb
+        cld
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
+
+{$else INTERNALMOVEFILLCHAR}
+
 procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;
 procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];assembler;
 var
 var
   saveesi,saveedi : longint;
   saveesi,saveedi : longint;
@@ -184,13 +261,18 @@ asm
         movl    saveedi,%edi
         movl    saveedi,%edi
         movl    saveesi,%esi
         movl    saveesi,%esi
 end;
 end;
+
+{$endif INTERNALMOVEFILLCHAR}
 {$endif FPC_SYSTEM_HAS_MOVE}
 {$endif FPC_SYSTEM_HAS_MOVE}
 
 
 
 
 {$ifndef FPC_SYSTEM_HAS_FILLCHAR}
 {$ifndef FPC_SYSTEM_HAS_FILLCHAR}
 {$define FPC_SYSTEM_HAS_FILLCHAR}
 {$define FPC_SYSTEM_HAS_FILLCHAR}
+{$ifdef INTERNALMOVEFILLCHAR}
+Procedure SysFillChar(var x;count:SizeInt;value:byte);assembler;
+{$else INTERNALMOVEFILLCHAR}
 Procedure FillChar(var x;count:SizeInt;value:byte);assembler;
 Procedure FillChar(var x;count:SizeInt;value:byte);assembler;
-
+{$endif INTERNALMOVEFILLCHAR}
 asm
 asm
         {A push is prefered over a local variable because a local
         {A push is prefered over a local variable because a local
          variable causes the compiler to generate a stackframe.}
          variable causes the compiler to generate a stackframe.}

+ 2 - 0
rtl/inc/generic.inc

@@ -73,12 +73,14 @@ end;
 {$endif FPC_SYSTEM_HAS_FILLCHAR}
 {$endif FPC_SYSTEM_HAS_FILLCHAR}
 
 
 
 
+{$ifndef INTERNALMOVEFILLCHAR}
 {$ifndef FPC_SYSTEM_HAS_FILLBYTE}
 {$ifndef FPC_SYSTEM_HAS_FILLBYTE}
 procedure FillByte (var x;count : SizeInt;value : byte );
 procedure FillByte (var x;count : SizeInt;value : byte );
 begin
 begin
   FillChar (X,Count,CHR(VALUE));
   FillChar (X,Count,CHR(VALUE));
 end;
 end;
 {$endif not FPC_SYSTEM_HAS_FILLBYTE}
 {$endif not FPC_SYSTEM_HAS_FILLBYTE}
+{$endif INTERNALMOVEFILLCHAR}
 
 
 
 
 {$ifndef FPC_SYSTEM_HAS_FILLWORD}
 {$ifndef FPC_SYSTEM_HAS_FILLWORD}

+ 2 - 0
rtl/inc/innr.inc

@@ -62,6 +62,8 @@ const
    fpc_in_leave             = 51; {macpas}
    fpc_in_leave             = 51; {macpas}
    fpc_in_cycle             = 52; {macpas}
    fpc_in_cycle             = 52; {macpas}
    fpc_in_slice             = 53;
    fpc_in_slice             = 53;
+   fpc_in_move_x            = 54;
+   fpc_in_fillchar_x        = 55;
 
 
 { Internal constant functions }
 { Internal constant functions }
    fpc_in_const_sqr        = 100;
    fpc_in_const_sqr        = 100;

+ 2 - 0
rtl/inc/system.inc

@@ -139,6 +139,7 @@ function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt; forward;
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpuarm}
 {$endif cpuarm}
 
 
+{$ifndef INTERNALMOVEFILLCHAR}
 procedure fillchar(var x;count : SizeInt;value : boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 procedure fillchar(var x;count : SizeInt;value : boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   fillchar(x,count,byte(value));
   fillchar(x,count,byte(value));
@@ -148,6 +149,7 @@ procedure fillchar(var x;count : SizeInt;value : char);{$ifdef SYSTEMINLINE}inli
 begin
 begin
   fillchar(x,count,byte(value));
   fillchar(x,count,byte(value));
 end;
 end;
+{$endif INTERNALMOVEFILLCHAR}
 
 
 { Include generic pascal only routines which are not defined in the processor
 { Include generic pascal only routines which are not defined in the processor
   specific include file }
   specific include file }

+ 14 - 0
rtl/inc/systemh.inc

@@ -339,6 +339,7 @@ var
   { Threading support }
   { Threading support }
   fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
   fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
 
 
+
 ThreadVar
 ThreadVar
   ThreadID    : TThreadID;
   ThreadID    : TThreadID;
   { Standard In- and Output }
   { Standard In- and Output }
@@ -368,11 +369,18 @@ ThreadVar
 {$endif}
 {$endif}
 {$endif}
 {$endif}
 
 
+{$ifdef INTERNALMOVEFILLCHAR}
+Procedure SysMoveForward(const source;var dest;count:SizeInt);
+Procedure SysMoveBackward(const source;var dest;count:SizeInt);
+Procedure SysFillChar(var x;count:SizeInt;Value:Byte);
+procedure FillByte(var x;count:SizeInt;value:byte);[INTERNPROC: fpc_in_fillchar_x];
+{$else INTERNALMOVEFILLCHAR}
 Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
 Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
 Procedure FillChar(var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
 procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
 procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
+{$endif INTERNALMOVEFILLCHAR}
 Procedure FillWord(var x;count:SizeInt;Value:Word);
 Procedure FillWord(var x;count:SizeInt;Value:Word);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 function  IndexChar(const buf;len:SizeInt;b:char):SizeInt;
 function  IndexChar(const buf;len:SizeInt;b:char):SizeInt;
@@ -388,6 +396,12 @@ function  IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
 procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
 procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
 
 
+{$ifdef INTERNALMOVEFILLCHAR}
+var
+  fpc_moveforward_proc : pointer = @SysMoveForward public name 'FPC_MOVEFORWARD_PROC';
+  fpc_movebackward_proc : pointer = @SysMoveBackward public name 'FPC_MOVEBACKWARD_PROC';
+  fpc_fillchar_proc : pointer = @SysFillChar public name 'FPC_FILLCHAR_PROC';
+{$endif INTERNALMOVEFILLCHAR}
 
 
 {****************************************************************************
 {****************************************************************************
                           Math Routines
                           Math Routines