Browse Source

* Last steps before removal of aasmtai dependency in symsym can be
accomplished.

daniel 21 years ago
parent
commit
862e121a0a
5 changed files with 152 additions and 163 deletions
  1. 26 3
      compiler/ncgutil.pas
  2. 19 4
      compiler/pdecl.pas
  3. 40 125
      compiler/symsym.pas
  4. 38 13
      compiler/symtable.pas
  5. 29 18
      compiler/symtype.pas

+ 26 - 3
compiler/ncgutil.pas

@@ -1816,6 +1816,8 @@ implementation
         storefilepos : tfileposinfo;
         curconstsegment : taasmoutput;
         l : longint;
+        stabstr:Pchar;
+
       begin
         storefilepos:=aktfilepos;
         aktfilepos:=sym.fileinfo;
@@ -1830,7 +1832,15 @@ implementation
         curconstSegment.concat(Tai_align.create(const_align(l)));
 {$ifdef GDB}
         if cs_debuginfo in aktmoduleswitches then
-          sym.concatstabto(curconstsegment);
+          begin
+            if not sym.isstabwritten then
+              begin
+                stabstr:=sym.stabstring;
+                if stabstr<>nil then
+                  curconstsegment.concat(Tai_stabs.create(stabstr));
+                sym.isstabwritten:=true;
+              end;
+          end;
 {$endif GDB}
         if (sym.owner.symtabletype=globalsymtable) or
            (cs_create_smart in aktmoduleswitches) or
@@ -1848,6 +1858,7 @@ implementation
       var
         l,varalign : longint;
         storefilepos : tfileposinfo;
+        stabstr:Pchar;
       begin
         storefilepos:=aktfilepos;
         aktfilepos:=sym.fileinfo;
@@ -1865,7 +1876,15 @@ implementation
         bssSegment.concat(Tai_align.create(varalign));
 {$ifdef GDB}
         if cs_debuginfo in aktmoduleswitches then
-           sym.concatstabto(bsssegment);
+          begin
+            if not sym.isstabwritten then
+              begin
+                stabstr:=sym.stabstring;
+                if stabstr<>nil then
+                  bsssegment.concat(Tai_stabs.create(stabstr));
+                sym.isstabwritten:=true;
+              end;
+          end;
 {$endif GDB}
         if (sym.owner.symtabletype=globalsymtable) or
            (cs_create_smart in aktmoduleswitches) or
@@ -2098,7 +2117,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.185  2004-01-31 17:45:17  peter
+  Revision 1.186  2004-01-31 18:40:15  daniel
+    * Last steps before removal of aasmtai dependency in symsym can be
+      accomplished.
+
+  Revision 1.185  2004/01/31 17:45:17  peter
     * Change several $ifdef i386 to x86
     * Change several OS_32 to OS_INT/OS_ADDR
 

+ 19 - 4
compiler/pdecl.pas

@@ -59,7 +59,7 @@ implementation
        { pass 1 }
        nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
        { codegen }
-       ncgutil,
+       ncgutil,gdb,
        { parser }
        scanner,
        pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
@@ -283,6 +283,10 @@ implementation
         again  : boolean;
         srsym  : tsym;
         srsymtable : tsymtable;
+      {$ifdef gdb}
+        stab_str:Pchar;
+      {$endif}
+
       begin
          { Check only typesyms or record/object fields }
          case tsym(p).typ of
