Bladeren bron

* remove some unit dependencies
* current_procinfo changes to store more info

peter 22 jaren geleden
bovenliggende
commit
8ff5792776

+ 16 - 10
compiler/aasmbase.pas

@@ -87,7 +87,7 @@ interface
          is_addr : boolean;
          is_addr : boolean;
          labelnr : longint;
          labelnr : longint;
          constructor create(nr:longint);
          constructor create(nr:longint);
-         constructor createdata(nr:longint);
+         constructor createdata(const modulename:string;nr:longint);
          constructor createaddr(nr:longint);
          constructor createaddr(nr:longint);
          function getname:string;override;
          function getname:string;override;
        end;
        end;
@@ -178,7 +178,8 @@ interface
          nextaltnr   : longint;
          nextaltnr   : longint;
          nextlabelnr : longint;
          nextlabelnr : longint;
        public
        public
-         name      : string[80];
+         name,
+         realname     : string[80];
          symbolsearch : tdictionary; { contains ALL assembler symbols }
          symbolsearch : tdictionary; { contains ALL assembler symbols }
          usedasmsymbollist : tsinglelist;
          usedasmsymbollist : tsinglelist;
          { ppu }
          { ppu }
@@ -227,7 +228,7 @@ implementation
 {$else}
 {$else}
       strings,
       strings,
 {$endif}
 {$endif}
-      fmodule,verbose;
+      verbose;
 
 
     const
     const
       symbolsgrow = 100;
       symbolsgrow = 100;
@@ -253,7 +254,6 @@ implementation
 
 
     procedure tasmsymbol.reset;
     procedure tasmsymbol.reset;
       begin
       begin
-{        WriteLn(ClassName,' InstanceSize :',InstanceSize);}
         { reset section info }
         { reset section info }
         section:=sec_none;
         section:=sec_none;
         address:=0;
         address:=0;
@@ -317,12 +317,12 @@ implementation
       end;
       end;
 
 
 
 
-    constructor tasmlabel.createdata(nr:longint);
+    constructor tasmlabel.createdata(const modulename:string;nr:longint);
       begin;
       begin;
         labelnr:=nr;
         labelnr:=nr;
         if (cs_create_smart in aktmoduleswitches) or
         if (cs_create_smart in aktmoduleswitches) or
            target_asm.labelprefix_only_inside_procedure then
            target_asm.labelprefix_only_inside_procedure then
-          inherited create('_$'+current_module.modulename^+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
+          inherited create('_$'+modulename+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
         else
         else
           inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_DATA);
           inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_DATA);
         is_set:=false;
         is_set:=false;
@@ -337,6 +337,7 @@ implementation
         is_addr := true;
         is_addr := true;
       end;
       end;
 
 
+
     function tasmlabel.getname:string;
     function tasmlabel.getname:string;
       begin
       begin
         getname:=inherited getname;
         getname:=inherited getname;
@@ -657,7 +658,8 @@ implementation
     constructor TAsmLibraryData.create(const n:string);
     constructor TAsmLibraryData.create(const n:string);
       begin
       begin
         inherited create;
         inherited create;
-        name:=n;
+        realname:=n;
+        name:=upper(n);
         { symbols }
         { symbols }
         symbolsearch:=tdictionary.create;
         symbolsearch:=tdictionary.create;
         symbolsearch.usehash;
         symbolsearch.usehash;
@@ -861,7 +863,7 @@ implementation
         if is_addr then
         if is_addr then
          hp:=tasmlabel.createaddr(nr)
          hp:=tasmlabel.createaddr(nr)
         else if is_data then
         else if is_data then
-         hp:=tasmlabel.createdata(nr)
+         hp:=tasmlabel.createdata(name,nr)
         else
         else
          hp:=tasmlabel.create(nr);
          hp:=tasmlabel.create(nr);
         symbolsearch.insert(hp);
         symbolsearch.insert(hp);
@@ -879,7 +881,7 @@ implementation
 
 
     procedure TAsmLibraryData.getdatalabel(var l : tasmlabel);
     procedure TAsmLibraryData.getdatalabel(var l : tasmlabel);
       begin
       begin
