瀏覽代碼

* made it compilable with Dlephi 4 again
+ fixed problem with large stack allocations on win32

florian 26 年之前
父節點
當前提交
046acfb84b

+ 8 - 2
compiler/ag386att.pas

@@ -44,8 +44,10 @@ unit ag386att;
     uses
 {$ifdef Delphi}
       dmisc,
+{$else Delphi}
+      dos, 
 {$endif Delphi}
-      dos,strings,
+      strings,
       globtype,globals,systems,
       files,verbose
       ,i386base,i386asm
@@ -814,7 +816,11 @@ unit ag386att;
 end.
 {
   $Log$
-  Revision 1.3  1999-07-03 00:27:04  peter
+  Revision 1.4  1999-07-18 10:19:38  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.3  1999/07/03 00:27:04  peter
     * better smartlinking support
 
   Revision 1.2  1999/06/22 15:25:14  peter

+ 6 - 2
compiler/ag386int.pas

@@ -40,7 +40,7 @@ unit ag386int;
   implementation
 
     uses
-      dos,strings,
+      strings,
       globtype,globals,systems,cobjects,
       files,verbose
       ,i386base,i386asm
@@ -627,7 +627,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.47  1999-06-02 22:44:01  pierre
+  Revision 1.48  1999-07-18 10:19:39  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.47  1999/06/02 22:44:01  pierre
    * previous wrong log corrected
 
   Revision 1.46  1999/06/02 22:25:26  pierre

+ 6 - 2
compiler/ag386nsm.pas

@@ -41,7 +41,7 @@ unit ag386nsm;
   implementation
 
     uses
-      dos,strings,
+      strings,
       globtype,globals,systems,cobjects,
       files,verbose
       ,i386base,i386asm
@@ -597,7 +597,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.43  1999-06-02 22:44:02  pierre
+  Revision 1.44  1999-07-18 10:19:41  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.43  1999/06/02 22:44:02  pierre
    * previous wrong log corrected
 
   Revision 1.42  1999/06/02 22:25:27  pierre

+ 8 - 2
compiler/assemble.pas

@@ -27,8 +27,10 @@ interface
 uses
 {$ifdef Delphi}
   dmisc,
+{$else Delphi}
+  dos,
 {$endif Delphi}
-  dos,cobjects,globtype,globals,aasm;
+  cobjects,globtype,globals,aasm;
 
 const
 {$ifdef tp}
@@ -555,7 +557,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.51  1999-07-10 10:12:03  peter
+  Revision 1.52  1999-07-18 10:19:42  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.51  1999/07/10 10:12:03  peter
     * assembler smartlink message
 
   Revision 1.50  1999/07/03 00:27:05  peter

+ 96 - 15
compiler/cgai386.pas

@@ -30,7 +30,7 @@ unit cgai386;
 {$ifdef dummy}
        end { to get correct syntax highlighting }
 {$endif dummy}
-       aasm,symtable;
+       aasm,symtable,win_targ;
 
 {$define TESTGETTEMP to store const that
  are written into temps for later release PM }
@@ -2351,6 +2351,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
       r    : preference;
       len  : longint;
       opsize : topsize;
+      again,ok : pasmlabel;
     begin
        if (psym(p)^.typ=varsym) and
           (pvarsym(p)^.varspez=vs_value) and
@@ -2373,9 +2374,47 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
               exprasmlist^.concat(new(pai386,
                 op_const_reg(A_IMUL,S_L,
                 parraydef(pvarsym(p)^.definition)^.definition^.size,R_EDI)));
-
-              exprasmlist^.concat(new(pai386,
-                op_reg_reg(A_SUB,S_L,R_EDI,R_ESP)));
+              { windows guards only a few pages for stack growing, }
+              { so we have to access every page first              }
+              if target_os.id=os_i386_win32 then
+                begin
+                   getlabel(again);
+                   getlabel(ok);
+                   exprasmlist^.concat(new(pai386,
+                     op_const_reg(A_CMP,S_L,winstackpagesize,R_EDI)));
+                   emitjmp(C_NC,ok);
+                   emitlab(again);
+                   exprasmlist^.concat(new(pai386,
+                     op_const_reg(A_SUB,S_L,winstackpagesize-4,R_ESP)));
+                   exprasmlist^.concat(new(pai386,
+                     op_reg(A_PUSH,S_L,R_EAX)));
+                   exprasmlist^.concat(new(pai386,
+                     op_const_reg(A_SUB,S_L,winstackpagesize,R_EDI)));
+                   emitjmp(C_NC,again);
+
+                   emitlab(ok);
+                   exprasmlist^.concat(new(pai386,
+                     op_reg_reg(A_SUB,S_L,R_EDI,R_ESP)));
+                   { now reload EDI }
+                   new(r);
+                   reset_reference(r^);
+                   r^.base:=procinfo.framepointer;
+                   r^.offset:=pvarsym(p)^.address+4+procinfo.call_offset;
+                   exprasmlist^.concat(new(pai386,
+                     op_ref_reg(A_MOV,S_L,r,R_EDI)));
+
+                   exprasmlist^.concat(new(pai386,
+                     op_reg(A_INC,S_L,R_EDI)));
+
+                   exprasmlist^.concat(new(pai386,
+                     op_const_reg(A_IMUL,S_L,
+                     parraydef(pvarsym(p)^.definition)^.definition^.size,R_EDI)));
+                end
+              else
+                begin
+                   exprasmlist^.concat(new(pai386,
+                     op_reg_reg(A_SUB,S_L,R_EDI,R_ESP)));
+                end;
               { load destination }
               exprasmlist^.concat(new(pai386,
                 op_reg_reg(A_MOV,S_L,R_ESP,R_EDI)));
@@ -2530,6 +2569,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
       r : treference;
       oldlist,
       oldexprasmlist : paasmoutput;
+      again : pasmlabel;
+      i : longint;
+
     begin
        oldexprasmlist:=exprasmlist;
        exprasmlist:=alist;
@@ -2644,17 +2686,52 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                       else
 {$endif unused}
                           begin
+                            { windows guards only a few pages for stack growing, }
+                            { so we have to access every page first              }
+                            if (target_os.id=os_i386_win32) and
+                              (stackframe>=winstackpagesize) then
+                              begin
+                                  if stackframe div winstackpagesize<=5 then
+                                    begin
+                                       exprasmlist^.insert(new(pai386,op_const_reg(A_SUB,S_L,stackframe-4,R_ESP)));
+                                       for i:=1 to stackframe div winstackpagesize do
+                                         begin
+                                            hr:=new_reference(R_ESP,stackframe-i*winstackpagesize);
+                                            exprasmlist^.concat(new(pai386,
+                                              op_const_ref(A_MOV,S_L,0,hr)));
+                                         end;
+                                       exprasmlist^.concat(new(pai386,
+                                         op_reg(A_PUSH,S_L,R_EAX)));
+                                    end
+                                  else
+                                    begin
+                                       getlabel(again);
+                                       exprasmlist^.concat(new(pai386,
+                                         op_const_reg(A_MOV,S_L,stackframe div winstackpagesize,R_EDI)));
+                                       emitlab(again);
+                                       exprasmlist^.concat(new(pai386,
+                                         op_const_reg(A_SUB,S_L,winstackpagesize-4,R_ESP)));
+                                       exprasmlist^.concat(new(pai386,
+                                         op_reg(A_PUSH,S_L,R_EAX)));
+                                       exprasmlist^.concat(new(pai386,
+                                         op_reg(A_DEC,S_L,R_EDI)));
+                                       emitjmp(C_NZ,again);
+                                       exprasmlist^.concat(new(pai386,
+                                         op_const_reg(A_SUB,S_L,stackframe mod winstackpagesize,R_ESP)));
+                                    end
+                              end
+                            else
                               exprasmlist^.insert(new(pai386,op_const_reg(A_SUB,S_L,stackframe,R_ESP)));
-                              if (cs_check_stack in aktlocalswitches) and
-                                 not(target_info.target in [target_i386_linux,target_i386_win32]) then
-                                begin
-                                   exprasmlist^.insert(new(pai386,op_sym(A_CALL,S_NO,newasmsymbol('FPC_STACKCHECK'))));
-                                   exprasmlist^.insert(new(pai386,op_const(A_PUSH,S_L,stackframe)));
-                                end;
-                              if cs_profile in aktmoduleswitches then
-                               genprofilecode;
-                              exprasmlist^.insert(new(pai386,op_reg_reg(A_MOV,S_L,R_ESP,R_EBP)));
-                              exprasmlist^.insert(new(pai386,op_reg(A_PUSH,S_L,R_EBP)));
+                            if (cs_check_stack in aktlocalswitches) and
+                              not(target_info.target in [target_i386_linux,target_i386_win32]) then
+                              begin
+                                 exprasmlist^.insert(new(pai386,op_sym(A_CALL,S_NO,newasmsymbol('FPC_STACKCHECK'))));
+                                 exprasmlist^.insert(new(pai386,op_const(A_PUSH,S_L,stackframe)));
+                              end;
+                            if cs_profile in aktmoduleswitches then
+                              genprofilecode;
+                            exprasmlist^.insert(new(pai386,op_reg_reg(A_MOV,S_L,R_ESP,R_EBP)));
+                            exprasmlist^.insert(new(pai386,op_reg(A_PUSH,S_L,R_EBP)));
                           end;
                   end { endif stackframe <> 0 }
               else
@@ -3033,7 +3110,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.14  1999-07-06 21:48:11  florian
+  Revision 1.15  1999-07-18 10:19:44  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.14  1999/07/06 21:48:11  florian
     * a lot bug fixes:
        - po_external isn't any longer necessary for procedure compatibility
        - m_tp_procvar is in -Sd now available

+ 10 - 1
compiler/cobjects.pas

@@ -34,12 +34,17 @@ unit cobjects;
   interface
 
     uses
+{$ifdef DELPHI4}
+       dmisc,
+       sysutils
+{$else DELPHI4}
        strings
 {$ifndef linux}
        ,dos
 {$else}
        ,linux
 {$endif}
+{$endif DELPHI4}
       ;
 
     const
@@ -2204,7 +2209,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.37  1999-07-03 00:29:45  peter
+  Revision 1.38  1999-07-18 10:19:46  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.37  1999/07/03 00:29:45  peter
     * new link writing to the ppu, one .ppu is needed for all link types,
       static (.o) is now always created also when smartlinking is used
 

+ 8 - 2
compiler/compiler.pas

@@ -94,8 +94,10 @@ uses
 {$endif BrowserCol}
 {$ifdef Delphi}
   dmisc,
+{$else Delphi}
+  dos,
 {$endif Delphi}
-  dos,verbose,comphook,systems,
+  verbose,comphook,systems,
   globals,options,parser,symtable,link,import,export;
 
 function Compile(const cmd:string):longint;
@@ -271,7 +273,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.23  1999-06-22 16:24:41  pierre
+  Revision 1.24  1999-07-18 10:19:48  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.23  1999/06/22 16:24:41  pierre
    * local browser stuff corrected
 
   Revision 1.22  1999/05/17 14:24:32  pierre

+ 7 - 2
compiler/comprsrc.pas

@@ -32,8 +32,9 @@ implementation
 uses
 {$ifdef Delphi}
   dmisc,
+{$else Delphi}
+  dos,
 {$endif Delphi}
-  Dos,
   Systems,Globtype,Globals,Verbose,Files,
   Script;
 
@@ -110,7 +111,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.5  1999-07-03 00:29:46  peter
+  Revision 1.6  1999-07-18 10:19:49  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.5  1999/07/03 00:29:46  peter
     * new link writing to the ppu, one .ppu is needed for all link types,
       static (.o) is now always created also when smartlinking is used
 

+ 6 - 2
compiler/dmisc.pas

@@ -151,7 +151,7 @@ Procedure SetIntVec(intno: byte; vector: pointer);
 Procedure Keep(exitcode: word);
 
 implementation
-uses strings,globals;
+uses globals;
 
 {******************************************************************************
                            --- Conversion ---
@@ -847,7 +847,11 @@ End;
 end.
 {
   $Log$
-  Revision 1.4  1999-05-05 09:19:05  florian
+  Revision 1.5  1999-07-18 10:19:50  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.4  1999/05/05 09:19:05  florian
     * more fixes to get it with delphi running
 
   Revision 1.3  1999/05/05 08:20:12  michael

+ 8 - 2
compiler/files.pas

@@ -264,8 +264,10 @@ implementation
 uses
 {$ifdef Delphi}
    dmisc,
+{$else Delphi}
+   dos,
 {$endif Delphi}
-  dos,verbose,systems,
+  verbose,systems,
   symtable,scanner;
 
 {****************************************************************************
@@ -1312,7 +1314,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.97  1999-07-14 21:19:03  florian
+  Revision 1.98  1999-07-18 10:19:51  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.97  1999/07/14 21:19:03  florian
     + implemented a better error message if a PPU file isn't found as suggested
       by Lee John
 

+ 10 - 5
compiler/globals.pas

@@ -30,17 +30,18 @@ unit globals;
   interface
 
     uses
-{$ifdef TP}
-      objects,
-{$endif}
 {$ifdef Delphi4}
       dmisc,
       sysutils,
+{$else}
+      strings,dos,
 {$endif}
 {$ifdef linux}
+{$ifdef TP}
+      objects,
+{$endif}
       linux,
 {$endif}
-      strings,dos,
       globtype,version,tokens,systems,cobjects;
 
     const
@@ -1209,7 +1210,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.12  1999-07-13 19:14:44  michael
+  Revision 1.13  1999-07-18 10:19:52  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.12  1999/07/13 19:14:44  michael
   + Defaultreplacemens now more logical
 
   Revision 1.11  1999/07/10 10:26:18  peter

+ 7 - 2
compiler/link.pas

@@ -72,6 +72,8 @@ Implementation
 uses
 {$ifdef Delphi}
   dmisc,
+{$else Delphi}
+  dos,
 {$endif Delphi}
   globtype,systems,
   script,globals,verbose,ppu
@@ -81,7 +83,6 @@ uses
 {$ifdef linux}
   ,linux
 {$endif}
-  ,dos
   ;
 
 {$ifndef linux}
@@ -715,7 +716,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.60  1999-07-07 20:33:53  peter
+  Revision 1.61  1999-07-18 10:19:53  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.60  1999/07/07 20:33:53  peter
     * warning instead of error when switching to static linking
 
   Revision 1.59  1999/07/05 16:21:26  peter

+ 9 - 1
compiler/messages.pas

@@ -46,7 +46,11 @@ type
 implementation
 
 uses
+{$ifdef DELPHI}
+  sysutils;
+{$else DELPHI}
   strings;
+{$endif DELPHI}
 
 constructor TMessage.Init(p:pointer;n:longint);
 begin
@@ -260,7 +264,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.7  1999-05-01 12:27:51  peter
+  Revision 1.8  1999-07-18 10:19:55  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.7  1999/05/01 12:27:51  peter
     * fixed endless loop with replace $1 with $1
 
   Revision 1.6  1998/12/11 00:03:20  peter

+ 7 - 2
compiler/og386.pas

@@ -30,8 +30,9 @@ unit og386;
     uses
 {$ifdef Delphi}
        dmisc,
-{$endif Delphi}
+{$else Delphi}
        dos,
+{$endif Delphi}
        owbase,owar,
        systems,i386base,aasm;
 
@@ -277,7 +278,11 @@ unit og386;
 end.
 {
   $Log$
-  Revision 1.9  1999-07-03 00:27:03  peter
+  Revision 1.10  1999-07-18 10:19:56  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.9  1999/07/03 00:27:03  peter
     * better smartlinking support
 
   Revision 1.8  1999/05/19 12:41:48  florian

+ 8 - 2
compiler/options.pas

@@ -57,9 +57,11 @@ implementation
 uses
 {$ifdef Delphi}
   dmisc,
+{$else Delphi}
+  dos,
 {$endif Delphi}
   globtype,version,systems,
-  dos,cobjects,globals,
+  cobjects,globals,
   scanner,link,messages
 {$ifdef BrowserLog}
   ,browlog
@@ -1139,7 +1141,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.4  1999-07-05 20:13:14  peter
+  Revision 1.5  1999-07-18 10:19:57  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.4  1999/07/05 20:13:14  peter
     * removed temp defines
 
   Revision 1.3  1999/07/03 00:29:54  peter

+ 8 - 2
compiler/os2_targ.pas

@@ -50,8 +50,10 @@ implementation
   uses
 {$ifdef Delphi}
      dmisc,
+{$else Delphi}
+     dos, 
 {$endif Delphi}
-     globtype,dos,strings,globals,link,files;
+     globtype,strings,globals,link,files;
 
 const   profile_flag:boolean=false;
 
@@ -333,7 +335,11 @@ end.
 
 {
   $Log$
-  Revision 1.8  1999-07-03 00:29:55  peter
+  Revision 1.9  1999-07-18 10:19:58  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.8  1999/07/03 00:29:55  peter
     * new link writing to the ppu, one .ppu is needed for all link types,
       static (.o) is now always created also when smartlinking is used
 

+ 8 - 3
compiler/owar.pas

@@ -66,9 +66,10 @@ implementation
 uses
    verbose,
 {$ifdef Delphi}
-   dmisc,
-{$endif Delphi}
+   dmisc;
+{$else Delphi}
    dos;
+{$endif Delphi}
 
 const
 {$ifdef TP}
@@ -278,7 +279,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  1999-05-09 11:38:06  peter
+  Revision 1.4  1999-07-18 10:19:59  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.3  1999/05/09 11:38:06  peter
     * don't write .o and link if errors occure during assembling
 
   Revision 1.2  1999/05/04 21:44:53  florian

+ 7 - 1
compiler/ppc.dpr

@@ -81,6 +81,7 @@
    {$endif support_mmx}
 {$endif}
 
+{$ifndef DELPHI}
 {$ifdef TP}
   {$IFNDEF DPMI}
     {$M 24000,0,655360}
@@ -89,6 +90,7 @@
   {$ENDIF DPMI}
   {$E+,N+,F+,S-,R-}
 {$endif TP}
+{$endif DELPHI}
 
 
 program pp;
@@ -243,7 +245,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  1999-05-04 21:44:58  florian
+  Revision 1.3  1999-07-18 10:20:00  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.2  1999/05/04 21:44:58  florian
     * changes to compile it with Delphi 4.0
 
   Revision 1.1  1998/09/18 16:03:44  florian

+ 9 - 2
compiler/scanner.pas

@@ -130,7 +130,10 @@ unit scanner;
 implementation
 
     uses
-      dos,systems,symtable,switches;
+{$ifndef delphi}
+      dos,
+{$endif delphi}
+      systems,symtable,switches;
 
 {*****************************************************************************
                               Helper routines
@@ -1670,7 +1673,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.86  1999-06-02 22:44:19  pierre
+  Revision 1.87  1999-07-18 10:20:02  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.86  1999/06/02 22:44:19  pierre
    * previous wrong log corrected
 
   Revision 1.85  1999/06/02 22:25:49  pierre

+ 8 - 1
compiler/win_targ.pas

@@ -27,6 +27,9 @@ unit win_targ;
 
   uses import,export;
 
+  const
+     winstackpagesize = 4096;
+
   type
     pimportlibwin32=^timportlibwin32;
     timportlibwin32=object(timportlib)
@@ -714,7 +717,11 @@ unit win_targ;
 end.
 {
   $Log$
-  Revision 1.27  1999-05-27 19:45:30  peter
+  Revision 1.28  1999-07-18 10:20:03  florian
+    * made it compilable with Dlephi 4 again
+    + fixed problem with large stack allocations on win32
+
+  Revision 1.27  1999/05/27 19:45:30  peter
     * removed oldasm
     * plabel -> pasmlabel
     * -a switches to source writing automaticly