@@ -339,8 +343,15 @@ implementation
                        if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
                           (tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then
                         begin
-                          ttypesym(p).isusedinstab := true;
-                          ttypesym(p).concatstabto(debuglist);
+                          ttypesym(p).isusedinstab:=true;
+{                          ttypesym(p).concatstabto(debuglist);}
+                          if not Ttypesym(p).isstabwritten then
+                            begin
+                              stab_str:=Ttypesym(p).stabstring;
+                              if assigned(stab_str) then
+                                debuglist.concat(Tai_stabs.create(stab_str));
+                              Ttypesym(p).isstabwritten:=true;
+                            end;
                         end;
 {$endif GDB}
                        { we need a class type for classrefdef }
@@ -662,7 +673,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.75  2003-12-15 21:25:48  peter
+  Revision 1.76  2004-01-31 18:40:15  daniel
+    * Last steps before removal of aasmtai dependency in symsym can be
+      accomplished.
+
+  Revision 1.75  2003/12/15 21:25:48  peter
     * reg allocations for imaginary register are now inserted just
       before reg allocation
     * tregister changed to enum to allow compile time check

+ 40 - 125
compiler/symsym.pas

@@ -43,26 +43,19 @@ interface
     type
 {************************************************
                    TSym
-************************************************}
+***********************************************}
 
        { this object is the base for all symbol objects }
        tstoredsym = class(tsym)
        protected
           _mangledname : pstring;
        public
-{$ifdef GDB}
-          isstabwritten : boolean;
-{$endif GDB}
           constructor create(const n : string);
           constructor loadsym(ppufile:tcompilerppufile);
           destructor destroy;override;
-          procedure buildderef;override;
-          procedure deref;override;
 {$ifdef GDB}
           function  get_var_value(const s:string):string;
           function  stabstr_evaluate(const s:string;vars:array of string):Pchar;
-          function  stabstring : pchar;virtual;
-          procedure concatstabto(asmlist : taasmoutput);
 {$endif GDB}
           function  mangledname : string;
           procedure generate_mangledname;virtual;abstract;
@@ -78,17 +71,15 @@ interface
           constructor ppuload(ppufile:tcompilerppufile);
           procedure generate_mangledname;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
+          function  stabstring : pchar;override;
        end;
 
-       tunitsym = class(tstoredsym)
+       tunitsym = class(Tsym)
           unitsymtable : tsymtable;
           constructor create(const n : string;ref : tsymtable);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor destroy;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-{$ifdef GDB}
-          function  stabstring:Pchar;override;
-{$endif GDB}
        end;
 
        terrorsym = class(Tsym)
@@ -144,7 +135,7 @@ interface
 {$endif GDB}
        end;
 
-       ttypesym = class(tstoredsym)
+       ttypesym = class(Tsym)
           restype    : ttype;
 {$ifdef GDB}
           isusedinstab : boolean;
@@ -198,7 +189,7 @@ interface
           property vartype: ttype read _vartype write setvartype;
       end;
 
-       tpropertysym = class(tstoredsym)
+       tpropertysym = class(Tsym)
           propoptions   : tpropertyoptions;
           propoverriden : tpropertysym;
           propoverridenderef : tderef;
@@ -218,12 +209,9 @@ interface
           procedure buildderef;override;
           procedure deref;override;
           procedure dooverride(overriden:tpropertysym);
-{$ifdef GDB}
-          function  stabstring : pchar;override;
-{$endif GDB}
        end;
 
-       tabsolutesym = class(tvarsym)
+       tabsolutesym = class(Tvarsym)
           abstyp  : absolutetyp;
 {$ifdef i386}
           absseg  : boolean;
@@ -238,9 +226,9 @@ interface
           procedure deref;override;
           function  mangledname : string;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-{$ifdef GDB}
-          function  stabstring : pchar;override;
-{$endif GDB}
+       {$ifdef gdb}
+          function stabstring:Pchar;override;
+       {$endif}
        end;
 
        ttypedconstsym = class(tstoredsym)
@@ -280,7 +268,7 @@ interface
           constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
-          function  mangledname : string;
+{          function  mangledname : string;}
           procedure buildderef;override;
           procedure deref;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
@@ -289,7 +277,7 @@ interface
 {$endif GDB}
        end;
 
-       tenumsym = class(tstoredsym)
+       tenumsym = class(Tsym)
           value      : longint;
           definition : tenumdef;
           definitionderef : tderef;
