Browse Source

* last fixes before the release:
- veryyyy slow firstcall fixed

florian 27 years ago
parent
commit
6095b9d5b1
3 changed files with 84 additions and 16 deletions
  1. 42 7
      compiler/cgi386.pas
  2. 12 5
      compiler/pass_1.pas
  3. 30 4
      compiler/scanner.pas

+ 42 - 7
compiler/cgi386.pas

@@ -3749,6 +3749,8 @@ implementation
       var
          r : preference;
          l : longint;
+         ispushed : boolean;
+         hregister : tregister;
 
       begin
          case p^.inlinenumber of
@@ -4005,16 +4007,45 @@ implementation
                            del_reference(p^.left^.left^.location.reference);
                         end
                       else
+                        { LOC_CREGISTER }
                         exprasmlist^.concat(new(pai386,op_const_reg(asmop,S_L,
                           l,p^.left^.left^.location.register)));
                    end
                  else
-                   if psetdef(p^.left^.resulttype)^.settype=smallset then
-                     begin
-                     end
-                   else
-                     begin
-                     end;
+                   begin
+                      { generate code for the element to set }
+                      ispushed:=maybe_push(p^.left^.right^.left^.registers32,p^.left^.left);
+                      secondpass(p^.left^.right^.left);
+                      if ispushed then
+                        restore(p^.left^.left);
+                      { determine asm operator }
+                      if p^.inlinenumber=in_include_x_y then
+                        asmop:=A_BTS
+                      else
+                        asmop:=A_BTR;
+                      if psetdef(p^.left^.resulttype)^.settype=smallset then
+                        begin
+                           if p^.left^.right^.left^.location.loc in
+                             [LOC_CREGISTER,LOC_REGISTER] then
+                             hregister:=p^.left^.right^.left^.location.register
+                           else
+                             begin
+                                hregister:=R_EDI;
+                                exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
+                                  newreference(p^.left^.right^.left^.location.reference),
+                                  R_EDI)));
+                             end;
+                          if (p^.left^.left^.location.loc=LOC_REFERENCE) then
+                            exprasmlist^.concat(new(pai386,op_reg_ref(asmop,S_L,R_EDI,
+                              newreference(p^.left^.right^.left^.location.reference))))
+                          else
+                            exprasmlist^.concat(new(pai386,op_reg_reg(asmop,S_L,R_EDI,
+                              p^.left^.right^.left^.location.register)));
+                        end
+                      else
+                        begin
+                        end;
+                   end;
               end;
             else internalerror(9);
          end;
@@ -5844,7 +5875,11 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.14  1998-04-21 10:16:47  peter
+  Revision 1.15  1998-04-22 21:06:49  florian
+    * last fixes before the release:
+      - veryyyy slow firstcall fixed
+
+  Revision 1.14  1998/04/21 10:16:47  peter
     * patches from strasbourg
     * objects is not used anymore in the fpc compiled version
 

+ 12 - 5
compiler/pass_1.pas

@@ -2440,7 +2440,10 @@ unit pass_1;
            end;
          if defcoll=nil then
            begin
-              firstpass(p^.left);
+              if not(assigned(p^.resulttype)) then
+                firstpass(p^.left)
+              else
+                exit;
 
               if codegenerror then
                 begin
@@ -2991,7 +2994,8 @@ unit pass_1;
                         p^.methodpointer:=nil;
                      end;
 {$endif CHAINPROCSYMS}
-                end; { end of procedure to call determination }
+               end;{ end of procedure to call determination }
+
               { work trough all parameters to insert the type conversions }
               if assigned(p^.left) then
                 begin
@@ -3000,7 +3004,6 @@ unit pass_1;
                    firstcallparan(p^.left,p^.procdefinition^.para1);
                    count_ref:=old_count_ref;
                 end;
-
               { handle predefined procedures }
               if (p^.procdefinition^.options and pointernproc)<>0 then
                 begin
@@ -3045,7 +3048,7 @@ unit pass_1;
                     inc(reg_pushes[regi],t_times*2);
                end;
 {$endif}
-           end; { not assigned(p^.procdefinition) }
+           end;
          { ensure that the result type is set }
          p^.resulttype:=p^.procdefinition^.retdef;
          { get a register for the return value }
@@ -4597,7 +4600,11 @@ unit pass_1;
 end.
 {
   $Log$
-  Revision 1.11  1998-04-21 10:16:48  peter
+  Revision 1.12  1998-04-22 21:06:50  florian
+    * last fixes before the release:
+      - veryyyy slow firstcall fixed
+
+  Revision 1.11  1998/04/21 10:16:48  peter
     * patches from strasbourg
     * objects is not used anymore in the fpc compiled version
 

+ 30 - 4
compiler/scanner.pas

@@ -44,9 +44,10 @@ unit scanner;
           'struct','switch','typedef','union','unsigned','void','volatile',
           'while');
 {$else}
-       anz_keywords = 71;
+       max_keywords = 71;
+       anz_keywords : longint = max_keywords;
 
-       keyword : array[1..anz_keywords] of ident = (
+       keyword : array[1..max_keywords] of ident = (
 {                'ABSOLUTE',}
                  'AND',
                  'ARRAY','AS','ASM',
@@ -83,7 +84,7 @@ unit scanner;
                  'WHILE','WITH','XOR');
 {***}
 
-       keyword_token : array[1..anz_keywords] of ttoken = (
+       keyword_token : array[1..max_keywords] of ttoken = (
 {                _ABSOLUTE,}
                  _AND,
                  _ARRAY,_AS,_ASM,
@@ -181,6 +182,27 @@ for the last instruction of an include file !}
     uses
        pbase;
 
+    procedure remove_keyword(const s : string);
+
+      var
+         i,j : longint;
+
+      begin
+         for i:=1 to anz_keywords do
+           begin
+              if keyword[i]=s then
+                begin
+                   for j:=i to anz_keywords-1 do
+                     begin
+                        keyword[j]:=keyword[j+1];
+                        keyword_token[j]:=keyword_token[j+1];
+                     end;
+                   dec(anz_keywords);
+                   break;
+                end;
+           end;
+      end;
+
     const
        newline = #10;
 
@@ -2104,7 +2126,11 @@ for the last instruction of an include file !}
 end.
 {
   $Log$
-  Revision 1.9  1998-04-16 12:14:58  peter
+  Revision 1.10  1998-04-22 21:06:50  florian
+    * last fixes before the release:
+      - veryyyy slow firstcall fixed
+
+  Revision 1.9  1998/04/16 12:14:58  peter
     * quick hack for ^[ in strings
 
   Revision 1.8  1998/04/16 12:07:55  peter