Browse Source

* optimized FPC_HELP_CONSTRUCTOR a bit

Jonas Maebe 24 years ago
parent
commit
547bc5f275
1 changed files with 20 additions and 18 deletions
  1. 20 18
      rtl/i386/i386.inc

+ 20 - 18
rtl/i386/i386.inc

@@ -437,7 +437,8 @@ asm
         jz      .LHC_5
         jz      .LHC_5
       { init self for the constructor }
       { init self for the constructor }
         movl    %esi,12(%ebp)
         movl    %esi,12(%ebp)
-        jmp     .LHC_6
+      { jmp not necessary anymore because next instruction is disabled (JM)
+        jmp     .LHC_6                          }
       { Why was the VMT reset to zero here ????
       { Why was the VMT reset to zero here ????
         I need it fail to know if I should
         I need it fail to know if I should
         zero the VMT field in static objects PM }
         zero the VMT field in static objects PM }
@@ -457,22 +458,20 @@ asm
         cld
         cld
         movl    (%eax),%ecx
         movl    (%eax),%ecx
         movl    %esi,%edi
         movl    %esi,%edi
+        movl    %ecx,%ebx
         xorl    %eax,%eax
         xorl    %eax,%eax
-        shrl    $1,%ecx
-        jnc     .LHCFill1
-        stosb
-.LHCFill1:
-        shrl    $1,%ecx
-        jnc     .LHCFill2
-        stosw
-.LHCFill2:
+        shrl    $2,%ecx
+        andl    $3,%ebx
         rep
         rep
         stosl
         stosl
+        movl    %ebx,%ecx
+        rep
+        stosb
         popal
         popal
       { set the VMT address for the new created object }
       { set the VMT address for the new created object }
       { the offset is in %edi since the calling and has not been changed !! }
       { the offset is in %edi since the calling and has not been changed !! }
         movl    %eax,(%esi,%edi,1)
         movl    %eax,(%esi,%edi,1)
-        orl     %eax,%eax
+        testl   %eax,%eax
 .LHC_5:
 .LHC_5:
 end;
 end;
 
 
@@ -483,7 +482,7 @@ procedure int_help_fail;assembler;[public,alias:'FPC_HELP_FAIL'];
   freed if VMT field is at -1
   freed if VMT field is at -1
   %edi contains VMT offset in object again }
   %edi contains VMT offset in object again }
 asm
 asm
-        orl    %esi,%esi
+        testl  %esi,%esi
         je     .LHF_1
         je     .LHF_1
         cmpl   $-1,8(%ebp)
         cmpl   $-1,8(%ebp)
         je     .LHF_2
         je     .LHF_2
@@ -557,7 +556,7 @@ asm
         { if we test eax later without calling newinstance }
         { if we test eax later without calling newinstance }
         { it must have a value <>0                         }
         { it must have a value <>0                         }
         movl    $1,%eax
         movl    $1,%eax
-        orl     %edi,%edi
+        testl   %edi,%edi
         jz      .LNEW_CLASS1
         jz      .LNEW_CLASS1
         { save registers !! }
         { save registers !! }
         pushl   %ebx
         pushl   %ebx
@@ -576,7 +575,7 @@ asm
         movl    %eax,%esi
         movl    %eax,%esi
 .LNEW_CLASS1:
 .LNEW_CLASS1:
         movl    %esi,8(%ebp)
         movl    %esi,8(%ebp)
-        orl     %eax,%eax
+        testl   %eax,%eax
         popl    %edi
         popl    %edi
 end;
 end;
 
 
@@ -588,7 +587,7 @@ asm
         pushl   %edi
         pushl   %edi
         { destroy class ? }
         { destroy class ? }
         movl    12(%ebp),%edi
         movl    12(%ebp),%edi
-        orl     %edi,%edi
+        testl   %edi,%edi
         jz      .LDISPOSE_CLASS1
         jz      .LDISPOSE_CLASS1
         { no inherited call }
         { no inherited call }
         movl    (%esi),%edi
         movl    (%esi),%edi
@@ -614,7 +613,7 @@ procedure int_help_fail_class;assembler;[public,alias:'FPC_HELP_FAIL_CLASS'];
 { a non zero class must allways be disposed
 { a non zero class must allways be disposed
   VMT is allways at pos 0 }
   VMT is allways at pos 0 }
 asm
 asm
-        orl    %esi,%esi
+        testl  %esi,%esi
         je     .LHFC_1
         je     .LHFC_1
         call   INT_DISPOSE_CLASS
         call   INT_DISPOSE_CLASS
         { set both object places to zero }
         { set both object places to zero }
@@ -644,7 +643,7 @@ asm
         pushl   %eax
         pushl   %eax
         { Here we must check if the VMT pointer is nil before  }
         { Here we must check if the VMT pointer is nil before  }
         { accessing it...                                      }
         { accessing it...                                      }
-        orl     %edi,%edi
+        testl   %edi,%edi
         jz      .Lco_re
         jz      .Lco_re
         movl    (%edi),%eax
         movl    (%edi),%eax
         addl    4(%edi),%eax
         addl    4(%edi),%eax
@@ -681,7 +680,7 @@ asm
         { Here we must check if the VMT pointer is nil before  }
         { Here we must check if the VMT pointer is nil before  }
         { accessing it...                                      }
         { accessing it...                                      }
 .Lcoext_obj:
 .Lcoext_obj:
-        orl     %edi,%edi
+        testl   %edi,%edi
         jz      .Lcoext_re
         jz      .Lcoext_re
         movl    (%edi),%eax
         movl    (%edi),%eax
         addl    4(%edi),%eax
         addl    4(%edi),%eax
@@ -1111,7 +1110,10 @@ procedure inclocked(var l : longint);assembler;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2001-03-05 17:10:04  jonas
+  Revision 1.9  2001-04-08 13:19:28  jonas
+    * optimized FPC_HELP_CONSTRUCTOR a bit
+
+  Revision 1.8  2001/03/05 17:10:04  jonas
     * moved implementations of strlen and strpas to separate include files
     * moved implementations of strlen and strpas to separate include files
       (they were duplicated in i386.inc and strings.inc/stringss.inc)
       (they were duplicated in i386.inc and strings.inc/stringss.inc)
     * strpas supports 'nil' pchars again (returns an empty string)
     * strpas supports 'nil' pchars again (returns an empty string)