@@ -300,20 +288,14 @@ interface
           procedure buildderef;override;
           procedure deref;override;
           procedure order;
-{$ifdef GDB}
-          function stabstring:Pchar;
-{$endif GDB}
        end;
 
-       tsyssym = class(tstoredsym)
+       tsyssym = class(Tsym)
           number : longint;
           constructor create(const n : string;l : longint);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-{$ifdef GDB}
-          function stabstring:Pchar;
-{$endif GDB}
        end;
 
        { compiler generated symbol to point to rtti and init/finalize tables }
@@ -412,14 +394,14 @@ implementation
 {$endif GDB}
       end;
 
-    procedure tstoredsym.buildderef;
+{    procedure tstoredsym.buildderef;
       begin
       end;
 
 
     procedure tstoredsym.deref;
       begin
-      end;
+      end;}
 
 
     destructor tstoredsym.destroy;
@@ -452,28 +434,10 @@ implementation
     function Tstoredsym.get_var_value(const s:string):string;
 
     begin
-      if s='name' then
-        get_var_value:=name
-      else if s='ownername' then
-        get_var_value:=owner.name^
-      else if s='mangledname' then
+      if s='mangledname' then
         get_var_value:=mangledname
-      else if s='line' then
-        get_var_value:=tostr(fileinfo.line)
-      else if s='N_LSYM' then
-        get_var_value:=tostr(N_LSYM)
-      else if s='N_LCSYM' then
-        get_var_value:=tostr(N_LCSYM)
-      else if s='N_RSYM' then
-        get_var_value:=tostr(N_RSYM)
-      else if s='N_TSYM' then
-        get_var_value:=tostr(N_TSYM)
-      else if s='N_STSYM' then
-        get_var_value:=tostr(N_STSYM)
-      else if s='N_FUNCTION' then
-        get_var_value:=tostr(N_FUNCTION)
-      else
-        internalerror(200401152);
+      else 
+        get_var_value:=inherited get_var_value(s);
     end;
 
     function Tstoredsym.stabstr_evaluate(const s:string;vars:array of string):Pchar;
@@ -481,41 +445,23 @@ implementation
     begin
       stabstr_evaluate:=string_evaluate(s,@get_var_value,vars);
     end;
-
-    function tstoredsym.stabstring : pchar;
-
-    begin
-      stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
-    end;
-
-    procedure tstoredsym.concatstabto(asmlist : taasmoutput);
-      var
-        stab_str : pchar;
-      begin
-         if not isstabwritten then
-           begin
-              stab_str := stabstring;
-              if assigned(stab_str) then
-                asmlist.concat(Tai_stabs.create(stab_str));
-              isstabwritten:=true;
-          end;
-    end;
 {$endif GDB}
 
     function tstoredsym.mangledname : string;
-      begin
-        if not assigned(_mangledname) then
-         begin
-           generate_mangledname;
-           if not assigned(_mangledname) then
+
+    begin
+      if not assigned(_mangledname) then
+        begin
+          generate_mangledname;
+          if not assigned(_mangledname) then
             internalerror(200204171);