-        l:=tasmlabel.createdata(nextlabelnr);
+        l:=tasmlabel.createdata(name,nextlabelnr);
         inc(nextlabelnr);
         inc(nextlabelnr);
         symbolsearch.insert(l);
         symbolsearch.insert(l);
       end;
       end;
@@ -903,7 +905,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2003-04-06 21:11:23  olle
+  Revision 1.15  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.14  2003/04/06 21:11:23  olle
     * changed newasmsymbol to newasmsymboldata for data symbols
     * changed newasmsymbol to newasmsymboldata for data symbols
 
 
   Revision 1.13  2003/01/30 21:46:20  peter
   Revision 1.13  2003/01/30 21:46:20  peter

+ 15 - 8
compiler/cgbase.pas

@@ -32,7 +32,7 @@ unit cgbase;
       { common }
       { common }
       cclasses,
       cclasses,
       { global }
       { global }
-      globals,verbose,
+      globtype,globals,verbose,
       { symtable }
       { symtable }
       symconst,symtype,symdef,symsym,
       symconst,symtype,symdef,symsym,
       { aasm }
       { aasm }
@@ -44,8 +44,6 @@ unit cgbase;
       tprocinfoflag=(
       tprocinfoflag=(
         {# procedure uses asm }
         {# procedure uses asm }
         pi_uses_asm,
         pi_uses_asm,
-        {# procedure is exported by an unit }
-        pi_is_global,
         {# procedure does a call }
         {# procedure does a call }
         pi_do_call,
         pi_do_call,
         {# procedure has a try statement = no register optimization }
         {# procedure has a try statement = no register optimization }
@@ -61,11 +59,19 @@ unit cgbase;
        {# This object gives information on the current routine being
        {# This object gives information on the current routine being
           compiled.
           compiled.
        }
        }
-       tprocinfo = class
+       tprocinfo = class(tlinkedlistitem)
           { pointer to parent in nested procedures }
           { pointer to parent in nested procedures }
           parent : tprocinfo;
           parent : tprocinfo;
           {# the definition of the routine itself }
           {# the definition of the routine itself }
           procdef : tprocdef;
           procdef : tprocdef;
+          { file location of begin of procedure }
+          entrypos  : tfileposinfo;
+          { file location of end of procedure }
+          exitpos   : tfileposinfo;
+          { local switches at begin of procedure }
+          entryswitches : tlocalswitches;
+          { local switches at end of procedure }
+          exitswitches  : tlocalswitches;
           {# offset from frame pointer to get parent frame pointer reference
           {# offset from frame pointer to get parent frame pointer reference
              (used in nested routines only)
              (used in nested routines only)
              On the PowerPC, this is used to store the offset where the
              On the PowerPC, this is used to store the offset where the
@@ -185,9 +191,6 @@ unit cgbase;
        { also an exit label, only used we need to clear only the stack }
        { also an exit label, only used we need to clear only the stack }
        aktexit2label : tasmlabel;
        aktexit2label : tasmlabel;
 
 
-       {# only used in constructor for fail keyword or if getmem fails }
-       quickexitlabel : tasmlabel;
-
        {# true, if there was an error while code generation occurs }
        {# true, if there was an error while code generation occurs }
        codegenerror : boolean;
        codegenerror : boolean;
 
 
@@ -579,7 +582,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.50  2003-05-16 20:54:12  jonas
+  Revision 1.51  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.50  2003/05/16 20:54:12  jonas
     - undid previous commit, it wasn't necessary
     - undid previous commit, it wasn't necessary
 
 
   Revision 1.49  2003/05/16 20:00:39  jonas
   Revision 1.49  2003/05/16 20:00:39  jonas

+ 6 - 2
compiler/cgobj.pas

@@ -39,7 +39,7 @@ unit cgobj;
 
 
     uses
     uses
        cclasses,aasmbase,aasmtai,aasmcpu,symtable,
        cclasses,aasmbase,aasmtai,aasmcpu,symtable,
-       cpubase,cpuinfo,cpupara,
+       cpubase,cpuinfo,
        cginfo,
        cginfo,
        symconst,symbase,symtype,symdef,node
        symconst,symbase,symtype,symdef,node
 {$ifdef delphi}
 {$ifdef delphi}
@@ -1697,7 +1697,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.98  2003-05-15 18:58:53  peter
+  Revision 1.99  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.98  2003/05/15 18:58:53  peter
     * removed selfpointer_offset, vmtpointer_offset
     * removed selfpointer_offset, vmtpointer_offset
     * tvarsym.adjusted_address
     * tvarsym.adjusted_address
     * address in localsymtable is now in the real direction
     * address in localsymtable is now in the real direction

+ 17 - 1
compiler/fmodule.pas

@@ -131,6 +131,7 @@ interface
         procedure flagdependent(callermodule:tmodule);
         procedure flagdependent(callermodule:tmodule);
         function  addusedunit(hp:tmodule;inuses:boolean):tused_unit;
         function  addusedunit(hp:tmodule;inuses:boolean):tused_unit;
         procedure numberunits;
         procedure numberunits;
+        procedure setmodulename(const s:string);
       end;
       end;
 
 
        tused_unit = class(tlinkedlistitem)
        tused_unit = class(tlinkedlistitem)
@@ -636,10 +637,25 @@ uses
       end;
       end;
 
 
 
 
+    procedure tmodule.setmodulename(const s:string);
+      begin
+        stringdispose(modulename);
+        stringdispose(realmodulename);
+        modulename:=stringdup(upper(s));
+        realmodulename:=stringdup(s);
+        { also update asmlibrary names }
+        librarydata.name:=modulename^;
+        librarydata.realname:=realmodulename^;
+      end;
+
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.33  2003-04-27 11:21:32  peter
+  Revision 1.34  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.33  2003/04/27 11:21:32  peter
     * aktprocdef renamed to current_procdef
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be
     * procinfo will now be stored in current_module so it can be

+ 6 - 2
compiler/nbas.pas

@@ -550,13 +550,13 @@ implementation
       begin
       begin
          result:=nil;
          result:=nil;
          resulttype:=voidtype;
          resulttype:=voidtype;
+         include(current_procinfo.flags,pi_uses_asm);
       end;
       end;
 
 
     function tasmnode.pass_1 : tnode;
     function tasmnode.pass_1 : tnode;
       begin
       begin
          result:=nil;
          result:=nil;
          expectloc:=LOC_VOID;
          expectloc:=LOC_VOID;
-         include(current_procinfo.flags,pi_uses_asm);
       end;
       end;
 
 
 
 
@@ -800,7 +800,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.51  2003-05-17 13:30:08  jonas
+  Revision 1.52  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.51  2003/05/17 13:30:08  jonas
     * changed tt_persistant to tt_persistent :)
     * changed tt_persistant to tt_persistent :)
     * tempcreatenode now doesn't accept a boolean anymore for persistent
     * tempcreatenode now doesn't accept a boolean anymore for persistent
       temps, but a ttemptype, so you can also create ansistring temps etc
       temps, but a ttemptype, so you can also create ansistring temps etc

+ 6 - 1
compiler/ncal.pas

@@ -1927,6 +1927,7 @@ type
                             when there is only one proc definition, else the
                             when there is only one proc definition, else the
                             loadnode will give a strange error }
                             loadnode will give a strange error }
                           if not(assigned(left)) and
                           if not(assigned(left)) and
+                             not(nf_inherited in flags) and
                              (m_tp_procvar in aktmodeswitches) and
                              (m_tp_procvar in aktmodeswitches) and
                              (symtableprocentry.procdef_count=1) then
                              (symtableprocentry.procdef_count=1) then
                             begin
                             begin
@@ -2725,7 +2726,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.157  2003-05-17 14:05:58  jonas
+  Revision 1.158  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.157  2003/05/17 14:05:58  jonas
     * fixed callparatemp for ansi/widestring and interfacecoms
     * fixed callparatemp for ansi/widestring and interfacecoms
 
 
   Revision 1.156  2003/05/17 13:30:08  jonas
   Revision 1.156  2003/05/17 13:30:08  jonas

+ 6 - 3
compiler/ncgadd.pas

@@ -65,8 +65,7 @@ interface
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,defutil,htypechk,
       aasmbase,aasmtai,aasmcpu,defutil,htypechk,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
-      cpupara,
-      ncon,nset,ncgutil,tgobj,rgobj,rgcpu,cgobj,
+      ncon,nset,ncgutil,tgobj,rgobj,cgobj,
 {$ifdef cpu64bit}
 {$ifdef cpu64bit}
       cg64f64
       cg64f64
 {$else cpu64bit}
 {$else cpu64bit}
@@ -822,7 +821,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2003-04-30 22:15:59  florian
+  Revision 1.10  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.9  2003/04/30 22:15:59  florian
     * some 64 bit adaptions in ncgadd
     * some 64 bit adaptions in ncgadd
     * x86-64 now uses ncgadd
     * x86-64 now uses ncgadd
     * tparamanager.ret_in_acc doesn't return true anymore for a void-def
     * tparamanager.ret_in_acc doesn't return true anymore for a void-def

+ 9 - 8
compiler/ncgcal.pas

@@ -80,7 +80,7 @@ implementation
       gdb,
       gdb,
 {$endif GDB}
 {$endif GDB}
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
-      cpuinfo,cpupi,aasmbase,aasmtai,aasmcpu,
+      cpuinfo,aasmbase,aasmtai,aasmcpu,
       nbas,nmem,nld,ncnv,
       nbas,nmem,nld,ncnv,
 {$ifdef x86}
 {$ifdef x86}
       cga,
       cga,
@@ -90,7 +90,7 @@ implementation
 {$else cpu64bit}
 {$else cpu64bit}
       cg64f32,
       cg64f32,
 {$endif cpu64bit}
 {$endif cpu64bit}
-      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cgcpu;
+      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu;
 
 
 
 
     var
     var
@@ -953,7 +953,7 @@ implementation
            oldinlining_procedure,
            oldinlining_procedure,
            nostackframe,make_global : boolean;
            nostackframe,make_global : boolean;
            inlineentrycode,inlineexitcode : TAAsmoutput;
            inlineentrycode,inlineexitcode : TAAsmoutput;
-           oldexitlabel,oldexit2label,oldquickexitlabel:tasmlabel;
+           oldexitlabel,oldexit2label:tasmlabel;
            oldregstate: pointer;
            oldregstate: pointer;
            localsref : treference;
            localsref : treference;
 {$ifdef GDB}
 {$ifdef GDB}
@@ -991,7 +991,6 @@ implementation
           oldinlining_procedure:=inlining_procedure;
           oldinlining_procedure:=inlining_procedure;
           oldexitlabel:=aktexitlabel;
           oldexitlabel:=aktexitlabel;
           oldexit2label:=aktexit2label;
           oldexit2label:=aktexit2label;
-          oldquickexitlabel:=quickexitlabel;
           oldprocdef:=current_procdef;
           oldprocdef:=current_procdef;
           oldprocinfo:=current_procinfo;
           oldprocinfo:=current_procinfo;
           objectlibrary.getlabel(aktexitlabel);
           objectlibrary.getlabel(aktexitlabel);
@@ -1063,8 +1062,7 @@ implementation
           inlineentrycode:=TAAsmoutput.Create;
           inlineentrycode:=TAAsmoutput.Create;
           inlineexitcode:=TAAsmoutput.Create;
           inlineexitcode:=TAAsmoutput.Create;
           ps:=para_size;
           ps:=para_size;
-          make_global:=false; { to avoid warning }
-          genentrycode(inlineentrycode,make_global,0,ps,nostackframe,true);
+          genentrycode(inlineentrycode,0,ps,nostackframe,true);
           if po_assembler in current_procdef.procoptions then
           if po_assembler in current_procdef.procoptions then
             inlineentrycode.insert(Tai_marker.Create(asmblockstart));
             inlineentrycode.insert(Tai_marker.Create(asmblockstart));
           exprasmList.concatlist(inlineentrycode);
           exprasmList.concatlist(inlineentrycode);
@@ -1108,7 +1106,6 @@ implementation
           current_procdef:=oldprocdef;
           current_procdef:=oldprocdef;
           aktexitlabel:=oldexitlabel;
           aktexitlabel:=oldexitlabel;
           aktexit2label:=oldexit2label;
           aktexit2label:=oldexit2label;
-          quickexitlabel:=oldquickexitlabel;
           inlining_procedure:=oldinlining_procedure;
           inlining_procedure:=oldinlining_procedure;
 
 
           { reallocate the registers used for the current procedure's regvars, }
           { reallocate the registers used for the current procedure's regvars, }
@@ -1128,7 +1125,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.67  2003-05-17 13:30:08  jonas
+  Revision 1.68  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.67  2003/05/17 13:30:08  jonas
     * changed tt_persistant to tt_persistent :)
     * changed tt_persistant to tt_persistent :)
     * tempcreatenode now doesn't accept a boolean anymore for persistent
     * tempcreatenode now doesn't accept a boolean anymore for persistent
       temps, but a ttemptype, so you can also create ansistring temps etc
       temps, but a ttemptype, so you can also create ansistring temps etc

+ 7 - 3
compiler/ncgcnv.pas

@@ -64,10 +64,10 @@ interface
       cutils,verbose,globtype,
       cutils,verbose,globtype,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
       ncon,ncal,
       ncon,ncal,
-      cpubase,cpuinfo,cpupara,systems,
+      cpubase,cpuinfo,systems,
       pass_2,
       pass_2,
       cginfo,cgbase,
       cginfo,cgbase,
-      cgobj,cgcpu,
+      cgobj,
       ncgutil,
       ncgutil,
       tgobj,rgobj
       tgobj,rgobj
       ;
       ;
@@ -511,7 +511,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.39  2003-04-22 23:50:22  peter
+  Revision 1.40  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.39  2003/04/22 23:50:22  peter
     * firstpass uses expectloc
     * firstpass uses expectloc
     * checks if there are differences between the expectloc and
     * checks if there are differences between the expectloc and
       location.loc from secondpass in EXTDEBUG
       location.loc from secondpass in EXTDEBUG

+ 6 - 2
compiler/ncgflw.pas

@@ -91,7 +91,7 @@ implementation
       nld,ncon,
       nld,ncon,
       ncgutil,
       ncgutil,
       tgobj,rgobj,paramgr,
       tgobj,rgobj,paramgr,
-      regvars,cgobj,cgcpu
+      regvars,cgobj
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
       ,cg64f32
       ,cg64f32
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -1554,7 +1554,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.62  2003-05-17 13:30:08  jonas
+  Revision 1.63  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.62  2003/05/17 13:30:08  jonas
     * changed tt_persistant to tt_persistent :)
     * changed tt_persistant to tt_persistent :)
     * tempcreatenode now doesn't accept a boolean anymore for persistent
     * tempcreatenode now doesn't accept a boolean anymore for persistent
       temps, but a ttemptype, so you can also create ansistring temps etc
       temps, but a ttemptype, so you can also create ansistring temps etc

+ 6 - 2
compiler/ncginl.pas

@@ -59,7 +59,7 @@ implementation
       cginfo,cgbase,pass_1,pass_2,
       cginfo,cgbase,pass_1,pass_2,
       cpuinfo,cpubase,paramgr,
       cpuinfo,cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
-      tgobj,ncgutil,cgobj,rgobj,rgcpu
+      tgobj,ncgutil,cgobj,rgobj
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
       ,cg64f32
       ,cg64f32
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -682,7 +682,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2003-05-09 17:47:02  peter
+  Revision 1.31  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.30  2003/05/09 17:47:02  peter
     * self moved to hidden parameter
     * self moved to hidden parameter
     * removed hdisposen,hnewn,selfn
     * removed hdisposen,hnewn,selfn
 
 

+ 7 - 3
compiler/ncgld.pas

@@ -53,8 +53,8 @@ implementation
       ncnv,ncon,nmem,
       ncnv,ncon,nmem,
       aasmbase,aasmtai,aasmcpu,regvars,
       aasmbase,aasmtai,aasmcpu,regvars,
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
-      cpubase,cpuinfo,cpupara,
-      tgobj,ncgutil,cgobj,rgobj,rgcpu;
+      cpubase,cpuinfo,
+      tgobj,ncgutil,cgobj,rgobj;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              SecondLoad
                              SecondLoad
@@ -915,7 +915,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.59  2003-05-15 18:58:53  peter
+  Revision 1.60  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.59  2003/05/15 18:58:53  peter
     * removed selfpointer_offset, vmtpointer_offset
     * removed selfpointer_offset, vmtpointer_offset
     * tvarsym.adjusted_address
     * tvarsym.adjusted_address
     * address in localsymtable is now in the real direction
     * address in localsymtable is now in the real direction

+ 6 - 2
compiler/ncgmat.pas

@@ -103,7 +103,7 @@ implementation
       pass_1,pass_2,
       pass_1,pass_2,
       ncon,
       ncon,
       cpuinfo,
       cpuinfo,
-      tgobj,ncgutil,cgobj,rgobj,rgcpu,paramgr,cg64f32;
+      tgobj,ncgutil,cgobj,rgobj,paramgr,cg64f32;
 
 
 {*****************************************************************************
 {*****************************************************************************
                           TCGUNARYMINUSNODE
                           TCGUNARYMINUSNODE
@@ -467,7 +467,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2003-04-23 20:16:04  peter
+  Revision 1.10  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.9  2003/04/23 20:16:04  peter
     + added currency support based on int64
     + added currency support based on int64
     + is_64bit for use in cg units instead of is_64bitint
     + is_64bit for use in cg units instead of is_64bitint
     * removed cgmessage from n386add, replace with internalerrors
     * removed cgmessage from n386add, replace with internalerrors

+ 10 - 14
compiler/ncgutil.pas

@@ -29,7 +29,7 @@ interface
     uses
     uses
       node,cpuinfo,
       node,cpuinfo,
       globtype,
       globtype,
-      cpubase,cpupara,
+      cpubase,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       cginfo,symbase,symdef,symtype,
       cginfo,symbase,symdef,symtype,
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
@@ -63,7 +63,6 @@ interface
                               const locpara : tparalocation);
                               const locpara : tparalocation);
 
 
     procedure genentrycode(list : TAAsmoutput;
     procedure genentrycode(list : TAAsmoutput;
-                           make_global:boolean;
                            stackframe:longint;
                            stackframe:longint;
                            var parasize:longint;
                            var parasize:longint;
                            var nostackframe:boolean;
                            var nostackframe:boolean;
@@ -107,7 +106,7 @@ implementation
     gdb,
     gdb,
 {$endif GDB}
 {$endif GDB}
     ncon,
     ncon,
-    tgobj,cgobj,cgcpu;
+    tgobj,cgobj;
 
 
 
 
   const
   const
@@ -1308,7 +1307,6 @@ implementation
 
 
 
 
     procedure genentrycode(list : TAAsmoutput;
     procedure genentrycode(list : TAAsmoutput;
-                           make_global:boolean;
                            stackframe:longint;
                            stackframe:longint;
                            var parasize:longint;
                            var parasize:longint;
                            var nostackframe:boolean;
                            var nostackframe:boolean;
@@ -1532,17 +1530,10 @@ implementation
            else
            else
             stackalloclist.concat(Tai_align.Create(aktalignment.procalign));
             stackalloclist.concat(Tai_align.Create(aktalignment.procalign));
 
 
-           if (cs_profile in aktmoduleswitches) or
-              (current_procdef.owner.symtabletype=globalsymtable) or
-              (assigned(current_procdef._class) and
-               (current_procdef._class.owner.symtabletype=globalsymtable)) then
-            make_global:=true;
-
 {$ifdef GDB}
 {$ifdef GDB}
            if (cs_debuginfo in aktmoduleswitches) then
            if (cs_debuginfo in aktmoduleswitches) then
             begin
             begin
-              if make_global or
-                 (pi_is_global in current_procinfo.flags) then
+              if (po_public in current_procdef.procoptions) then
                 tprocsym(current_procdef.procsym).is_global:=true;
                 tprocsym(current_procdef.procsym).is_global:=true;
               current_procdef.concatstabto(stackalloclist);
               current_procdef.concatstabto(stackalloclist);
               tprocsym(current_procdef.procsym).isstabwritten:=true;
               tprocsym(current_procdef.procsym).isstabwritten:=true;
@@ -1558,7 +1549,8 @@ implementation
                 target_info.use_function_relative_addresses then
                 target_info.use_function_relative_addresses then
               stackalloclist.concat(Tai_stab_function_name.Create(strpnew(hs)));
               stackalloclist.concat(Tai_stab_function_name.Create(strpnew(hs)));
 {$endif GDB}
 {$endif GDB}
-             if make_global then
+             if (cs_profile in aktmoduleswitches) or
+                (po_public in current_procdef.procoptions) then
               stackalloclist.concat(Tai_symbol.Createname_global(hs,0))
               stackalloclist.concat(Tai_symbol.Createname_global(hs,0))
              else
              else
               stackalloclist.concat(Tai_symbol.Createname(hs,0));
               stackalloclist.concat(Tai_symbol.Createname(hs,0));
@@ -1835,7 +1827,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.104  2003-05-15 18:58:53  peter
+  Revision 1.105  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.104  2003/05/15 18:58:53  peter
     * removed selfpointer_offset, vmtpointer_offset
     * removed selfpointer_offset, vmtpointer_offset
     * tvarsym.adjusted_address
     * tvarsym.adjusted_address
     * address in localsymtable is now in the real direction
     * address in localsymtable is now in the real direction

+ 8 - 5
compiler/nld.pas

@@ -386,6 +386,7 @@ implementation
               end;
               end;
             varsym :
             varsym :
               begin
               begin
+                inc(tvarsym(symtableentry).refs);
                 { if it's refered by absolute then it's used }
                 { if it's refered by absolute then it's used }
                 if nf_absolute in flags then
                 if nf_absolute in flags then
                   tvarsym(symtableentry).varstate:=vs_used
                   tvarsym(symtableentry).varstate:=vs_used
@@ -497,10 +498,8 @@ implementation
                 else
                 else
                   Tvarsym(symtableentry).trigger_notifications(vn_onread);
                   Tvarsym(symtableentry).trigger_notifications(vn_onread);
                 { count variable references }
                 { count variable references }
-                if rg.t_times<1 then
-                  inc(tvarsym(symtableentry).refs)
-                else
-                  inc(tvarsym(symtableentry).refs,rg.t_times);
+                if rg.t_times>1 then
+                  inc(tvarsym(symtableentry).refs,rg.t_times-1);
               end;
               end;
             typedconstsym :
             typedconstsym :
                 ;
                 ;
@@ -1215,7 +1214,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.93  2003-05-11 21:37:03  peter
+  Revision 1.94  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.93  2003/05/11 21:37:03  peter
     * moved implicit exception frame from ncgutil to psub
     * moved implicit exception frame from ncgutil to psub
     * constructor/destructor helpers moved from cobj/ncgutil to psub
     * constructor/destructor helpers moved from cobj/ncgutil to psub
 
 

+ 7 - 3
compiler/nobj.pas

@@ -674,8 +674,8 @@ implementation
                                            if (procdefcoll^.data.proccalloption<>pd.proccalloption) or
                                            if (procdefcoll^.data.proccalloption<>pd.proccalloption) or
                                                (procdefcoll^.data.proctypeoption<>pd.proctypeoption) or
                                                (procdefcoll^.data.proctypeoption<>pd.proctypeoption) or
                                                ((procdefcoll^.data.procoptions-
                                                ((procdefcoll^.data.procoptions-
-                                                   [po_abstractmethod,po_overridingmethod,po_assembler,po_overload])<>
-                                                (pd.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload])) then
+                                                   [po_abstractmethod,po_overridingmethod,po_assembler,po_overload,po_public])<>
+                                                (pd.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload,po_public])) then
                                               MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname(false));
                                               MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname(false));
 
 
                                            { error, if the return types aren't equal }
                                            { error, if the return types aren't equal }
@@ -1333,7 +1333,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.42  2003-04-25 20:59:33  peter
+  Revision 1.43  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.42  2003/04/25 20:59:33  peter
     * removed funcretn,funcretsym, function result is now in varsym
     * removed funcretn,funcretsym, function result is now in varsym
       and aliases for result and function name are added using absolutesym
       and aliases for result and function name are added using absolutesym
     * vs_hidden parameter for funcret passed in parameter
     * vs_hidden parameter for funcret passed in parameter

+ 5 - 9
compiler/pdecobj.pas

@@ -573,7 +573,6 @@ implementation
          pcrd       : tclassrefdef;
          pcrd       : tclassrefdef;
          tt     : ttype;
          tt     : ttype;
          old_object_option : tsymoptions;
          old_object_option : tsymoptions;
-         old_current_procinfo : tprocinfo;
          oldparse_only : boolean;
          oldparse_only : boolean;
          storetypecanbeforward : boolean;
          storetypecanbeforward : boolean;
 
 
@@ -948,10 +947,6 @@ implementation
          testcurobject:=1;
          testcurobject:=1;
          curobjectname:=Upper(n);
          curobjectname:=Upper(n);
 
 
-         { temp procinfo }
-         old_current_procinfo:=current_procinfo;
-         current_procinfo:=cprocinfo.create(nil);
-
          { short class declaration ? }
          { short class declaration ? }
          if (classtype<>odt_class) or (token<>_SEMICOLON) then
          if (classtype<>odt_class) or (token<>_SEMICOLON) then
           begin
           begin
@@ -1135,9 +1130,6 @@ implementation
          { restore old state }
          { restore old state }
          symtablestack:=symtablestack.next;
          symtablestack:=symtablestack.next;
          aktobjectdef:=nil;
          aktobjectdef:=nil;
-         {Restore procinfo}
-         current_procinfo.free;
-         current_procinfo:=old_current_procinfo;
          current_object_option:=old_object_option;
          current_object_option:=old_object_option;
 
 
          object_dec:=aktclass;
          object_dec:=aktclass;
@@ -1146,7 +1138,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.65  2003-05-09 17:47:02  peter
+  Revision 1.66  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.65  2003/05/09 17:47:02  peter
     * self moved to hidden parameter
     * self moved to hidden parameter
     * removed hdisposen,hnewn,selfn
     * removed hdisposen,hnewn,selfn
 
 

+ 6 - 2
compiler/regvars.pas

@@ -51,7 +51,7 @@ implementation
       globtype,systems,comphook,
       globtype,systems,comphook,
       cutils,cclasses,verbose,globals,
       cutils,cclasses,verbose,globals,
       symconst,symbase,symtype,symdef,paramgr,defutil,
       symconst,symbase,symtype,symdef,paramgr,defutil,
-      cgbase,cgobj,cgcpu,rgcpu;
+      cgbase,cgobj,rgcpu;
 
 
 
 
     procedure searchregvars(p : tnamedindexitem;arg:pointer);
     procedure searchregvars(p : tnamedindexitem;arg:pointer);
@@ -561,7 +561,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.50  2003-05-16 14:33:31  peter
+  Revision 1.51  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.50  2003/05/16 14:33:31  peter
     * regvar fixes
     * regvar fixes
 
 
   Revision 1.49  2003/05/15 18:58:53  peter
   Revision 1.49  2003/05/15 18:58:53  peter

+ 7 - 1
compiler/symtable.pas

@@ -764,7 +764,9 @@ implementation
                  not(is_funcret_sym(tsym(p))) and
                  not(is_funcret_sym(tsym(p))) and
                  (
                  (
                   (tsym(p).typ<>procsym) or
                   (tsym(p).typ<>procsym) or
+{$ifdef GDB}
                   not (tprocsym(p).is_global) or
                   not (tprocsym(p).is_global) or
+{$endif GDB}
                   { all program functions are declared global
                   { all program functions are declared global
                     but unused should still be signaled PM }
                     but unused should still be signaled PM }
                   ((tsym(p).owner.symtabletype=staticsymtable) and
                   ((tsym(p).owner.symtabletype=staticsymtable) and
@@ -2419,7 +2421,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.101  2003-05-16 14:32:58  peter
+  Revision 1.102  2003-05-23 14:27:35  peter
+    * remove some unit dependencies
+    * current_procinfo changes to store more info
+
+  Revision 1.101  2003/05/16 14:32:58  peter
     * fix dup check for hiding the result varsym in localst, the result
     * fix dup check for hiding the result varsym in localst, the result
       sym was already in the localst when adding the locals
       sym was already in the localst when adding the locals