-         end;
-      {$ifdef compress}
-        mangledname:=minilzw_decode(_mangledname^)
-      {$else}
-        mangledname:=_mangledname^
-      {$endif}
-      end;
+        end;
+   {$ifdef compress}
+      mangledname:=minilzw_decode(_mangledname^);
+   {$else}
+      mangledname:=_mangledname^;
+   {$endif}
+    end;
 
 
 {****************************************************************************
@@ -575,6 +521,11 @@ implementation
            end;
       end;
 
+    function Tlabelsym.stabstring : pchar;
+
+    begin
+      stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
+    end;
 
 {****************************************************************************
                                   TUNITSYM
@@ -612,14 +563,6 @@ implementation
          ppufile.writeentry(ibunitsym);
       end;
 
-{$ifdef GDB}
-    function Tunitsym.stabstring:Pchar;
-
-    begin
-      stabstring:=nil;
-    end;
-{$endif GDB}
-
 {****************************************************************************
                                   TPROCSYM
 ****************************************************************************}
@@ -1369,15 +1312,6 @@ implementation
       end;
 
 
-{$ifdef GDB}
-    function tpropertysym.stabstring : pchar;
-      begin
-         { !!!! don't know how to handle }
-         stabstring:=nil;
-      end;
-{$endif GDB}
-
-
 {****************************************************************************
                                   TABSOLUTESYM
 ****************************************************************************}
@@ -2084,12 +2018,6 @@ implementation
       end;
 
 
-    function tconstsym.mangledname : string;
-      begin
-         mangledname:=name;
-      end;
-
-
     procedure tconstsym.buildderef;
       begin
         if consttyp in [constord,constpointer,constset] then
@@ -2265,15 +2193,6 @@ implementation
       end;
 
 
-{$ifdef GDB}
-    function Tenumsym.stabstring:Pchar;
-
-    begin
-      {enum elements have no stab !}
-    end;
-{$EndIf GDB}
-
-
 {****************************************************************************
                                   TTYPESYM
 ****************************************************************************}
@@ -2417,14 +2336,6 @@ implementation
          ppufile.writeentry(ibsyssym);
       end;
 
-{$ifdef GDB}
-    function Tsyssym.stabstring:Pchar;
-
-    begin
-      stabstring:=nil
-    end;
-{$endif GDB}
-
 
 {****************************************************************************
                                   TRTTISYM
@@ -2555,7 +2466,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.148  2004-01-31 17:45:17  peter
+  Revision 1.149  2004-01-31 18:40:15  daniel
+    * Last steps before removal of aasmtai dependency in symsym can be
+      accomplished.
+
+  Revision 1.148  2004/01/31 17:45:17  peter
     * Change several $ifdef i386 to x86
     * Change several OS_32 to OS_INT/OS_ADDR
 

+ 38 - 13
compiler/symtable.pas

@@ -819,25 +819,46 @@ implementation
 {$ifdef GDB}
 
     procedure TStoredSymtable.concatstab(p : TNamedIndexItem;arg:pointer);
-      begin
-        if tsym(p).typ <> procsym then
-          tstoredsym(p).concatstabto(TAAsmOutput(arg));
-      end;
+
+    var stabstr:Pchar;
+        ao:Taasmoutput;
+
+    begin
+      if Tsym(p).typ<>procsym then
+        begin
+          ao:=Taasmoutput(arg);
+          if not Tsym(p).isstabwritten then
+            begin
+              stabstr:=Tsym(p).stabstring;
+              if stabstr<>nil then
+                ao.concat(Tai_stabs.create(stabstr));
+              Tsym(p).isstabwritten:=true;
+            end;
+        end;
+    end;
 
     procedure TStoredSymtable.resetstab(p : TNamedIndexItem;arg:pointer);
       begin
         if tsym(p).typ <> procsym then
-          tstoredsym(p).isstabwritten:=false;
+          Tstoredsym(p).isstabwritten:=false;
       end;
 
     procedure TStoredSymtable.concattypestab(p : TNamedIndexItem;arg:pointer);
-      begin
-        if tsym(p).typ = typesym then
-         begin
-           tstoredsym(p).isstabwritten:=false;
-           tstoredsym(p).concatstabto(TAAsmOutput(arg));
-         end;
-      end;
+
+    var stabstr:Pchar;
+        ao:Taasmoutput;
+
+    begin
+      if Tsym(p).typ=typesym then
+        begin
+          ao:=Taasmoutput(arg);
+          Tsym(p).isstabwritten:=false;
+          stabstr:=Tsym(p).stabstring;
+          if stabstr<>nil then
+            ao.concat(Tai_stabs.create(stabstr));
+          Tsym(p).isstabwritten:=true;
+        end;
+    end;
 
    function tstoredsymtable.getnewtypecount : word;
       begin
@@ -2338,7 +2359,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.131  2004-01-30 14:33:06  florian
+  Revision 1.132  2004-01-31 18:40:15  daniel
+    * Last steps before removal of aasmtai dependency in symsym can be
+      accomplished.
+
+  Revision 1.131  2004/01/30 14:33:06  florian
     * fixed more alignment issues
 
   Revision 1.130  2004/01/30 13:42:03  florian

+ 29 - 18
compiler/symtype.pas

@@ -95,9 +95,6 @@ interface
       { this object is the base for all symbol objects }
       tsym = class(tsymentry)
       protected
-{$ifdef GDB}
-{         isstabwritten : boolean;}
-{$endif GDB}
       public
          _realname  : pstring;
          fileinfo   : tfileposinfo;
@@ -108,10 +105,10 @@ interface
          lastwritten : tref;
          refcount    : longint;
 {$ifdef GDB}
-{         function  get_var_value(const s:string):string;
+         isstabwritten : boolean;
+         function  get_var_value(const s:string):string;
          function  stabstr_evaluate(const s:string;vars:array of string):Pchar;
          function  stabstring : pchar;virtual;
-         procedure concatstabto(asmlist : taasmoutput);virtual;}
 {$endif GDB}
          constructor create(const n : string);
          constructor loadsym(ppufile:tcompilerppufile);
@@ -119,10 +116,10 @@ interface
          procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
          procedure writesym(ppufile:tcompilerppufile);
          function  realname:string;
-         procedure buildderef;virtual;abstract;
-         procedure buildderefimpl;virtual;abstract;
-         procedure deref;virtual;abstract;
-         procedure derefimpl;virtual;abstract;
+         procedure buildderef;virtual;
+{         procedure buildderefimpl;virtual;abstract;}
+         procedure deref;virtual;
+{         procedure derefimpl;virtual;abstract;}
          function  gettypedef:tdef;virtual;
          procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual;
          function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;virtual;
@@ -228,7 +225,8 @@ implementation
     uses
        verbose,
        fmodule,
-       symdef;
+       symdef,
+       gdb;
 
 {****************************************************************************
                                 Tdef
@@ -351,7 +349,17 @@ implementation
          ppufile.putsmallset(symoptions);
       end;
 
-{$ifdef xGDB}
+    procedure Tsym.buildderef;
+
+    begin
+    end;
+
+    procedure Tsym.deref;
+
+    begin
+    end;
+
+{$ifdef GDB}
     function Tsym.get_var_value(const s:string):string;
 
     begin
@@ -359,8 +367,6 @@ implementation
         get_var_value:=name
       else if s='ownername' then
         get_var_value:=owner.name^
-      else if s='mangledname' then
-        get_var_value:=mangledname
       else if s='line' then
         get_var_value:=tostr(fileinfo.line)
       else if s='N_LSYM' then
@@ -388,9 +394,10 @@ implementation
     function Tsym.stabstring : pchar;
 
     begin
-      stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
+{      stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);}
+       stabstring:=nil;
     end;
-
+{
     procedure Tsym.concatstabto(asmlist : taasmoutput);
       var
         stab_str : pchar;
@@ -402,8 +409,8 @@ implementation
                 asmList.concat(Tai_stabs.Create(stab_str));
               isstabwritten:=true;
           end;
-    end;
-{$endif xGDB}
+    end;}
+{$endif GDB}
 
 
     function tsym.realname : string;
@@ -1520,7 +1527,11 @@ finalization
 end.
 {
   $Log$
-  Revision 1.35  2004-01-26 16:12:28  daniel
+  Revision 1.36  2004-01-31 18:40:15  daniel
+    * Last steps before removal of aasmtai dependency in symsym can be
+      accomplished.
+
+  Revision 1.35  2004/01/26 16:12:28  daniel
     * reginfo now also only allocated during register allocation
     * third round of gdb cleanups: kick out most of concatstabto