Ver Fonte

* saving of asmsymbols in ppu supported
* asmsymbollist global is removed and moved into a new class
tasmlibrarydata that will hold the info of a .a file which
corresponds with a single module. Added librarydata to tmodule
to keep the library info stored for the module. In the future the
objectfiles will also be stored to the tasmlibrarydata class
* all getlabel/newasmsymbol and friends are moved to the new class

peter há 23 anos atrás
pai
commit
ac71268ce6
61 ficheiros alterados com 1547 adições e 752 exclusões
  1. 171 105
      compiler/aasmbase.pas
  2. 24 15
      compiler/aasmtai.pas
  3. 42 31
      compiler/assemble.pas
  4. 13 4
      compiler/cclasses.pas
  5. 15 6
      compiler/cg64f32.pas
  6. 15 14
      compiler/cgbase.pas
  7. 12 3
      compiler/cgobj.pas
  8. 12 3
      compiler/cresstr.pas
  9. 22 9
      compiler/finput.pas
  10. 22 2
      compiler/fmodule.pas
  11. 101 6
      compiler/fppu.pas
  12. 11 2
      compiler/i386/ag386int.pas
  13. 11 2
      compiler/i386/ag386nsm.pas
  14. 18 9
      compiler/i386/n386add.pas
  15. 24 15
      compiler/i386/n386cal.pas
  16. 17 8
      compiler/i386/n386cnv.pas
  17. 36 27
      compiler/i386/n386flw.pas
  18. 17 8
      compiler/i386/n386mat.pas
  19. 13 4
      compiler/i386/n386mem.pas
  20. 11 2
      compiler/i386/n386obj.pas
  21. 11 2
      compiler/i386/n386opt.pas
  22. 21 12
      compiler/i386/n386set.pas
  23. 11 2
      compiler/i386/popt386.pas
  24. 12 3
      compiler/i386/ra386att.pas
  25. 12 3
      compiler/i386/ra386int.pas
  26. 15 6
      compiler/m68k/rasm.pas
  27. 14 6
      compiler/ncgbas.pas
  28. 24 15
      compiler/ncgcal.pas
  29. 17 8
      compiler/ncgcnv.pas
  30. 18 9
      compiler/ncgcon.pas
  31. 68 59
      compiler/ncgflw.pas
  32. 34 25
      compiler/ncginl.pas
  33. 24 15
      compiler/ncgld.pas
  34. 16 7
      compiler/ncgmem.pas
  35. 21 13
      compiler/ncgset.pas
  36. 40 27
      compiler/ncgutil.pas
  37. 20 11
      compiler/nobj.pas
  38. 17 15
      compiler/parser.pas
  39. 12 3
      compiler/pdecl.pas
  40. 11 2
      compiler/pdecsub.pas
  41. 11 2
      compiler/pmodules.pas
  42. 23 14
      compiler/powerpc/cgcpu.pas
  43. 16 7
      compiler/powerpc/nppcadd.pas
  44. 12 2
      compiler/ppu.pas
  45. 16 7
      compiler/pstatmnt.pas
  46. 14 5
      compiler/psub.pas
  47. 28 19
      compiler/ptconst.pas
  48. 16 7
      compiler/rautils.pas
  49. 30 10
      compiler/symdef.pas
  50. 33 1
      compiler/symppu.pas
  51. 121 112
      compiler/symsym.pas
  52. 25 2
      compiler/symtable.pas
  53. 11 1
      compiler/symtype.pas
  54. 11 2
      compiler/targets/t_beos.pas
  55. 11 2
      compiler/targets/t_fbsd.pas
  56. 11 2
      compiler/targets/t_linux.pas
  57. 11 2
      compiler/targets/t_nwm.pas
  58. 11 2
      compiler/targets/t_sunos.pas
  59. 31 22
      compiler/targets/t_win32.pas
  60. 63 5
      compiler/utils/ppudump.pp
  61. 17 8
      compiler/x86/cgx86.pas

+ 171 - 105
compiler/aasmbase.pas

@@ -67,11 +67,11 @@ interface
          inusedlist : boolean;
          inusedlist : boolean;
          { assembler pass label is set, used for detecting multiple labels }
          { assembler pass label is set, used for detecting multiple labels }
          pass : byte;
          pass : byte;
+         ppuidx : longint;
          constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
          constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
          procedure reset;
          procedure reset;
          function  is_used:boolean;
          function  is_used:boolean;
          procedure setaddress(_pass:byte;sec:TSection;offset,len:longint);
          procedure setaddress(_pass:byte;sec:TSection;offset,len:longint);
-         procedure GenerateAltSymbol;
        end;
        end;
 
 
        TAsmLabel = class(TAsmSymbol)
        TAsmLabel = class(TAsmSymbol)
@@ -81,9 +81,9 @@ interface
          { checks -> true) or is it a jump target (false)               }
          { checks -> true) or is it a jump target (false)               }
          is_addr : boolean;
          is_addr : boolean;
          labelnr : longint;
          labelnr : longint;
-         constructor create;
-         constructor createdata;
-         constructor createaddr;
+         constructor create(nr:longint);
+         constructor createdata(nr:longint);
+         constructor createaddr(nr:longint);
          function getname:string;override;
          function getname:string;override;
        end;
        end;
 
 
@@ -125,18 +125,32 @@ interface
          procedure addsectionreloc(ofs:longint;sec:TSection;relative:TAsmRelocationType);
          procedure addsectionreloc(ofs:longint;sec:TSection;relative:TAsmRelocationType);
        end;
        end;
 
 
+       TAsmObjectAlloc = class
+         currsec : TSection;
+         secsize : TAsmSectionSizes;
+         constructor create;
+         destructor  destroy;override;
+         procedure seTSection(sec:TSection);
+         function  sectionsize:longint;
+         procedure sectionalloc(l:longint);
+         procedure sectionalign(l:longint);
+         procedure staballoc(p:pchar);
+         procedure resetSections;
+       end;
+
        TAsmObjectData = class(TLinkedListItem)
        TAsmObjectData = class(TLinkedListItem)
+       public
          name      : string[80];
          name      : string[80];
          currsec   : TSection;
          currsec   : TSection;
          sects     : array[TSection] of TAsmSection;
          sects     : array[TSection] of TAsmSection;
-         symbols   : tindexarray;
+         symbols   : tindexarray; { contains symbols that will be defined in object file }
          constructor create(const n:string);
          constructor create(const n:string);
          destructor  destroy;override;
          destructor  destroy;override;
          procedure createsection(sec:TSection);virtual;
          procedure createsection(sec:TSection);virtual;
          procedure defaulTSection(sec:TSection);
          procedure defaulTSection(sec:TSection);
          function  sectionsize(s:TSection):longint;
          function  sectionsize(s:TSection):longint;
          function  currsectionsize:longint;
          function  currsectionsize:longint;
-         procedure seTSectionsizes(var s:TAsmSectionSizes);virtual;
+         procedure setsectionsizes(var s:TAsmSectionSizes);virtual;
          procedure alloc(len:longint);
          procedure alloc(len:longint);
          procedure allocalign(len:longint);
          procedure allocalign(len:longint);
          procedure writebytes(var data;len:longint);
          procedure writebytes(var data;len:longint);
@@ -147,52 +161,51 @@ interface
          procedure fixuprelocs;virtual;
          procedure fixuprelocs;virtual;
        end;
        end;
 
 
-       TAsmObjectAlloc = class
-         currsec : TSection;
-         secsize : TAsmSectionSizes;
-         constructor create;
+       tasmsymbolidxarr = array[0..$7fffffff div sizeof(pointer)] of tasmsymbol;
+       pasmsymbolidxarr = ^tasmsymbolidxarr;
+
+       TAsmLibraryData = class(TLinkedListItem)
+       private
+         nextaltnr   : longint;
+         nextlabelnr : longint;
+       public
+         name      : string[80];
+         symbolsearch : tdictionary; { contains ALL assembler symbols }
+         usedasmsymbollist : tsinglelist;
+         { ppu }
+         asmsymbolppuidx : longint;
+         asmsymbolidx : pasmsymbolidxarr; { used for translating ppu index->asmsymbol }
+         constructor create(const n:string);
          destructor  destroy;override;
          destructor  destroy;override;
-         procedure seTSection(sec:TSection);
-         function  sectionsize:longint;
-         procedure sectionalloc(l:longint);
-         procedure sectionalign(l:longint);
-         procedure staballoc(p:pchar);
-         procedure reseTSections;
+         procedure Freeasmsymbolidx;
+         procedure DerefAsmsymbol(var s:tasmsymbol);
+         { asmsymbol }
+         function  newasmsymbol(const s : string) : tasmsymbol;
+         function  newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:TAsmsymtype) : tasmsymbol;
+         function  getasmsymbol(const s : string) : tasmsymbol;
+         function  renameasmsymbol(const sold, snew : string):tasmsymbol;
+         {# create a new assembler label }
+         procedure getlabel(var l : tasmlabel);
+         { make l as a new label and flag is_addr }
+         procedure getaddrlabel(var l : tasmlabel);
+         { make l as a new label and flag is_data }
+         procedure getdatalabel(var l : tasmlabel);
+         {# return a label number }
+         procedure getlabelnr(var l : longint);
+         procedure CreateUsedAsmSymbolList;
+         procedure DestroyUsedAsmSymbolList;
+         procedure UsedAsmSymbolListInsert(p:tasmsymbol);
+         { generate an alternative (duplicate) symbol }
+         procedure GenerateAltSymbol(p:tasmsymbol);
+         { reset alternative symbol information }
+         procedure UsedAsmSymbolListResetAltSym;
+         procedure UsedAsmSymbolListReset;
+         procedure UsedAsmSymbolListCheckUndefined;
        end;
        end;
-       TAsmObjectDataclass = class of TAsmObjectAlloc;
 
 
 
 
     var
     var
-      { asm symbol list }
-      asmsymbollist : tdictionary;
-      usedasmsymbollist : tsinglelist;
-
-      objectdata : TAsmObjectData;
-
-    const
-      nextaltnr   : longint = 1;
-      nextlabelnr : longint = 1;
-
-    {# create a new assembler label }
-    procedure getlabel(var l : tasmlabel);
-    { make l as a new label and flag is_addr }
-    procedure getaddrlabel(var l : tasmlabel);
-    { make l as a new label and flag is_data }
-    procedure getdatalabel(var l : tasmlabel);
-    {# return a label number }
-    procedure getlabelnr(var l : longint);
-
-    function  newasmsymbol(const s : string) : tasmsymbol;
-    function  newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:TAsmsymtype) : tasmsymbol;
-    function  getasmsymbol(const s : string) : tasmsymbol;
-    function  renameasmsymbol(const sold, snew : string):tasmsymbol;
-
-    procedure CreateUsedAsmSymbolList;
-    procedure DestroyUsedAsmSymbolList;
-    procedure UsedAsmSymbolListInsert(p:tasmsymbol);
-    procedure UsedAsmSymbolListReset;
-    procedure UsedAsmSymbolListResetAltSym;
-    procedure UsedAsmSymbolListCheckUndefined;
+      current_library : tasmlibrarydata;
 
 
 
 
 implementation
 implementation
@@ -221,21 +234,11 @@ implementation
         typ:=_typ;
         typ:=_typ;
         inusedlist:=false;
         inusedlist:=false;
         pass:=255;
         pass:=255;
+        ppuidx:=-1;
         { mainly used to remove unused labels from the codesegment }
         { mainly used to remove unused labels from the codesegment }
         refs:=0;
         refs:=0;
       end;
       end;
 
 
-    procedure tasmsymbol.GenerateAltSymbol;
-      begin
-        if not assigned(altsymbol) then
-         begin
-           altsymbol:=tasmsymbol.create(name+'_'+tostr(nextaltnr),defbind,typ);
-           { also copy the amount of references }
-           altsymbol.refs:=refs;
-           inc(nextaltnr);
-         end;
-      end;
-
     procedure tasmsymbol.reset;
     procedure tasmsymbol.reset;
       begin
       begin
         { reset section info }
         { reset section info }
@@ -275,10 +278,9 @@ implementation
                                  TAsmLabel
                                  TAsmLabel
 *****************************************************************************}
 *****************************************************************************}
 
 
-    constructor tasmlabel.create;
+    constructor tasmlabel.create(nr:longint);
       begin;
       begin;
-        labelnr:=nextlabelnr;
-        inc(nextlabelnr);
+        labelnr:=nr;
         inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_FUNCTION);
         inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_FUNCTION);
         proclocal:=true;
         proclocal:=true;
         is_set:=false;
         is_set:=false;
@@ -286,10 +288,9 @@ implementation
       end;
       end;
 
 
 
 
-    constructor tasmlabel.createdata;
+    constructor tasmlabel.createdata(nr:longint);
       begin;
       begin;
-        labelnr:=nextlabelnr;
-        inc(nextlabelnr);
+        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('_$'+current_module.modulename^+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
@@ -301,9 +302,9 @@ implementation
         refs:=1;
         refs:=1;
       end;
       end;
 
 
-    constructor tasmlabel.createaddr;
+    constructor tasmlabel.createaddr(nr:longint);
       begin;
       begin;
-        create;
+        create(nr);
         is_addr := true;
         is_addr := true;
       end;
       end;
 
 
@@ -620,60 +621,98 @@ implementation
       end;
       end;
 
 
 
 
-{*****************************************************************************
-                              AsmSymbolList helpers
-*****************************************************************************}
+{****************************************************************************
+                                TAsmLibraryData
+****************************************************************************}
 
 
-    function newasmsymbol(const s : string) : tasmsymbol;
+    constructor TAsmLibraryData.create(const n:string);
+      begin
+        inherited create;
+        name:=n;
+        { symbols }
+        symbolsearch:=tdictionary.create;
+        symbolsearch.usehash;
+        { labels }
+        nextaltnr:=1;
+        nextlabelnr:=1;
+        { ppu }
+        asmsymbolppuidx:=0;
+        asmsymbolidx:=nil;
+      end;
+
+
+    destructor TAsmLibraryData.destroy;
+      begin
+        symbolsearch.free;
+        Freeasmsymbolidx;
+      end;
+
+
+    procedure TAsmLibraryData.Freeasmsymbolidx;
+      begin
+        if assigned(asmsymbolidx) then
+         begin
+           Freemem(asmsymbolidx);
+           asmsymbolidx:=nil;
+         end;
+      end;
+
+
+    procedure TAsmLibraryData.DerefAsmsymbol(var s:tasmsymbol);
+      begin
+        if not assigned(asmsymbolidx) then
+          internalerror(200208072);
+        if longint(pointer(s))>=asmsymbolppuidx then
+          internalerror(200208073);
+        s:=asmsymbolidx^[longint(pointer(s))];
+      end;
+
+
+    function TAsmLibraryData.newasmsymbol(const s : string) : tasmsymbol;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
-        hp:=tasmsymbol(asmsymbollist.search(s));
+        hp:=tasmsymbol(symbolsearch.search(s));
         if not assigned(hp) then
         if not assigned(hp) then
          begin
          begin
            { Not found, insert it as an External }
            { Not found, insert it as an External }
            hp:=tasmsymbol.create(s,AB_EXTERNAL,AT_FUNCTION);
            hp:=tasmsymbol.create(s,AB_EXTERNAL,AT_FUNCTION);
-           asmsymbollist.insert(hp);
+           symbolsearch.insert(hp);
          end;
          end;
         newasmsymbol:=hp;
         newasmsymbol:=hp;
       end;
       end;
 
 
 
 
-    function newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
+    function TAsmLibraryData.newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
-        hp:=tasmsymbol(asmsymbollist.search(s));
+        hp:=tasmsymbol(symbolsearch.search(s));
         if assigned(hp) then
         if assigned(hp) then
          hp.defbind:=_bind
          hp.defbind:=_bind
         else
         else
          begin
          begin
            { Not found, insert it as an External }
            { Not found, insert it as an External }
            hp:=tasmsymbol.create(s,_bind,_typ);
            hp:=tasmsymbol.create(s,_bind,_typ);
-           asmsymbollist.insert(hp);
+           symbolsearch.insert(hp);
          end;
          end;
         newasmsymboltype:=hp;
         newasmsymboltype:=hp;
       end;
       end;
 
 
 
 
-    function getasmsymbol(const s : string) : tasmsymbol;
+    function TAsmLibraryData.getasmsymbol(const s : string) : tasmsymbol;
       begin
       begin
-        getasmsymbol:=tasmsymbol(asmsymbollist.search(s));
+        getasmsymbol:=tasmsymbol(symbolsearch.search(s));
       end;
       end;
 
 
 
 
-    { renames an asmsymbol }
-    function renameasmsymbol(const sold, snew : string):tasmsymbol;
+    function TAsmLibraryData.renameasmsymbol(const sold, snew : string):tasmsymbol;
       begin
       begin
-        renameasmsymbol:=tasmsymbol(asmsymbollist.rename(sold,snew));
+        renameasmsymbol:=tasmsymbol(symbolsearch.rename(sold,snew));
       end;
       end;
 
 
 
 
-{*****************************************************************************
-                              Used AsmSymbolList
-*****************************************************************************}
-
-    procedure CreateUsedAsmSymbolList;
+    procedure TAsmLibraryData.CreateUsedAsmSymbolList;
       begin
       begin
         if assigned(usedasmsymbollist) then
         if assigned(usedasmsymbollist) then
          internalerror(78455782);
          internalerror(78455782);
@@ -681,14 +720,14 @@ implementation
       end;
       end;
 
 
 
 
-    procedure DestroyUsedAsmSymbolList;
+    procedure TAsmLibraryData.DestroyUsedAsmSymbolList;
       begin
       begin
         usedasmsymbollist.destroy;
         usedasmsymbollist.destroy;
         usedasmsymbollist:=nil;
         usedasmsymbollist:=nil;
       end;
       end;
 
 
 
 
-    procedure UsedAsmSymbolListInsert(p:tasmsymbol);
+    procedure TAsmLibraryData.UsedAsmSymbolListInsert(p:tasmsymbol);
       begin
       begin
         if not p.inusedlist then
         if not p.inusedlist then
          usedasmsymbollist.insert(p);
          usedasmsymbollist.insert(p);
@@ -696,7 +735,24 @@ implementation
       end;
       end;
 
 
 
 
-    procedure UsedAsmSymbolListReset;
+    procedure TAsmLibraryData.GenerateAltSymbol(p:tasmsymbol);
+      begin
+        if not assigned(p.altsymbol) then
+         begin
+           p.altsymbol:=tasmsymbol.create(name+'_'+tostr(nextaltnr),p.defbind,p.typ);
+           { also copy the amount of references }
+           p.altsymbol.refs:=p.refs;
+           inc(nextaltnr);
+           { add to the usedasmsymbollist, that list is used to reset the
+             altsymbol }
+           if not p.inusedlist then
+            usedasmsymbollist.insert(p);
+           p.inusedlist:=true;
+         end;
+      end;
+
+
+    procedure TAsmLibraryData.UsedAsmSymbolListReset;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
@@ -713,7 +769,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure UsedAsmSymbolListResetAltSym;
+    procedure TAsmLibraryData.UsedAsmSymbolListResetAltSym;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
@@ -730,7 +786,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure UsedAsmSymbolListCheckUndefined;
+    procedure TAsmLibraryData.UsedAsmSymbolListCheckUndefined;
       var
       var
         hp : tasmsymbol;
         hp : tasmsymbol;
       begin
       begin
@@ -749,30 +805,31 @@ implementation
       end;
       end;
 
 
 
 
-{*****************************************************************************
-                              Label Helpers
-*****************************************************************************}
-
-    procedure getlabel(var l : tasmlabel);
+    procedure TAsmLibraryData.getlabel(var l : tasmlabel);
       begin
       begin
-        l:=tasmlabel.create;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.create(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
       end;
 
 
 
 
-    procedure getdatalabel(var l : tasmlabel);
+    procedure TAsmLibraryData.getdatalabel(var l : tasmlabel);
       begin
       begin
-        l:=tasmlabel.createdata;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.createdata(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
       end;
 
 
-    procedure getaddrlabel(var l : tasmlabel);
+
+    procedure TAsmLibraryData.getaddrlabel(var l : tasmlabel);
       begin
       begin
-        l:=tasmlabel.createaddr;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.createaddr(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
       end;
 
 
-    procedure getlabelnr(var l : longint);
+
+    procedure TAsmLibraryData.getlabelnr(var l : longint);
       begin
       begin
          l:=nextlabelnr;
          l:=nextlabelnr;
          inc(nextlabelnr);
          inc(nextlabelnr);
@@ -782,7 +839,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2002-07-10 07:24:40  jonas
+  Revision 1.4  2002-08-11 13:24:10  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.3  2002/07/10 07:24:40  jonas
     * memory leak fixes from Sergey Korshunoff
     * memory leak fixes from Sergey Korshunoff
 
 
   Revision 1.2  2002/07/07 09:52:32  florian
   Revision 1.2  2002/07/07 09:52:32  florian

+ 24 - 15
compiler/aasmtai.pas

@@ -121,7 +121,7 @@ interface
           constructor Create;
           constructor Create;
        end;
        end;
 
 
-       {# Generates an assembler string } 
+       {# Generates an assembler string }
        tai_string = class(tai)
        tai_string = class(tai)
           str : pchar;
           str : pchar;
           { extra len so the string can contain an \0 }
           { extra len so the string can contain an \0 }
@@ -150,7 +150,7 @@ interface
           constructor Createname(const _name : string);
           constructor Createname(const _name : string);
        end;
        end;
 
 
-       {# Generates an assembler label } 
+       {# Generates an assembler label }
        tai_label = class(tai)
        tai_label = class(tai)
           is_global : boolean;
           is_global : boolean;
           l : tasmlabel;
           l : tasmlabel;
@@ -226,8 +226,8 @@ interface
           constructor Create(_value : ts80real);
           constructor Create(_value : ts80real);
        end;
        end;
 
 
-       {# Generates a comp int (integer over 64 bits) 
-         
+       {# Generates a comp int (integer over 64 bits)
+
           This is Intel 80x86 specific, and is not
           This is Intel 80x86 specific, and is not
           really supported on other processors.
           really supported on other processors.
        }
        }
@@ -361,7 +361,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -374,7 +374,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -400,7 +400,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_FUNCTION);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_FUNCTION);
          size:=siz;
          size:=siz;
          is_global:=false;
          is_global:=false;
       end;
       end;
@@ -409,7 +409,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_FUNCTION);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_FUNCTION);
          size:=siz;
          size:=siz;
          is_global:=true;
          is_global:=true;
       end;
       end;
@@ -418,7 +418,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_DATA);
          size:=siz;
          size:=siz;
          is_global:=false;
          is_global:=false;
       end;
       end;
@@ -427,7 +427,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
          size:=siz;
          size:=siz;
          is_global:=true;
          is_global:=true;
       end;
       end;
@@ -448,7 +448,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol_end;
          typ:=ait_symbol_end;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_NONE);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_NONE);
       end;
       end;
 
 
 
 
@@ -519,7 +519,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_symbol;
          typ:=ait_const_symbol;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=0;
          offset:=0;
          { update sym info }
          { update sym info }
          inc(sym.refs);
          inc(sym.refs);
@@ -529,7 +529,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_symbol;
          typ:=ait_const_symbol;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=ofs;
          offset:=ofs;
          { update sym info }
          { update sym info }
          inc(sym.refs);
          inc(sym.refs);
@@ -539,7 +539,7 @@ uses
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_rva;
          typ:=ait_const_rva;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=0;
          offset:=0;
          { update sym info }
          { update sym info }
          inc(sym.refs);
          inc(sym.refs);
@@ -983,7 +983,16 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-05 18:27:48  carl
+  Revision 1.3  2002-08-11 13:24:10  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.2  2002/08/05 18:27:48  carl
     + more more more documentation
     + more more more documentation
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
 
 

+ 42 - 31
compiler/assemble.pas

@@ -132,6 +132,7 @@ interface
       protected
       protected
         { object alloc and output }
         { object alloc and output }
         objectalloc  : TAsmObjectAlloc;
         objectalloc  : TAsmObjectAlloc;
+        objectdata   : TAsmObjectData;
         objectoutput : tobjectoutput;
         objectoutput : tobjectoutput;
       private
       private
         { the aasmoutput lists that need to be processed }
         { the aasmoutput lists that need to be processed }
@@ -709,7 +710,7 @@ Implementation
                 { the symbol can be external
                 { the symbol can be external
                   so we must use newasmsymbol and
                   so we must use newasmsymbol and
                   not getasmsymbol !! PM }
                   not getasmsymbol !! PM }
-                ps:=newasmsymbol(copy(s,1,j-1));
+                ps:=current_library.newasmsymbol(copy(s,1,j-1));
                 if not assigned(ps) then
                 if not assigned(ps) then
                   internalerror(33006)
                   internalerror(33006)
                 else
                 else
@@ -717,7 +718,7 @@ Implementation
                     sec:=ps.section;
                     sec:=ps.section;
                     ofs:=ps.address;
                     ofs:=ps.address;
                     reloc:=true;
                     reloc:=true;
-                    UsedAsmSymbolListInsert(ps);
+                    current_library.UsedAsmSymbolListInsert(ps);
                   end;
                   end;
                 if j<256 then
                 if j<256 then
                   begin
                   begin
@@ -731,7 +732,7 @@ Implementation
                          i:=i+j;
                          i:=i+j;
                          s:=strpas(@p[i]);
                          s:=strpas(@p[i]);
                       end;
                       end;
-                    ps:=getasmsymbol(s);
+                    ps:=current_library.getasmsymbol(s);
                     if not assigned(ps) then
                     if not assigned(ps) then
                       internalerror(33007)
                       internalerror(33007)
                     else
                     else
@@ -740,7 +741,7 @@ Implementation
                           internalerror(33008);
                           internalerror(33008);
                         ofs:=ofs-ps.address;
                         ofs:=ofs-ps.address;
                         reloc:=false;
                         reloc:=false;
-                        UsedAsmSymbolListInsert(ps);
+                        current_library.UsedAsmSymbolListInsert(ps);
                       end;
                       end;
                   end;
                   end;
               end;
               end;
@@ -753,10 +754,10 @@ Implementation
                 objectdata.writesymbol(ps);
                 objectdata.writesymbol(ps);
                 objectoutput.exportsymbol(ps);
                 objectoutput.exportsymbol(ps);
               end;
               end;
-            objectdata.WriteSymStabs(sec,ofs,hp,ps,nidx,nother,line,reloc)
+            objectdata.writeSymStabs(sec,ofs,hp,ps,nidx,nother,line,reloc)
           end
           end
         else
         else
-          objectdata.WriteStabs(sec,ofs,hp,nidx,nother,line,reloc);
+          objectdata.writeStabs(sec,ofs,hp,nidx,nother,line,reloc);
         if assigned(hp) then
         if assigned(hp) then
          p[ii]:='"';
          p[ii]:='"';
       end;
       end;
@@ -774,7 +775,7 @@ Implementation
 
 
         if (nidx=n_textline) and assigned(funcname) and
         if (nidx=n_textline) and assigned(funcname) and
            (target_info.use_function_relative_addresses) then
            (target_info.use_function_relative_addresses) then
-          objectdata.WriteStabs(sec_code,objectdata.sectionsize(sec_code)-funcname.address,
+          objectdata.writeStabs(sec_code,objectdata.sectionsize(sec_code)-funcname.address,
               nil,nidx,0,line,false)
               nil,nidx,0,line,false)
         else
         else
           begin
           begin
@@ -784,7 +785,7 @@ Implementation
               sec:=sec_data
               sec:=sec_data
             else
             else
               sec:=sec_bss;
               sec:=sec_bss;
-            objectdata.WriteStabs(sec,objectdata.sectionsize(sec),
+            objectdata.writeStabs(sec,objectdata.sectionsize(sec),
               nil,nidx,0,line,true);
               nil,nidx,0,line,true);
           end;
           end;
       end;
       end;
@@ -816,11 +817,11 @@ Implementation
            else
            else
             curr_n:=n_includefile;
             curr_n:=n_includefile;
            { get symbol for this includefile }
            { get symbol for this includefile }
-           hp:=newasmsymboltype('Ltext'+ToStr(IncludeCount),AB_LOCAL,AT_FUNCTION);
+           hp:=current_library.newasmsymboltype('Ltext'+ToStr(IncludeCount),AB_LOCAL,AT_FUNCTION);
            if currpass=1 then
            if currpass=1 then
              begin
              begin
                 hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
                 hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
-                UsedAsmSymbolListInsert(hp);
+                current_library.UsedAsmSymbolListInsert(hp);
              end
              end
            else
            else
              objectdata.writesymbol(hp);
              objectdata.writesymbol(hp);
@@ -864,11 +865,11 @@ Implementation
            exit;
            exit;
         store_sec:=objectalloc.currsec;
         store_sec:=objectalloc.currsec;
         objectalloc.seTSection(sec_code);
         objectalloc.seTSection(sec_code);
-        hp:=newasmsymboltype('Letext',AB_LOCAL,AT_FUNCTION);
+        hp:=current_library.newasmsymboltype('Letext',AB_LOCAL,AT_FUNCTION);
         if currpass=1 then
         if currpass=1 then
           begin
           begin
             hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
             hp.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
-            UsedAsmSymbolListInsert(hp);
+            current_library.UsedAsmSymbolListInsert(hp);
           end
           end
         else
         else
           objectdata.writesymbol(hp);
           objectdata.writesymbol(hp);
@@ -1045,7 +1046,7 @@ Implementation
                      Tai_datablock(hp).sym.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,Tai_datablock(hp).size);
                      Tai_datablock(hp).sym.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,Tai_datablock(hp).size);
                      objectalloc.sectionalloc(Tai_datablock(hp).size);
                      objectalloc.sectionalloc(Tai_datablock(hp).size);
                    end;
                    end;
-                 UsedAsmSymbolListInsert(Tai_datablock(hp).sym);
+                 current_library.UsedAsmSymbolListInsert(Tai_datablock(hp).sym);
                end;
                end;
              ait_const_32bit :
              ait_const_32bit :
                objectalloc.sectionalloc(4);
                objectalloc.sectionalloc(4);
@@ -1065,7 +1066,7 @@ Implementation
              ait_const_symbol :
              ait_const_symbol :
                begin
                begin
                  objectalloc.sectionalloc(4);
                  objectalloc.sectionalloc(4);
-                 UsedAsmSymbolListInsert(Tai_const_symbol(hp).sym);
+                 current_library.UsedAsmSymbolListInsert(Tai_const_symbol(hp).sym);
                end;
                end;
              ait_section:
              ait_section:
                begin
                begin
@@ -1090,8 +1091,8 @@ Implementation
                begin
                begin
                  if assigned(Tai_stab_function_name(hp).str) then
                  if assigned(Tai_stab_function_name(hp).str) then
                   begin
                   begin
-                    funcname:=getasmsymbol(strpas(Tai_stab_function_name(hp).str));
-                    UsedAsmSymbolListInsert(funcname);
+                    funcname:=current_library.getasmsymbol(strpas(Tai_stab_function_name(hp).str));
+                    current_library.UsedAsmSymbolListInsert(funcname);
                   end
                   end
                  else
                  else
                   funcname:=nil;
                   funcname:=nil;
@@ -1102,20 +1103,20 @@ Implementation
              ait_symbol :
              ait_symbol :
                begin
                begin
                  Tai_symbol(hp).sym.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
                  Tai_symbol(hp).sym.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
-                 UsedAsmSymbolListInsert(Tai_symbol(hp).sym);
+                 current_library.UsedAsmSymbolListInsert(Tai_symbol(hp).sym);
                end;
                end;
              ait_symbol_end :
              ait_symbol_end :
                begin
                begin
                  if target_info.system in [system_i386_linux,system_i386_beos] then
                  if target_info.system in [system_i386_linux,system_i386_beos] then
                   begin
                   begin
                     Tai_symbol_end(hp).sym.size:=objectalloc.sectionsize-Tai_symbol_end(hp).sym.address;
                     Tai_symbol_end(hp).sym.size:=objectalloc.sectionsize-Tai_symbol_end(hp).sym.address;
-                    UsedAsmSymbolListInsert(Tai_symbol_end(hp).sym);
+                    current_library.UsedAsmSymbolListInsert(Tai_symbol_end(hp).sym);
                   end;
                   end;
                 end;
                 end;
              ait_label :
              ait_label :
                begin
                begin
                  Tai_label(hp).l.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
                  Tai_label(hp).l.setaddress(currpass,objectalloc.currsec,objectalloc.sectionsize,0);
-                 UsedAsmSymbolListInsert(Tai_label(hp).l);
+                 current_library.UsedAsmSymbolListInsert(Tai_label(hp).l);
                end;
                end;
              ait_string :
              ait_string :
                objectalloc.sectionalloc(Tai_string(hp).len);
                objectalloc.sectionalloc(Tai_string(hp).len);
@@ -1133,11 +1134,11 @@ Implementation
                          top_ref :
                          top_ref :
                            begin
                            begin
                              if assigned(ref^.symbol) then
                              if assigned(ref^.symbol) then
-                              UsedAsmSymbolListInsert(ref^.symbol);
+                              current_library.UsedAsmSymbolListInsert(ref^.symbol);
                            end;
                            end;
                          top_symbol :
                          top_symbol :
                            begin
                            begin
-                             UsedAsmSymbolListInsert(sym);
+                             current_library.UsedAsmSymbolListInsert(sym);
                            end;
                            end;
                        end;
                        end;
                      end;
                      end;
@@ -1273,7 +1274,7 @@ Implementation
                convertstabs(Tai_stabs(hp).str);
                convertstabs(Tai_stabs(hp).str);
              ait_stab_function_name :
              ait_stab_function_name :
                if assigned(Tai_stab_function_name(hp).str) then
                if assigned(Tai_stab_function_name(hp).str) then
-                 funcname:=getasmsymbol(strpas(Tai_stab_function_name(hp).str))
+                 funcname:=current_library.getasmsymbol(strpas(Tai_stab_function_name(hp).str))
                else
                else
                  funcname:=nil;
                  funcname:=nil;
              ait_force_line :
              ait_force_line :
@@ -1301,7 +1302,7 @@ Implementation
         objectdata:=objectoutput.newobjectdata(Objfile);
         objectdata:=objectoutput.newobjectdata(Objfile);
         objectdata.defaulTSection(sec_code);
         objectdata.defaulTSection(sec_code);
         { reset the asmsymbol list }
         { reset the asmsymbol list }
-        CreateUsedAsmsymbolList;
+        current_library.CreateUsedAsmsymbolList;
 
 
 {$ifdef MULTIPASS}
 {$ifdef MULTIPASS}
       { Pass 0 }
       { Pass 0 }
@@ -1341,7 +1342,7 @@ Implementation
         EndFileLineInfo;
         EndFileLineInfo;
 {$endif GDB}
 {$endif GDB}
         { check for undefined labels and reset }
         { check for undefined labels and reset }
-        UsedAsmSymbolListCheckUndefined;
+        current_library.UsedAsmSymbolListCheckUndefined;
 
 
         { set section sizes }
         { set section sizes }
         objectdata.seTSectionsizes(objectalloc.secsize);
         objectdata.seTSectionsizes(objectalloc.secsize);
@@ -1380,8 +1381,8 @@ Implementation
       doexit:
       doexit:
         { reset the used symbols back, must be after the .o has been
         { reset the used symbols back, must be after the .o has been
           written }
           written }
-        UsedAsmsymbolListReset;
-        DestroyUsedAsmsymbolList;
+        current_library.UsedAsmsymbolListReset;
+        current_library.DestroyUsedAsmsymbolList;
       end;
       end;
 
 
 
 
@@ -1406,7 +1407,7 @@ Implementation
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
          { reset the asmsymbol list }
          { reset the asmsymbol list }
-           CreateUsedAsmSymbolList;
+           current_library.CreateUsedAsmSymbolList;
 
 
 {$ifdef MULTIPASS}
 {$ifdef MULTIPASS}
          { Pass 0 }
          { Pass 0 }
@@ -1431,7 +1432,7 @@ Implementation
            EndFileLineInfo;
            EndFileLineInfo;
 {$endif GDB}
 {$endif GDB}
            { check for undefined labels }
            { check for undefined labels }
-           UsedAsmSymbolListCheckUndefined;
+           current_Library.UsedAsmSymbolListCheckUndefined;
 
 
            { set section sizes }
            { set section sizes }
            objectdata.seTSectionsizes(objectalloc.secsize);
            objectdata.seTSectionsizes(objectalloc.secsize);
@@ -1461,12 +1462,13 @@ Implementation
 
 
            { reset the used symbols back, must be after the .o has been
            { reset the used symbols back, must be after the .o has been
              written }
              written }
-           UsedAsmsymbolListReset;
-           DestroyUsedAsmsymbolList;
+           current_library.UsedAsmsymbolListReset;
+           current_library.DestroyUsedAsmsymbolList;
 
 
            { end of lists? }
            { end of lists? }
            if not MaybeNextList(hp) then
            if not MaybeNextList(hp) then
             break;
             break;
+
            { save section for next loop }
            { save section for next loop }
            { this leads to a problem if starTSec is sec_none !! PM }
            { this leads to a problem if starTSec is sec_none !! PM }
            starTSec:=objectalloc.currsec;
            starTSec:=objectalloc.currsec;
@@ -1596,7 +1598,16 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.39  2002-07-26 21:15:37  florian
+  Revision 1.40  2002-08-11 13:24:10  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.39  2002/07/26 21:15:37  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.38  2002/07/10 07:24:40  jonas
   Revision 1.38  2002/07/10 07:24:40  jonas

+ 13 - 4
compiler/cclasses.pas

@@ -87,7 +87,7 @@ interface
           procedure insertList(p : TLinkedList);
           procedure insertList(p : TLinkedList);
           { concats another List at the end and make this List empty }
           { concats another List at the end and make this List empty }
           procedure concatList(p : TLinkedList);
           procedure concatList(p : TLinkedList);
-          { concats another List at the start and makes a copy 
+          { concats another List at the start and makes a copy
             the list is ordered in reverse.
             the list is ordered in reverse.
           }
           }
           procedure insertListcopy(p : TLinkedList);
           procedure insertListcopy(p : TLinkedList);
@@ -188,7 +188,7 @@ interface
        private
        private
          FRoot      : TNamedIndexItem;
          FRoot      : TNamedIndexItem;
          FHashArray : Pdictionaryhasharray;
          FHashArray : Pdictionaryhasharray;
-         procedure cleartree(obj:TNamedIndexItem);
+         procedure cleartree(var obj:TNamedIndexItem);
          function  insertNode(NewNode:TNamedIndexItem;var currNode:TNamedIndexItem):TNamedIndexItem;
          function  insertNode(NewNode:TNamedIndexItem;var currNode:TNamedIndexItem):TNamedIndexItem;
          procedure inserttree(currtree,currroot:TNamedIndexItem);
          procedure inserttree(currtree,currroot:TNamedIndexItem);
        public
        public
@@ -890,7 +890,7 @@ end;
       end;
       end;
 
 
 
 
-    procedure Tdictionary.cleartree(obj:TNamedIndexItem);
+    procedure Tdictionary.cleartree(var obj:TNamedIndexItem);
       begin
       begin
         if assigned(obj.Fleft) then
         if assigned(obj.Fleft) then
           cleartree(obj.FLeft);
           cleartree(obj.FLeft);
@@ -1735,7 +1735,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2002-08-09 19:08:53  carl
+  Revision 1.17  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.16  2002/08/09 19:08:53  carl
     + fix incorrect comment in insertlistcopy
     + fix incorrect comment in insertlistcopy
 
 
   Revision 1.15  2002/07/01 18:46:21  peter
   Revision 1.15  2002/07/01 18:46:21  peter

+ 15 - 6
compiler/cg64f32.pas

@@ -486,7 +486,7 @@ unit cg64f32;
                  got_scratch := true;
                  got_scratch := true;
                  a_load64high_ref_reg(list,p.location.reference,hreg);
                  a_load64high_ref_reg(list,p.location.reference,hreg);
                end;
                end;
-             getlabel(poslabel);
+             current_library.getlabel(poslabel);
 
 
              { check high dword, must be 0 (for positive numbers) }
              { check high dword, must be 0 (for positive numbers) }
              cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,0,hreg,poslabel);
              cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,0,hreg,poslabel);
@@ -494,7 +494,7 @@ unit cg64f32;
              { It can also be $ffffffff, but only for negative numbers }
              { It can also be $ffffffff, but only for negative numbers }
              if from_signed and to_signed then
              if from_signed and to_signed then
                begin
                begin
-                 getlabel(neglabel);
+                 current_library.getlabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,aword(-1),hreg,neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,aword(-1),hreg,neglabel);
                end;
                end;
              { !!! freeing of register should happen directly after compare! (JM) }
              { !!! freeing of register should happen directly after compare! (JM) }
@@ -518,7 +518,7 @@ unit cg64f32;
 
 
              if from_signed and to_signed then
              if from_signed and to_signed then
                begin
                begin
-                 getlabel(endlabel);
+                 current_library.getlabel(endlabel);
                  cg.a_jmp_always(list,endlabel);
                  cg.a_jmp_always(list,endlabel);
                  { if the high dword = $ffffffff, then the low dword (when }
                  { if the high dword = $ffffffff, then the low dword (when }
                  { considered as a longint) must be < 0                    }
                  { considered as a longint) must be < 0                    }
@@ -535,7 +535,7 @@ unit cg64f32;
                      a_load64low_ref_reg(list,p.location.reference,hreg);
                      a_load64low_ref_reg(list,p.location.reference,hreg);
                    end;
                    end;
                  { get a new neglabel (JM) }
                  { get a new neglabel (JM) }
-                 getlabel(neglabel);
+                 current_library.getlabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_LT,0,hreg,neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_LT,0,hreg,neglabel);
                  { !!! freeing of register should happen directly after compare! (JM) }
                  { !!! freeing of register should happen directly after compare! (JM) }
                  if got_scratch then
                  if got_scratch then
@@ -593,7 +593,7 @@ unit cg64f32;
                    else
                    else
                      cg.a_load_ref_reg(list,opsize,p.location.reference,hreg);
                      cg.a_load_ref_reg(list,opsize,p.location.reference,hreg);
                  end;
                  end;
-               getlabel(poslabel);
+               current_library.getlabel(poslabel);
                cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel);
                cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel);
 
 
                { !!! freeing of register should happen directly after compare! (JM) }
                { !!! freeing of register should happen directly after compare! (JM) }
@@ -617,7 +617,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2002-07-28 15:57:15  jonas
+  Revision 1.23  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.22  2002/07/28 15:57:15  jonas
     * fixed a_load64_const_reg() for big endian systems
     * fixed a_load64_const_reg() for big endian systems
 
 
   Revision 1.21  2002/07/20 11:57:52  florian
   Revision 1.21  2002/07/20 11:57:52  florian

+ 15 - 14
compiler/cgbase.pas

@@ -232,7 +232,8 @@ implementation
         systems,
         systems,
         cresstr,
         cresstr,
         rgobj,
         rgobj,
-        defbase
+        defbase,
+        fmodule
 {$ifdef fixLeaksOnError}
 {$ifdef fixLeaksOnError}
         ,comphook
         ,comphook
 {$endif fixLeaksOnError}
 {$endif fixLeaksOnError}
@@ -432,15 +433,13 @@ implementation
          importssection:=nil;
          importssection:=nil;
          exportssection:=nil;
          exportssection:=nil;
          resourcesection:=nil;
          resourcesection:=nil;
-         { assembler symbols }
-         asmsymbollist:=tdictionary.create;
-         asmsymbollist.usehash;
          { resourcestrings }
          { resourcestrings }
          ResourceStrings:=TResourceStrings.Create;
          ResourceStrings:=TResourceStrings.Create;
+         { use the librarydata from current_module }
+         current_library:=current_module.librarydata;
       end;
       end;
 
 
 
 
-
     procedure codegen_donemodule;
     procedure codegen_donemodule;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
       var
       var
@@ -468,17 +467,10 @@ implementation
           resourcesection.free;
           resourcesection.free;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
          d.free;
          d.free;
-{$endif}
-         { assembler symbols }
-{$ifdef MEMDEBUG}
-         d:=tmemdebug.create('asmsymbol');
-{$endif}
-         asmsymbollist.free;
-{$ifdef MEMDEBUG}
-         d.free;
 {$endif}
 {$endif}
          { resource strings }
          { resource strings }
          ResourceStrings.free;
          ResourceStrings.free;
+         current_library:=nil;
       end;
       end;
 
 
 
 
@@ -590,7 +582,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2002-08-06 20:55:20  florian
+  Revision 1.23  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.22  2002/08/06 20:55:20  florian
     * first part of ppc calling conventions fix
     * first part of ppc calling conventions fix
 
 
   Revision 1.21  2002/08/05 18:27:48  carl
   Revision 1.21  2002/08/05 18:27:48  carl

+ 12 - 3
compiler/cgobj.pas

@@ -1204,7 +1204,7 @@ unit cgobj;
               p.location.reference,hreg);
               p.location.reference,hreg);
             a_op_const_reg(list,OP_SUB,aword(lto),hreg);
             a_op_const_reg(list,OP_SUB,aword(lto),hreg);
           end;
           end;
-        getlabel(neglabel);
+        current_library.getlabel(neglabel);
         a_cmp_const_reg_label(list,OS_INT,OC_BE,aword(hto-lto),hreg,neglabel);
         a_cmp_const_reg_label(list,OS_INT,OC_BE,aword(hto-lto),hreg,neglabel);
         { !!! should happen right after the compare (JM) }
         { !!! should happen right after the compare (JM) }
         free_scratch_reg(list,hreg);
         free_scratch_reg(list,hreg);
@@ -1339,7 +1339,7 @@ unit cgobj;
            { must the object be finalized ? }
            { must the object be finalized ? }
            if procinfo^._class.needs_inittable then
            if procinfo^._class.needs_inittable then
             begin
             begin
-              getlabel(nofinal);
+              current_library.getlabel(nofinal);
               reference_reset_base(href,procinfo^.framepointer,target_info.first_parm_offset);
               reference_reset_base(href,procinfo^.framepointer,target_info.first_parm_offset);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               reference_reset_base(href,SELF_POINTER_REG,0);
               reference_reset_base(href,SELF_POINTER_REG,0);
@@ -1470,7 +1470,16 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  2002-08-10 17:15:20  jonas
+  Revision 1.46  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.45  2002/08/10 17:15:20  jonas
     * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
     * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
 
 
   Revision 1.44  2002/08/09 19:10:05  carl
   Revision 1.44  2002/08/09 19:10:05  carl

+ 12 - 3
compiler/cresstr.pas

@@ -154,7 +154,7 @@ procedure TResourceStrings.CreateResourceStringList;
          resourcestringlist.concat(tai_const.create_32bit(0))
          resourcestringlist.concat(tai_const.create_32bit(0))
        else
        else
          begin
          begin
-            getdatalabel(l1);
+            current_library.getdatalabel(l1);
             resourcestringlist.concat(tai_const_symbol.create(l1));
             resourcestringlist.concat(tai_const_symbol.create(l1));
             consts.concat(tai_const.create_32bit(len));
             consts.concat(tai_const.create_32bit(len));
             consts.concat(tai_const.create_32bit(len));
             consts.concat(tai_const.create_32bit(len));
@@ -170,7 +170,7 @@ procedure TResourceStrings.CreateResourceStringList;
        resourcestringlist.concat(tai_const.create_32bit(0));
        resourcestringlist.concat(tai_const.create_32bit(0));
        resourcestringlist.concat(tai_const.create_32bit(hash));
        resourcestringlist.concat(tai_const.create_32bit(hash));
        { Append the name as a ansistring. }
        { Append the name as a ansistring. }
-       getdatalabel(l1);
+       current_library.getdatalabel(l1);
        L:=Length(Name);
        L:=Length(Name);
        resourcestringlist.concat(tai_const_symbol.create(l1));
        resourcestringlist.concat(tai_const_symbol.create(l1));
        consts.concat(tai_const.create_32bit(l));
        consts.concat(tai_const.create_32bit(l));
@@ -294,7 +294,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2002-07-01 18:46:22  peter
+  Revision 1.15  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.14  2002/07/01 18:46:22  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 22 - 9
compiler/finput.pas

@@ -248,16 +248,16 @@ uses
         if is_macro then
         if is_macro then
          begin
          begin
            if assigned(buf) then
            if assigned(buf) then
-             Freemem(buf,maxbufsize);
-           buf:=nil;
-           {is_macro:=false;
-           still needed for dispose in scanner PM }
+            begin
+              Freemem(buf,maxbufsize);
+              buf:=nil;
+            end;
            closed:=true;
            closed:=true;
            exit;
            exit;
          end;
          end;
         if not closed then
         if not closed then
          begin
          begin
-           if fileclose then;
+           fileclose;
            closed:=true;
            closed:=true;
          end;
          end;
         if assigned(buf) then
         if assigned(buf) then
@@ -275,13 +275,17 @@ uses
          exit;
          exit;
         if not closed then
         if not closed then
          begin
          begin
-           if fileclose then;
-           Freemem(buf,maxbufsize);
-           buf:=nil;
+           fileclose;
+           if assigned(buf) then
+            begin
+              Freemem(buf,maxbufsize);
+              buf:=nil;
+            end;
            closed:=true;
            closed:=true;
          end;
          end;
       end;
       end;
 
 
+
     function tinputfile.tempopen:boolean;
     function tinputfile.tempopen:boolean;
       begin
       begin
         tempopen:=false;
         tempopen:=false;
@@ -698,7 +702,16 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  2002-07-26 21:15:37  florian
+  Revision 1.18  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.17  2002/07/26 21:15:37  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.16  2002/07/01 18:46:22  peter
   Revision 1.16  2002/07/01 18:46:22  peter

+ 22 - 2
compiler/fmodule.pas

@@ -39,7 +39,7 @@ interface
     uses
     uses
        cutils,cclasses,
        cutils,cclasses,
        globals,finput,
        globals,finput,
-       symbase;
+       symbase,aasmbase;
 
 
     const
     const
        maxunits = 1024;
        maxunits = 1024;
@@ -124,6 +124,7 @@ interface
           locallibrarysearchpath : TSearchPathList;
           locallibrarysearchpath : TSearchPathList;
 
 
           asmprefix     : pstring;  { prefix for the smartlink asmfiles }
           asmprefix     : pstring;  { prefix for the smartlink asmfiles }
+          librarydata   : tasmlibrarydata;   { librarydata for this module }
           constructor create(const s:string;_is_unit:boolean);
           constructor create(const s:string;_is_unit:boolean);
           destructor destroy;override;
           destructor destroy;override;
           procedure reset;virtual;
           procedure reset;virtual;
@@ -411,6 +412,7 @@ uses
         imports:=TLinkedList.Create;
         imports:=TLinkedList.Create;
         _exports:=TLinkedList.Create;
         _exports:=TLinkedList.Create;
         externals:=TLinkedList.Create;
         externals:=TLinkedList.Create;
+        librarydata:=tasmlibrarydata.create(realmodulename^);
       end;
       end;
 
 
 
 
@@ -469,6 +471,13 @@ uses
         localsymtable:=nil;
         localsymtable:=nil;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
         d.free;
         d.free;
+{$endif}
+{$ifdef MEMDEBUG}
+        d:=tmemdebug.create('librarydata');
+{$endif}
+        librarydata.free;
+{$ifdef MEMDEBUG}
+        d.free;
 {$endif}
 {$endif}
         inherited Destroy;
         inherited Destroy;
       end;
       end;
@@ -497,6 +506,8 @@ uses
          end;
          end;
         sourcefiles.free;
         sourcefiles.free;
         sourcefiles:=tinputfilemanager.create;
         sourcefiles:=tinputfilemanager.create;
+        librarydata.free;
+        librarydata:=tasmlibrarydata.create(realmodulename^);
         imports.free;
         imports.free;
         imports:=tlinkedlist.create;
         imports:=tlinkedlist.create;
         _exports.free;
         _exports.free;
@@ -584,7 +595,16 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2002-05-16 19:46:36  carl
+  Revision 1.24  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.23  2002/05/16 19:46:36  carl
   + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
   + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
   + try to fix temp allocation (still in ifdef)
   + try to fix temp allocation (still in ifdef)
   + generic constructor calls
   + generic constructor calls

+ 101 - 6
compiler/fppu.pas

@@ -56,6 +56,7 @@ interface
           procedure loadppu;
           procedure loadppu;
        private
        private
           procedure load_interface;
           procedure load_interface;
+          procedure load_implementation;
           procedure load_symtable_refs;
           procedure load_symtable_refs;
           procedure load_usedunits;
           procedure load_usedunits;
           procedure writeusedmacro(p:TNamedIndexItem;arg:pointer);
           procedure writeusedmacro(p:TNamedIndexItem;arg:pointer);
@@ -63,10 +64,13 @@ interface
           procedure writesourcefiles;
           procedure writesourcefiles;
           procedure writeusedunit;
           procedure writeusedunit;
           procedure writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
           procedure writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
+          procedure putasmsymbol_in_idx(s:tnamedindexitem;arg:pointer);
+          procedure writeasmsymbols;
           procedure readusedmacros;
           procedure readusedmacros;
           procedure readsourcefiles;
           procedure readsourcefiles;
           procedure readloadunit;
           procedure readloadunit;
           procedure readlinkcontainer(var p:tlinkcontainer);
           procedure readlinkcontainer(var p:tlinkcontainer);
+          procedure readasmsymbols;
        end;
        end;
 
 
 
 
@@ -79,6 +83,7 @@ uses
   verbose,systems,version,
   verbose,systems,version,
   symtable,
   symtable,
   scanner,
   scanner,
+  aasmbase,
   parser;
   parser;
 
 
 
 
@@ -443,6 +448,37 @@ uses
       end;
       end;
 
 
 
 
+    procedure tppumodule.putasmsymbol_in_idx(s:tnamedindexitem;arg:pointer);
+      begin
+        if tasmsymbol(s).ppuidx<>-1 then
+         librarydata.asmsymbolidx^[tasmsymbol(s).ppuidx]:=tasmsymbol(s);
+      end;
+
+
+    procedure tppumodule.writeasmsymbols;
+      var
+        s : tasmsymbol;
+        i : longint;
+      begin
+        { get an ordered list of all symbols to put in the ppu }
+        getmem(librarydata.asmsymbolidx,librarydata.asmsymbolppuidx*sizeof(pointer));
+        librarydata.symbolsearch.foreach({$ifdef FPCPROCVAR}@{$endif}putasmsymbol_in_idx,nil);
+        { write the number of symbols }
+        ppufile.putlongint(librarydata.asmsymbolppuidx);
+        { write the symbols from the indexed list to the ppu }
+        for i:=0 to librarydata.asmsymbolppuidx-1 do
+         begin
+           s:=librarydata.asmsymbolidx^[i];
+           if not assigned(s) then
+            internalerror(200208071);
+           ppufile.putstring(s.name);
+           ppufile.putbyte(byte(s.defbind));
+           ppufile.putbyte(byte(s.typ));
+         end;
+        ppufile.writeentry(ibasmsymbols);
+      end;
+
+
     procedure tppumodule.readusedmacros;
     procedure tppumodule.readusedmacros;
       var
       var
         hs : string;
         hs : string;
@@ -619,6 +655,28 @@ uses
       end;
       end;
 
 
 
 
+    procedure tppumodule.readasmsymbols;
+      var
+        i     : longint;
+        name  : string;
+        bind  : TAsmSymBind;
+        typ   : TAsmSymType;
+      begin
+        librarydata.asmsymbolppuidx:=ppufile.getlongint;
+        if librarydata.asmsymbolppuidx>0 then
+         begin
+           getmem(librarydata.asmsymbolidx,librarydata.asmsymbolppuidx*sizeof(pointer));
+           for i:=0 to librarydata.asmsymbolppuidx-1 do
+            begin
+              name:=ppufile.getstring;
+              bind:=tasmsymbind(ppufile.getbyte);
+              typ:=tasmsymtype(ppufile.getbyte);
+              librarydata.asmsymbolidx^[i]:=librarydata.newasmsymboltype(name,bind,typ);
+            end;
+         end;
+      end;
+
+
     procedure tppumodule.load_interface;
     procedure tppumodule.load_interface;
       var
       var
         b : byte;
         b : byte;
@@ -666,6 +724,30 @@ uses
       end;
       end;
 
 
 
 
+    procedure tppumodule.load_implementation;
+      var
+        b : byte;
+      begin
+       { read interface part }
+         repeat
+           b:=ppufile.readentry;
+           case b of
+             ibasmsymbols :
+               readasmsymbols;
+             ibendimplementation :
+               break;
+           else
+             Message1(unit_f_ppu_invalid_entry,tostr(b));
+           end;
+         until false;
+
+         { we can now derefence all pointers to the objectdata }
+         tstoredsymtable(globalsymtable).derefobjectdata;
+         if assigned(localsymtable) then
+           tstoredsymtable(localsymtable).derefobjectdata;
+      end;
+
+
     procedure tppumodule.load_symtable_refs;
     procedure tppumodule.load_symtable_refs;
       var
       var
          b : byte;
          b : byte;
@@ -754,6 +836,11 @@ uses
 
 
          { everything after this doesn't affect the crc }
          { everything after this doesn't affect the crc }
          ppufile.do_crc:=false;
          ppufile.do_crc:=false;
+
+         { write asmsymbols }
+         writeasmsymbols;
+
+         { end of implementation }
          ppufile.writeentry(ibendimplementation);
          ppufile.writeentry(ibendimplementation);
 
 
          { write static symtable
          { write static symtable
@@ -860,7 +947,6 @@ uses
         loaded_unit  : tmodule;
         loaded_unit  : tmodule;
         load_refs    : boolean;
         load_refs    : boolean;
         nextmapentry : longint;
         nextmapentry : longint;
-        b            : byte;
       begin
       begin
         load_refs:=true;
         load_refs:=true;
         { init the map }
         { init the map }
@@ -948,10 +1034,10 @@ uses
             end;
             end;
            pu:=tused_unit(pu.next);
            pu:=tused_unit(pu.next);
          end;
          end;
-        { read the implementation part }
-        b:=ppufile.readentry;
-        if b<>ibendimplementation then
-          Message1(unit_f_ppu_invalid_entry,tostr(b));
+
+        { read the implementation/object part }
+        load_implementation;
+
         { load browser info if stored }
         { load browser info if stored }
         if ((flags and uf_has_browser)<>0) and load_refs then
         if ((flags and uf_has_browser)<>0) and load_refs then
          begin
          begin
@@ -1173,7 +1259,16 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  2002-07-26 21:15:37  florian
+  Revision 1.18  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.17  2002/07/26 21:15:37  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.16  2002/05/16 19:46:36  carl
   Revision 1.16  2002/05/16 19:46:36  carl

+ 11 - 2
compiler/i386/ag386int.pas

@@ -708,7 +708,7 @@ ait_stab_function_name : ;
     procedure T386IntelAssembler.WriteExternals;
     procedure T386IntelAssembler.WriteExternals;
       begin
       begin
         currentasmlist:=self;
         currentasmlist:=self;
-        AsmSymbolList.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
+        current_library.symbolsearch.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
       end;
       end;
 
 
 
 
@@ -823,7 +823,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2002-07-26 21:15:43  florian
+  Revision 1.24  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.23  2002/07/26 21:15:43  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.22  2002/07/01 18:46:29  peter
   Revision 1.22  2002/07/01 18:46:29  peter

+ 11 - 2
compiler/i386/ag386nsm.pas

@@ -738,7 +738,7 @@ interface
     procedure T386NasmAssembler.WriteExternals;
     procedure T386NasmAssembler.WriteExternals;
       begin
       begin
         currentasmlist:=self;
         currentasmlist:=self;
-        AsmSymbolList.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
+        current_library.symbolsearch.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
       end;
       end;
 
 
 
 
@@ -898,7 +898,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2002-07-26 21:15:43  florian
+  Revision 1.23  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.22  2002/07/26 21:15:43  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.21  2002/07/01 18:46:29  peter
   Revision 1.21  2002/07/01 18:46:29  peter

+ 18 - 9
compiler/i386/n386add.pas

@@ -289,7 +289,7 @@ interface
          begin
          begin
            if cs_check_overflow in aktlocalswitches  then
            if cs_check_overflow in aktlocalswitches  then
             begin
             begin
-              getlabel(hl4);
+              current_library.getlabel(hl4);
               if unsigned then
               if unsigned then
                emitjmp(C_NB,hl4)
                emitjmp(C_NB,hl4)
               else
               else
@@ -457,9 +457,9 @@ interface
             if isjump then
             if isjump then
               begin
               begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
               end;
             secondpass(left);
             secondpass(left);
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
@@ -475,9 +475,9 @@ interface
             if isjump then
             if isjump then
               begin
               begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
               end;
             secondpass(right);
             secondpass(right);
             maybe_restore(exprasmlist,left.location,pushedregs);
             maybe_restore(exprasmlist,left.location,pushedregs);
@@ -529,7 +529,7 @@ interface
                    andn :
                    andn :
                      begin
                      begin
                         otl:=truelabel;
                         otl:=truelabel;
-                        getlabel(truelabel);
+                        current_library.getlabel(truelabel);
                         secondpass(left);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,truelabel);
                         cg.a_label(exprasmlist,truelabel);
@@ -538,7 +538,7 @@ interface
                    orn :
                    orn :
                      begin
                      begin
                         ofl:=falselabel;
                         ofl:=falselabel;
-                        getlabel(falselabel);
+                        current_library.getlabel(falselabel);
                         secondpass(left);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,falselabel);
                         cg.a_label(exprasmlist,falselabel);
@@ -1086,7 +1086,7 @@ interface
          begin
          begin
            if cs_check_overflow in aktlocalswitches  then
            if cs_check_overflow in aktlocalswitches  then
             begin
             begin
-              getlabel(hl4);
+              current_library.getlabel(hl4);
               if unsigned then
               if unsigned then
                emitjmp(C_NB,hl4)
                emitjmp(C_NB,hl4)
               else
               else
@@ -1551,7 +1551,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  2002-07-26 11:17:52  jonas
+  Revision 1.46  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.45  2002/07/26 11:17:52  jonas
     * the optimization of converting a multiplication with a power of two to
     * the optimization of converting a multiplication with a power of two to
       a shl is moved from n386add/secondpass to nadd/resulttypepass
       a shl is moved from n386add/secondpass to nadd/resulttypepass
 
 

+ 24 - 15
compiler/i386/n386cal.pas

@@ -111,8 +111,8 @@ implementation
 
 
          otlabel:=truelabel;
          otlabel:=truelabel;
          oflabel:=falselabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          secondpass(left);
          { handle varargs first, because defcoll is not valid }
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
          if (nf_varargs_para in flags) then
@@ -395,7 +395,7 @@ implementation
                  (po_iocheck in procdefinition.procoptions) and
                  (po_iocheck in procdefinition.procoptions) and
                  not(po_iocheck in aktprocdef.procoptions) then
                  not(po_iocheck in aktprocdef.procoptions) then
                 begin
                 begin
-                   getaddrlabel(iolabel);
+                   current_library.getaddrlabel(iolabel);
                    cg.a_label(exprasmlist,iolabel);
                    cg.a_label(exprasmlist,iolabel);
                 end
                 end
               else
               else
@@ -626,7 +626,7 @@ implementation
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                          else
                                          else
                                            begin
                                            begin
-                                             reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                             reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                              cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
                                              cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
                                            end;
                                            end;
                                          { emit_reg(A_PUSH,S_L,R_ESI);
                                          { emit_reg(A_PUSH,S_L,R_ESI);
@@ -683,7 +683,7 @@ implementation
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
                                     { insert the vmt }
                                     { insert the vmt }
-                                    reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                    reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                     cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                     extended_new:=true;
                                     extended_new:=true;
                                  end;
                                  end;
@@ -697,7 +697,7 @@ implementation
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
-                                    reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                    reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                     cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                  end;
                                  end;
                                else
                                else
@@ -769,7 +769,7 @@ implementation
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                                 begin
                                                 begin
                                                   { it's no bad idea, to insert the VMT }
                                                   { it's no bad idea, to insert the VMT }
-                                                  reference_reset_symbol(href,newasmsymbol(
+                                                  reference_reset_symbol(href,current_library.newasmsymbol(
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                                   cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                                   cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                                 end
                                                 end
@@ -825,7 +825,7 @@ implementation
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                     begin
                                       { it's no bad idea, to insert the VMT }
                                       { it's no bad idea, to insert the VMT }
-                                      reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
+                                      reference_reset_symbol(href,current_library.newasmsymbol(procinfo^._class.vmt_mangledname),0);
                                       cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                       cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                     end
                                     end
                                   { destructors haven't to dispose the instance, if this is }
                                   { destructors haven't to dispose the instance, if this is }
@@ -956,7 +956,7 @@ implementation
                      begin
                      begin
                         if (cs_check_object in aktlocalswitches) then
                         if (cs_check_object in aktlocalswitches) then
                           begin
                           begin
-                             reference_reset_symbol(hrefvmt,newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
+                             reference_reset_symbol(hrefvmt,current_library.newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
                              cg.a_paramaddr_ref(exprasmlist,hrefvmt,paramanager.getintparaloc(2));
                              cg.a_paramaddr_ref(exprasmlist,hrefvmt,paramanager.getintparaloc(2));
                              cg.a_param_reg(exprasmlist,OS_ADDR,href.base,paramanager.getintparaloc(1));
                              cg.a_param_reg(exprasmlist,OS_ADDR,href.base,paramanager.getintparaloc(1));
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
@@ -1126,7 +1126,7 @@ implementation
            assigned(methodpointer) and
            assigned(methodpointer) and
            (methodpointer.nodetype<>typen) then
            (methodpointer.nodetype<>typen) then
            begin
            begin
-              getlabel(constructorfailed);
+              current_library.getlabel(constructorfailed);
               emitjmp(C_Z,constructorfailed);
               emitjmp(C_Z,constructorfailed);
               cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(1));
               cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
               reference_reset_base(href,self_pointer_reg,0);
@@ -1355,8 +1355,8 @@ implementation
           oldexitlabel:=aktexitlabel;
           oldexitlabel:=aktexitlabel;
           oldexit2label:=aktexit2label;
           oldexit2label:=aktexit2label;
           oldquickexitlabel:=quickexitlabel;
           oldquickexitlabel:=quickexitlabel;
-          getlabel(aktexitlabel);
-          getlabel(aktexit2label);
+          current_library.getlabel(aktexitlabel);
+          current_library.getlabel(aktexit2label);
           { we're inlining a procedure }
           { we're inlining a procedure }
           inlining_procedure:=true;
           inlining_procedure:=true;
           { save old procinfo }
           { save old procinfo }
@@ -1388,8 +1388,8 @@ implementation
 {$ifdef GDB}
 {$ifdef GDB}
           if (cs_debuginfo in aktmoduleswitches) then
           if (cs_debuginfo in aktmoduleswitches) then
             begin
             begin
-              getaddrlabel(startlabel);
-              getaddrlabel(endlabel);
+              current_library.getaddrlabel(startlabel);
+              current_library.getaddrlabel(endlabel);
               cg.a_label(exprasmlist,startlabel);
               cg.a_label(exprasmlist,startlabel);
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
@@ -1481,7 +1481,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.60  2002-07-20 11:58:01  florian
+  Revision 1.61  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.60  2002/07/20 11:58:01  florian
     * types.pas renamed to defbase.pas because D6 contains a types
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added
     + Willamette/SSE2 instructions to assembler added

+ 17 - 8
compiler/i386/n386cnv.pas

@@ -164,8 +164,8 @@ implementation
                 rg.ungetregisterint(exprasmlist,R_EDI);
                 rg.ungetregisterint(exprasmlist,R_EDI);
                 reference_reset_base(href,R_ESP,0);
                 reference_reset_base(href,R_ESP,0);
                 emit_ref(A_FILD,S_IQ,href);
                 emit_ref(A_FILD,S_IQ,href);
-                getdatalabel(l1);
-                getlabel(l2);
+                current_library.getdatalabel(l1);
+                current_library.getlabel(l2);
                 emitjmp(C_Z,l2);
                 emitjmp(C_Z,l2);
                 Consts.concat(Tai_label.Create(l1));
                 Consts.concat(Tai_label.Create(l1));
                 { I got this constant from a test progtram (FK) }
                 { I got this constant from a test progtram (FK) }
@@ -198,8 +198,8 @@ implementation
       begin
       begin
          oldtruelabel:=truelabel;
          oldtruelabel:=truelabel;
          oldfalselabel:=falselabel;
          oldfalselabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          secondpass(left);
          if codegenerror then
          if codegenerror then
           exit;
           exit;
@@ -255,7 +255,7 @@ implementation
             LOC_JUMP :
             LOC_JUMP :
               begin
               begin
                 hregister:=rg.getregisterint(exprasmlist);
                 hregister:=rg.getregisterint(exprasmlist);
-                getlabel(hlabel);
+                current_library.getlabel(hlabel);
                 cg.a_label(exprasmlist,truelabel);
                 cg.a_label(exprasmlist,truelabel);
                 cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister);
                 cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister);
                 cg.a_jmp_always(exprasmlist,hlabel);
                 cg.a_jmp_always(exprasmlist,hlabel);
@@ -294,14 +294,14 @@ implementation
          { NIL must be accepted !! }
          { NIL must be accepted !! }
          emit_reg_reg(A_OR,S_L,r^.base,r^.base);
          emit_reg_reg(A_OR,S_L,r^.base,r^.base);
          rg.ungetregisterint(exprasmlist,R_EDI);
          rg.ungetregisterint(exprasmlist,R_EDI);
-         getlabel(nillabel);
+         current_library.getlabel(nillabel);
          emitjmp(C_E,nillabel);
          emitjmp(C_E,nillabel);
          { this is one point where we need vmt_offset (PM) }
          { this is one point where we need vmt_offset (PM) }
          r^.offset:= tobjectdef(tpointerdef(p^.resulttype.def).definition).vmt_offset;
          r^.offset:= tobjectdef(tpointerdef(p^.resulttype.def).definition).vmt_offset;
          rg.getexplicitregisterint(exprasmlist,R_EDI);
          rg.getexplicitregisterint(exprasmlist,R_EDI);
          emit_ref_reg(A_MOV,S_L,r,R_EDI);
          emit_ref_reg(A_MOV,S_L,r,R_EDI);
          emit_sym(A_PUSH,S_L,
          emit_sym(A_PUSH,S_L,
-           newasmsymbol(tobjectdef(tpointerdef(p^.resulttype.def).definition).vmt_mangledname));
+           current_library.newasmsymbol(tobjectdef(tpointerdef(p^.resulttype.def).definition).vmt_mangledname));
          emit_reg(A_PUSH,S_L,R_EDI);
          emit_reg(A_PUSH,S_L,R_EDI);
          rg.ungetregister32(exprasmlist,R_EDI);
          rg.ungetregister32(exprasmlist,R_EDI);
          emitcall('FPC_CHECK_OBJECT_EXT');
          emitcall('FPC_CHECK_OBJECT_EXT');
@@ -365,7 +365,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  2002-07-27 19:53:51  jonas
+  Revision 1.46  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.45  2002/07/27 19:53:51  jonas
     + generic implementation of tcg.g_flags2ref()
     + generic implementation of tcg.g_flags2ref()
     * tcg.flags2xxx() now also needs a size parameter
     * tcg.flags2xxx() now also needs a size parameter
 
 

+ 36 - 27
compiler/i386/n386flw.pas

@@ -90,7 +90,7 @@ implementation
                 end
                 end
               else
               else
                 begin
                 begin
-                   getaddrlabel(a);
+                   current_library.getaddrlabel(a);
                    cg.a_label(exprasmlist,a);
                    cg.a_label(exprasmlist,a);
                    cg.a_param_reg(exprasmlist,OS_INT,R_EBP,paramanager.getintparaloc(2));
                    cg.a_param_reg(exprasmlist,OS_INT,R_EBP,paramanager.getintparaloc(2));
                    emit_sym(A_PUSH,S_L,a);
                    emit_sym(A_PUSH,S_L,a);
@@ -185,20 +185,20 @@ implementation
            end;
            end;
 
 
          { get new labels for the control flow statements }
          { get new labels for the control flow statements }
-         getlabel(exittrylabel);
-         getlabel(exitexceptlabel);
+         current_library.getlabel(exittrylabel);
+         current_library.getlabel(exitexceptlabel);
          if assigned(aktbreaklabel) then
          if assigned(aktbreaklabel) then
            begin
            begin
-              getlabel(breaktrylabel);
-              getlabel(continuetrylabel);
-              getlabel(breakexceptlabel);
-              getlabel(continueexceptlabel);
+              current_library.getlabel(breaktrylabel);
+              current_library.getlabel(continuetrylabel);
+              current_library.getlabel(breakexceptlabel);
+              current_library.getlabel(continueexceptlabel);
            end;
            end;
 
 
-         getlabel(exceptlabel);
-         getlabel(doexceptlabel);
-         getlabel(endexceptlabel);
-         getlabel(lastonlabel);
+         current_library.getlabel(exceptlabel);
+         current_library.getlabel(doexceptlabel);
+         current_library.getlabel(endexceptlabel);
+         current_library.getlabel(lastonlabel);
 
 
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
@@ -275,8 +275,8 @@ implementation
 
 
               { the destruction of the exception object must be also }
               { the destruction of the exception object must be also }
               { guarded by an exception frame                        }
               { guarded by an exception frame                        }
-              getlabel(doobjectdestroy);
-              getlabel(doobjectdestroyandreraise);
+              current_library.getlabel(doobjectdestroy);
+              current_library.getlabel(doobjectdestroyandreraise);
 
 
               tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
               tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
               tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
               tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
@@ -422,11 +422,11 @@ implementation
       begin
       begin
          oldflowcontrol:=flowcontrol;
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[];
          flowcontrol:=[];
-         getlabel(nextonlabel);
+         current_library.getlabel(nextonlabel);
 
 
          { push the vmt }
          { push the vmt }
          emit_sym(A_PUSH,S_L,
          emit_sym(A_PUSH,S_L,
-           newasmsymbol(excepttype.vmt_mangledname));
+           current_library.newasmsymbol(excepttype.vmt_mangledname));
          cg.a_call_name(exprasmlist,'FPC_CATCHES');
          cg.a_call_name(exprasmlist,'FPC_CATCHES');
          { allocate eax }
          { allocate eax }
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
@@ -445,7 +445,7 @@ implementation
 
 
          { in the case that another exception is risen }
          { in the case that another exception is risen }
          { we've to destroy the old one                }
          { we've to destroy the old one                }
-         getlabel(doobjectdestroyandreraise);
+         current_library.getlabel(doobjectdestroyandreraise);
 
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
@@ -468,15 +468,15 @@ implementation
            begin
            begin
               oldaktexitlabel:=aktexitlabel;
               oldaktexitlabel:=aktexitlabel;
               oldaktexit2label:=aktexit2label;
               oldaktexit2label:=aktexit2label;
-              getlabel(exitonlabel);
+              current_library.getlabel(exitonlabel);
               aktexitlabel:=exitonlabel;
               aktexitlabel:=exitonlabel;
               aktexit2label:=exitonlabel;
               aktexit2label:=exitonlabel;
               if assigned(aktbreaklabel) then
               if assigned(aktbreaklabel) then
                begin
                begin
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktbreaklabel:=aktbreaklabel;
                  oldaktbreaklabel:=aktbreaklabel;
-                 getlabel(breakonlabel);
-                 getlabel(continueonlabel);
+                 current_library.getlabel(breakonlabel);
+                 current_library.getlabel(continueonlabel);
                  aktcontinuelabel:=continueonlabel;
                  aktcontinuelabel:=continueonlabel;
                  aktbreaklabel:=breakonlabel;
                  aktbreaklabel:=breakonlabel;
                end;
                end;
@@ -485,7 +485,7 @@ implementation
               cg.g_maybe_loadself(exprasmlist);
               cg.g_maybe_loadself(exprasmlist);
               secondpass(right);
               secondpass(right);
            end;
            end;
-         getlabel(doobjectdestroy);
+         current_library.getlabel(doobjectdestroy);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
          cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
          cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
          tg.ungetpersistanttempreference(exprasmlist,tempaddr);
          tg.ungetpersistanttempreference(exprasmlist,tempaddr);
@@ -580,23 +580,23 @@ implementation
          flowcontrol:=[];
          flowcontrol:=[];
          { we modify EAX }
          { we modify EAX }
          include(rg.usedinproc,R_EAX);
          include(rg.usedinproc,R_EAX);
-         getlabel(finallylabel);
-         getlabel(endfinallylabel);
-         getlabel(reraiselabel);
+         current_library.getlabel(finallylabel);
+         current_library.getlabel(endfinallylabel);
+         current_library.getlabel(reraiselabel);
 
 
          { the finally block must catch break, continue and exit }
          { the finally block must catch break, continue and exit }
          { statements                                            }
          { statements                                            }
          oldaktexitlabel:=aktexitlabel;
          oldaktexitlabel:=aktexitlabel;
          oldaktexit2label:=aktexit2label;
          oldaktexit2label:=aktexit2label;
-         getlabel(exitfinallylabel);
+         current_library.getlabel(exitfinallylabel);
          aktexitlabel:=exitfinallylabel;
          aktexitlabel:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          if assigned(aktbreaklabel) then
          if assigned(aktbreaklabel) then
           begin
           begin
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktbreaklabel:=aktbreaklabel;
             oldaktbreaklabel:=aktbreaklabel;
-            getlabel(breakfinallylabel);
-            getlabel(continuefinallylabel);
+            current_library.getlabel(breakfinallylabel);
+            current_library.getlabel(continuefinallylabel);
             aktcontinuelabel:=continuefinallylabel;
             aktcontinuelabel:=continuefinallylabel;
             aktbreaklabel:=breakfinallylabel;
             aktbreaklabel:=breakfinallylabel;
           end;
           end;
@@ -726,7 +726,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2002-07-11 14:41:33  florian
+  Revision 1.31  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.30  2002/07/11 14:41:33  florian
     * start of the new generic parameter handling
     * start of the new generic parameter handling
 
 
   Revision 1.29  2002/07/07 09:52:34  florian
   Revision 1.29  2002/07/07 09:52:34  florian

+ 17 - 8
compiler/i386/n386mat.pas

@@ -138,7 +138,7 @@ implementation
                         begin
                         begin
                           { a jump, but less operations }
                           { a jump, but less operations }
                           emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
                           emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
-                          getlabel(hl);
+                          current_library.getlabel(hl);
                           emitjmp(C_NS,hl);
                           emitjmp(C_NS,hl);
                           if power=1 then
                           if power=1 then
                             emit_reg(A_INC,S_L,hreg1)
                             emit_reg(A_INC,S_L,hreg1)
@@ -396,9 +396,9 @@ implementation
                    { so we've to do some tricks here                           }
                    { so we've to do some tricks here                           }
                    if nodetype=shln then
                    if nodetype=shln then
                      begin
                      begin
-                        getlabel(l1);
-                        getlabel(l2);
-                        getlabel(l3);
+                        current_library.getlabel(l1);
+                        current_library.getlabel(l2);
+                        current_library.getlabel(l3);
                         emit_const_reg(A_CMP,S_L,64,R_ECX);
                         emit_const_reg(A_CMP,S_L,64,R_ECX);
                         emitjmp(C_L,l1);
                         emitjmp(C_L,l1);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
@@ -422,9 +422,9 @@ implementation
                      end
                      end
                    else
                    else
                      begin
                      begin
-                        getlabel(l1);
-                        getlabel(l2);
-                        getlabel(l3);
+                        current_library.getlabel(l1);
+                        current_library.getlabel(l2);
+                        current_library.getlabel(l3);
                         emit_const_reg(A_CMP,S_L,64,R_ECX);
                         emit_const_reg(A_CMP,S_L,64,R_ECX);
                         emitjmp(C_L,l1);
                         emitjmp(C_L,l1);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
@@ -830,7 +830,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.34  2002-08-02 07:44:31  jonas
+  Revision 1.35  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.34  2002/08/02 07:44:31  jonas
     * made assigned() handling generic
     * made assigned() handling generic
     * add nodes now can also evaluate constant expressions at compile time
     * add nodes now can also evaluate constant expressions at compile time
       that contain nil nodes
       that contain nil nodes

+ 13 - 4
compiler/i386/n386mem.pas

@@ -380,9 +380,9 @@ implementation
               if isjump then
               if isjump then
                begin
                begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
                end;
                end;
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               secondpass(right);
               secondpass(right);
@@ -406,7 +406,7 @@ implementation
                         firstpass(hightree);
                         firstpass(hightree);
                         secondpass(hightree);
                         secondpass(hightree);
                         location_release(exprasmlist,hightree.location);
                         location_release(exprasmlist,hightree.location);
-                        reference_reset_symbol(href,newasmsymbol(tarraydef(left.resulttype.def).getrangecheckstring),4);
+                        reference_reset_symbol(href,current_library.newasmsymbol(tarraydef(left.resulttype.def).getrangecheckstring),4);
                         cg.a_load_loc_ref(exprasmlist,hightree.location,href);
                         cg.a_load_loc_ref(exprasmlist,hightree.location,href);
                         hightree.free;
                         hightree.free;
                         hightree:=nil;
                         hightree:=nil;
@@ -507,7 +507,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.39  2002-07-28 21:34:31  florian
+  Revision 1.40  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.39  2002/07/28 21:34:31  florian
     * more powerpc fixes
     * more powerpc fixes
     + dummy tcgvecnode
     + dummy tcgvecnode
 
 

+ 11 - 2
compiler/i386/n386obj.pas

@@ -216,7 +216,7 @@ begin
   { case 0 }
   { case 0 }
   else
   else
     begin
     begin
-      lab:=newasmsymbol(procdef.mangledname);
+      lab:=current_library.newasmsymbol(procdef.mangledname);
       emit_sym(A_JMP,S_NO,lab);
       emit_sym(A_JMP,S_NO,lab);
     end;
     end;
   exprasmlist:=oldexprasmlist;
   exprasmlist:=oldexprasmlist;
@@ -228,7 +228,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2002-08-09 07:33:04  florian
+  Revision 1.14  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.13  2002/08/09 07:33:04  florian
     * a couple of interface related fixes
     * a couple of interface related fixes
 
 
   Revision 1.12  2002/07/16 15:34:21  florian
   Revision 1.12  2002/07/16 15:34:21  florian

+ 11 - 2
compiler/i386/n386opt.pas

@@ -142,7 +142,7 @@ begin
   if checklength then
   if checklength then
     begin
     begin
       { is it already maximal? }
       { is it already maximal? }
-      getlabel(l);
+      current_library.getlabel(l);
       if tg.istemp(left.location.reference) then
       if tg.istemp(left.location.reference) then
         len:=255
         len:=255
       else
       else
@@ -248,7 +248,16 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2002-07-20 11:58:04  florian
+  Revision 1.22  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.21  2002/07/20 11:58:04  florian
     * types.pas renamed to defbase.pas because D6 contains a types
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added
     + Willamette/SSE2 instructions to assembler added

+ 21 - 12
compiler/i386/n386set.pas

@@ -255,7 +255,7 @@ implementation
             else
             else
               location.resflags:=F_E;
               location.resflags:=F_E;
 
 
-            getlabel(l);
+            current_library.getlabel(l);
 
 
             { how much have we already substracted from the x in the }
             { how much have we already substracted from the x in the }
             { "x in [y..z]" expression                               }
             { "x in [y..z]" expression                               }
@@ -438,8 +438,8 @@ implementation
                if right.location.loc=LOC_CONSTANT then
                if right.location.loc=LOC_CONSTANT then
                 begin
                 begin
                   location.resflags:=F_C;
                   location.resflags:=F_C;
-                  getlabel(l);
-                  getlabel(l2);
+                  current_library.getlabel(l);
+                  current_library.getlabel(l2);
 
 
                   { Is this treated in firstpass ?? }
                   { Is this treated in firstpass ?? }
                   if left.nodetype=ordconstn then
                   if left.nodetype=ordconstn then
@@ -614,7 +614,7 @@ implementation
                begin
                begin
                   if opsize=S_Q then
                   if opsize=S_Q then
                     begin
                     begin
-                       getlabel(l1);
+                       current_library.getlabel(l1);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                        emitjmp(C_NZ,l1);
                        emitjmp(C_NZ,l1);
                        emit_const_reg(A_CMP,S_L,longint(lo(int64(t^._low))),hregister);
                        emit_const_reg(A_CMP,S_L,longint(lo(int64(t^._low))),hregister);
@@ -637,7 +637,7 @@ implementation
                     begin
                     begin
                        if opsize=S_Q then
                        if opsize=S_Q then
                          begin
                          begin
-                            getlabel(l1);
+                            current_library.getlabel(l1);
                             emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                             emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                             emitjmp(jmp_le,elselabel);
                             emitjmp(jmp_le,elselabel);
                             emitjmp(jmp_gt,l1);
                             emitjmp(jmp_gt,l1);
@@ -655,7 +655,7 @@ implementation
 
 
                   if opsize=S_Q then
                   if opsize=S_Q then
                     begin
                     begin
-                       getlabel(l1);
+                       current_library.getlabel(l1);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._high))),hregister2);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._high))),hregister2);
                        emitjmp(jmp_le,t^.statement);
                        emitjmp(jmp_le,t^.statement);
                        emitjmp(jmp_gt,l1);
                        emitjmp(jmp_gt,l1);
@@ -797,7 +797,7 @@ implementation
                 emit_const_reg(A_CMP,opsize,longint(max_),hregister);
                 emit_const_reg(A_CMP,opsize,longint(max_),hregister);
                 emitjmp(jmp_gt,elselabel);
                 emitjmp(jmp_gt,elselabel);
              end;
              end;
-           getlabel(table);
+           current_library.getlabel(table);
            { extend with sign }
            { extend with sign }
            if opsize=S_W then
            if opsize=S_W then
              begin
              begin
@@ -850,8 +850,8 @@ implementation
          dist : dword;
          dist : dword;
 {$endif Delphi}
 {$endif Delphi}
       begin
       begin
-         getlabel(endlabel);
-         getlabel(elselabel);
+         current_library.getlabel(endlabel);
+         current_library.getlabel(elselabel);
          if (cs_create_smart in aktmoduleswitches) then
          if (cs_create_smart in aktmoduleswitches) then
            jumpsegment:=procinfo^.aktlocaldata
            jumpsegment:=procinfo^.aktlocaldata
          else
          else
@@ -875,9 +875,9 @@ implementation
          if left.location.loc=LOC_JUMP then
          if left.location.loc=LOC_JUMP then
           begin
           begin
             otl:=truelabel;
             otl:=truelabel;
-            getlabel(truelabel);
+            current_library.getlabel(truelabel);
             ofl:=falselabel;
             ofl:=falselabel;
-            getlabel(falselabel);
+            current_library.getlabel(falselabel);
             isjump:=true;
             isjump:=true;
           end;
           end;
          secondpass(left);
          secondpass(left);
@@ -1023,7 +1023,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.36  2002-07-23 14:31:00  daniel
+  Revision 1.37  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.36  2002/07/23 14:31:00  daniel
   * Added internal error when asked to generate code for 'if expr in []'
   * Added internal error when asked to generate code for 'if expr in []'
 
 
   Revision 1.35  2002/07/20 11:58:04  florian
   Revision 1.35  2002/07/20 11:58:04  florian

+ 11 - 2
compiler/i386/popt386.pas

@@ -509,7 +509,7 @@ Var
                   insertllitem(asml,p1,p1.next,Tai_asm_comment.Create(
                   insertllitem(asml,p1,p1.next,Tai_asm_comment.Create(
                     strpnew('previous label inserted'))));
                     strpnew('previous label inserted'))));
   {$endif finaldestdebug}
   {$endif finaldestdebug}
-                  getlabel(l);
+                  current_library.getlabel(l);
                   insertllitem(asml,p1,p1.next,Tai_label.Create(l));
                   insertllitem(asml,p1,p1.next,Tai_label.Create(l));
                   dec(tasmlabel(Taicpu(hp).oper[0].sym).refs);
                   dec(tasmlabel(Taicpu(hp).oper[0].sym).refs);
                   hp.oper[0].sym := l;
                   hp.oper[0].sym := l;
@@ -2044,7 +2044,16 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2002-07-26 21:15:43  florian
+  Revision 1.31  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.30  2002/07/26 21:15:43  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.29  2002/07/01 18:46:34  peter
   Revision 1.29  2002/07/01 18:46:34  peter

+ 12 - 3
compiler/i386/ra386att.pas

@@ -1275,7 +1275,7 @@ begin
    begin
    begin
      opr.typ:=OPR_SYMBOL;
      opr.typ:=OPR_SYMBOL;
      opr.symofs:=l;
      opr.symofs:=l;
-     opr.symbol:=newasmsymbol(tempstr);
+     opr.symbol:=current_library.newasmsymbol(tempstr);
    end
    end
   else
   else
    begin
    begin
@@ -1543,7 +1543,7 @@ Begin
                           Begin
                           Begin
                             { not found, finally ... add it anyways ... }
                             { not found, finally ... add it anyways ... }
                             Message1(asmr_w_id_supposed_external,expr);
                             Message1(asmr_w_id_supposed_external,expr);
-                            opr.ref.symbol:=newasmsymbol(expr);
+                            opr.ref.symbol:=current_library.newasmsymbol(expr);
                           end;
                           end;
                        end
                        end
                     else
                     else
@@ -2129,7 +2129,16 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.26  2002-07-26 21:15:44  florian
+  Revision 1.27  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.26  2002/07/26 21:15:44  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.25  2002/07/01 18:46:34  peter
   Revision 1.25  2002/07/01 18:46:34  peter

+ 12 - 3
compiler/i386/ra386int.pas

@@ -1254,7 +1254,7 @@ Begin
              if GotStar then
              if GotStar then
               Message(asmr_e_only_add_relocatable_symbol);
               Message(asmr_e_only_add_relocatable_symbol);
              if not assigned(opr.ref.symbol) then
              if not assigned(opr.ref.symbol) then
-              opr.ref.symbol:=newasmsymbol(tempstr)
+              opr.ref.symbol:=current_library.newasmsymbol(tempstr)
              else
              else
               Message(asmr_e_cant_have_multiple_relocatable_symbols);
               Message(asmr_e_cant_have_multiple_relocatable_symbols);
            end;
            end;
@@ -1310,7 +1310,7 @@ begin
    begin
    begin
      opr.typ:=OPR_SYMBOL;
      opr.typ:=OPR_SYMBOL;
      opr.symofs:=l;
      opr.symofs:=l;
-     opr.symbol:=newasmsymbol(tempstr);
+     opr.symbol:=current_library.newasmsymbol(tempstr);
    end
    end
   else
   else
    begin
    begin
@@ -1959,7 +1959,16 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2002-07-01 18:46:34  peter
+  Revision 1.30  2002-08-11 13:24:17  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.29  2002/07/01 18:46:34  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 15 - 6
compiler/m68k/rasm.pas

@@ -1618,7 +1618,7 @@ var
                           l:=instr.operands[operandnum]^.opr.val;
                           l:=instr.operands[operandnum]^.opr.val;
                           instr.operands[operandnum]^.opr.typ := OPR_SYMBOL;
                           instr.operands[operandnum]^.opr.typ := OPR_SYMBOL;
                           instr.operands[operandnum]^.opr.symofs := l;
                           instr.operands[operandnum]^.opr.symofs := l;
-                          instr.operands[operandnum]^.opr.symbol := newasmsymbol(tempstr);
+                          instr.operands[operandnum]^.opr.symbol := current_library.newasmsymbol(tempstr);
                         end;
                         end;
                  end;
                  end;
    { // Constant memory offset .              // }
    { // Constant memory offset .              // }
@@ -1715,7 +1715,7 @@ var
                             Begin
                             Begin
                              if getasmsymbol(actasmpattern) =nil then
                              if getasmsymbol(actasmpattern) =nil then
                                Message1(asmr_w_id_supposed_external,actasmpattern);
                                Message1(asmr_w_id_supposed_external,actasmpattern);
-                             instr.operands[operandnum]^.opr.ref.symbol:=newasmsymbol(actasmpattern);
+                             instr.operands[operandnum]^.opr.ref.symbol:=current_library.newasmsymbol(actasmpattern);
                             end
                             end
                            else
                            else
                              Message(asmr_e_syntax_error);
                              Message(asmr_e_syntax_error);
@@ -2218,16 +2218,25 @@ Begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2002-08-06 15:15:42  carl
+  Revision 1.2  2002-08-11 13:24:18  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.1  2002/08/06 15:15:42  carl
     + more m68k fixes
     + more m68k fixes
 
 
   Revision 1.1.2.7  2001/08/09 11:41:08  pierre
   Revision 1.1.2.7  2001/08/09 11:41:08  pierre
    + add more errors
    + add more errors
 
 
   Revision 1.1.2.6  2001/08/08 12:21:49  pierre
   Revision 1.1.2.6  2001/08/08 12:21:49  pierre
-   * generate correct labeled instruction for DBRA
-   * improoved checking of operands
-   + support for OPR_SYMBOL in generic instructions like MOVE
+   * generate correct labeled instruction for DBRA
+   * improoved checking of operands
+   + support for OPR_SYMBOL in generic instructions like MOVE
    + support for labels in constants like movel #datalabel + const,d0
    + support for labels in constants like movel #datalabel + const,d0
 
 
   Revision 1.1.2.5  2001/08/07 15:55:33  pierre
   Revision 1.1.2.5  2001/08/07 15:55:33  pierre

+ 14 - 6
compiler/ncgbas.pas

@@ -115,8 +115,7 @@ interface
              if not assigned(p.altsymbol) then
              if not assigned(p.altsymbol) then
               begin
               begin
                 { generatealtsymbol will also increase the refs }
                 { generatealtsymbol will also increase the refs }
-                p.GenerateAltSymbol;
-                UsedAsmSymbolListInsert(p);
+                current_library.GenerateAltSymbol(p);
               end
               end
              else
              else
               begin
               begin
@@ -136,7 +135,7 @@ interface
       begin
       begin
          if inlining_procedure then
          if inlining_procedure then
            begin
            begin
-             CreateUsedAsmSymbolList;
+             current_library.CreateUsedAsmSymbolList;
              localfixup:=aktprocdef.localst.address_fixup;
              localfixup:=aktprocdef.localst.address_fixup;
              parafixup:=aktprocdef.parast.address_fixup;
              parafixup:=aktprocdef.parast.address_fixup;
              hp:=tai(p_asm.first);
              hp:=tai(p_asm.first);
@@ -204,8 +203,8 @@ interface
                 hp:=tai(hp.next);
                 hp:=tai(hp.next);
               end;
               end;
              { restore used symbols }
              { restore used symbols }
-             UsedAsmSymbolListResetAltSym;
-             DestroyUsedAsmSymbolList;
+             current_library.UsedAsmSymbolListResetAltSym;
+             current_library.DestroyUsedAsmSymbolList;
            end
            end
          else
          else
            begin
            begin
@@ -294,7 +293,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2002-07-01 18:46:22  peter
+  Revision 1.21  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.20  2002/07/01 18:46:22  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 24 - 15
compiler/ncgcal.pas

@@ -106,8 +106,8 @@ implementation
 
 
          otlabel:=truelabel;
          otlabel:=truelabel;
          oflabel:=falselabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          secondpass(left);
          { handle varargs first, because defcoll is not valid }
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
          if (nf_varargs_para in flags) then
@@ -390,7 +390,7 @@ implementation
                  (po_iocheck in procdefinition.procoptions) and
                  (po_iocheck in procdefinition.procoptions) and
                  not(po_iocheck in aktprocdef.procoptions) then
                  not(po_iocheck in aktprocdef.procoptions) then
                 begin
                 begin
-                   getaddrlabel(iolabel);
+                   current_library.getaddrlabel(iolabel);
                    cg.a_label(exprasmlist,iolabel);
                    cg.a_label(exprasmlist,iolabel);
                 end
                 end
               else
               else
@@ -627,7 +627,7 @@ implementation
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                          else
                                          else
                                            begin
                                            begin
-                                             reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                             reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                              cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
                                              cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
                                            end;
                                            end;
                                          { emit_reg(A_PUSH,S_L,R_ESI);
                                          { emit_reg(A_PUSH,S_L,R_ESI);
@@ -684,7 +684,7 @@ implementation
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
                                     { insert the vmt }
                                     { insert the vmt }
-                                    reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                    reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     cg.a_paramaddr_ref(exprasmlist,href,1);
                                     cg.a_paramaddr_ref(exprasmlist,href,1);
                                     extended_new:=true;
                                     extended_new:=true;
                                  end;
                                  end;
@@ -698,7 +698,7 @@ implementation
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
                                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
-                                    reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
+                                    reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     cg.a_paramaddr_ref(exprasmlist,href,1);
                                     cg.a_paramaddr_ref(exprasmlist,href,1);
                                  end;
                                  end;
                                else
                                else
@@ -770,7 +770,7 @@ implementation
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                                 begin
                                                 begin
                                                   { it's no bad idea, to insert the VMT }
                                                   { it's no bad idea, to insert the VMT }
-                                                  reference_reset_symbol(href,newasmsymbol(
+                                                  reference_reset_symbol(href,current_library.newasmsymbol(
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                                   cg.a_paramaddr_ref(exprasmlist,href,1);
                                                   cg.a_paramaddr_ref(exprasmlist,href,1);
                                                 end
                                                 end
@@ -826,7 +826,7 @@ implementation
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                     begin
                                       { it's no bad idea, to insert the VMT }
                                       { it's no bad idea, to insert the VMT }
-                                      reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
+                                      reference_reset_symbol(href,current_library.newasmsymbol(procinfo^._class.vmt_mangledname),0);
                                       cg.a_paramaddr_ref(exprasmlist,href,1);
                                       cg.a_paramaddr_ref(exprasmlist,href,1);
                                     end
                                     end
                                   { destructors haven't to dispose the instance, if this is }
                                   { destructors haven't to dispose the instance, if this is }
@@ -958,7 +958,7 @@ implementation
                      begin
                      begin
                         if (cs_check_object in aktlocalswitches) then
                         if (cs_check_object in aktlocalswitches) then
                           begin
                           begin
-                             reference_reset_symbol(hrefvmt,newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
+                             reference_reset_symbol(hrefvmt,current_library.newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
                              cg.a_paramaddr_ref(exprasmlist,hrefvmt,2);
                              cg.a_paramaddr_ref(exprasmlist,hrefvmt,2);
                              cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
                              cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
@@ -1135,7 +1135,7 @@ implementation
            assigned(methodpointer) and
            assigned(methodpointer) and
            (methodpointer.nodetype<>typen) then
            (methodpointer.nodetype<>typen) then
            begin
            begin
-              getlabel(constructorfailed);
+              current_library.getlabel(constructorfailed);
               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,self_pointer_reg,constructorfailed);
               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,self_pointer_reg,constructorfailed);
               cg.a_param_reg(exprasmlist,OS_ADDR,accumulator,paramanager.getintparaloc(1));
               cg.a_param_reg(exprasmlist,OS_ADDR,accumulator,paramanager.getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
               reference_reset_base(href,self_pointer_reg,0);
@@ -1374,8 +1374,8 @@ implementation
           oldexitlabel:=aktexitlabel;
           oldexitlabel:=aktexitlabel;
           oldexit2label:=aktexit2label;
           oldexit2label:=aktexit2label;
           oldquickexitlabel:=quickexitlabel;
           oldquickexitlabel:=quickexitlabel;
-          getlabel(aktexitlabel);
-          getlabel(aktexit2label);
+          current_library.getlabel(aktexitlabel);
+          current_library.getlabel(aktexit2label);
           { we're inlining a procedure }
           { we're inlining a procedure }
           inlining_procedure:=true;
           inlining_procedure:=true;
           { save old procinfo }
           { save old procinfo }
@@ -1407,8 +1407,8 @@ implementation
 {$ifdef GDB}
 {$ifdef GDB}
           if (cs_debuginfo in aktmoduleswitches) then
           if (cs_debuginfo in aktmoduleswitches) then
             begin
             begin
-              getaddrlabel(startlabel);
-              getaddrlabel(endlabel);
+              current_library.getaddrlabel(startlabel);
+              current_library.getaddrlabel(endlabel);
               cg.a_label(exprasmlist,startlabel);
               cg.a_label(exprasmlist,startlabel);
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
@@ -1500,7 +1500,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2002-08-06 20:55:20  florian
+  Revision 1.5  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.4  2002/08/06 20:55:20  florian
     * first part of ppc calling conventions fix
     * first part of ppc calling conventions fix
 
 
   Revision 1.3  2002/07/20 11:57:53  florian
   Revision 1.3  2002/07/20 11:57:53  florian

+ 17 - 8
compiler/ncgcnv.pas

@@ -120,7 +120,7 @@ interface
                   (str_length(left)=0) then
                   (str_length(left)=0) then
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
-                  hr.symbol:=newasmsymbol('FPC_EMPTYCHAR');
+                  hr.symbol:=current_library.newasmsymbol('FPC_EMPTYCHAR');
                   location.register:=rg.getregisterint(exprasmlist);
                   location.register:=rg.getregisterint(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
                 end
@@ -141,7 +141,7 @@ interface
                   (str_length(left)=0) then
                   (str_length(left)=0) then
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
-                  hr.symbol:=newasmsymbol('FPC_EMPTYCHAR');
+                  hr.symbol:=current_library.newasmsymbol('FPC_EMPTYCHAR');
                   location.register:=rg.getregisterint(exprasmlist);
                   location.register:=rg.getregisterint(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
                 end
@@ -291,8 +291,8 @@ interface
       begin
       begin
          oldtruelabel:=truelabel;
          oldtruelabel:=truelabel;
          oldfalselabel:=falselabel;
          oldfalselabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          secondpass(left);
          location_copy(location,left.location);
          location_copy(location,left.location);
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { byte(boolean) or word(wordbool) or longint(longbool) must }
@@ -328,7 +328,7 @@ interface
          hr : treference;
          hr : treference;
       begin
       begin
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location_reset(location,LOC_REGISTER,OS_ADDR);
-         getlabel(l1);
+         current_library.getlabel(l1);
          case left.location.loc of
          case left.location.loc of
             LOC_CREGISTER,LOC_REGISTER:
             LOC_CREGISTER,LOC_REGISTER:
               location.register:=left.location.register;
               location.register:=left.location.register;
@@ -343,7 +343,7 @@ interface
          end;
          end;
          cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_NE,0,location.register,l1);
          cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_NE,0,location.register,l1);
          reference_reset(hr);
          reference_reset(hr);
-         hr.symbol:=newasmsymbol('FPC_EMPTYCHAR');
+         hr.symbol:=current_library.newasmsymbol('FPC_EMPTYCHAR');
          cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
          cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
          cg.a_label(exprasmlist,l1);
          cg.a_label(exprasmlist,l1);
       end;
       end;
@@ -372,7 +372,7 @@ interface
             else
             else
               internalerror(121120001);
               internalerror(121120001);
          end;
          end;
-         getlabel(l1);
+         current_library.getlabel(l1);
          cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,location.register,l1);
          cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,location.register,l1);
          cg.a_op_const_reg(exprasmlist,OP_ADD,aword(
          cg.a_op_const_reg(exprasmlist,OP_ADD,aword(
            tobjectdef(left.resulttype.def).implementedinterfaces.ioffsets(
            tobjectdef(left.resulttype.def).implementedinterfaces.ioffsets(
@@ -490,7 +490,16 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2002-07-20 11:57:53  florian
+  Revision 1.22  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.21  2002/07/20 11:57:53  florian
     * types.pas renamed to defbase.pas because D6 contains a types
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added
     + Willamette/SSE2 instructions to assembler added

+ 18 - 9
compiler/ncgcon.pas

@@ -123,7 +123,7 @@ implementation
              { :-(, we must generate a new entry }
              { :-(, we must generate a new entry }
              if not assigned(lab_real) then
              if not assigned(lab_real) then
                begin
                begin
-                  getdatalabel(lastlabel);
+                  current_library.getdatalabel(lastlabel);
                   lab_real:=lastlabel;
                   lab_real:=lastlabel;
                   if (cs_create_smart in aktmoduleswitches) then
                   if (cs_create_smart in aktmoduleswitches) then
                    Consts.concat(Tai_cut.Create);
                    Consts.concat(Tai_cut.Create);
@@ -299,7 +299,7 @@ implementation
               { :-(, we must generate a new entry }
               { :-(, we must generate a new entry }
               if not assigned(lab_str) then
               if not assigned(lab_str) then
                 begin
                 begin
-                   getdatalabel(lastlabel);
+                   current_library.getdatalabel(lastlabel);
                    lab_str:=lastlabel;
                    lab_str:=lastlabel;
                    if (cs_create_smart in aktmoduleswitches) then
                    if (cs_create_smart in aktmoduleswitches) then
                     Consts.concat(Tai_cut.Create);
                     Consts.concat(Tai_cut.Create);
@@ -313,8 +313,8 @@ implementation
                              Consts.concat(Tai_const.Create_32bit(0))
                              Consts.concat(Tai_const.Create_32bit(0))
                            else
                            else
                              begin
                              begin
-                                getdatalabel(l1);
-                                getdatalabel(l2);
+                                current_library.getdatalabel(l1);
+                                current_library.getdatalabel(l2);
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_const_symbol.Create(l1));
                                 Consts.concat(Tai_const_symbol.Create(l1));
                                 Consts.concat(Tai_const.Create_32bit(len));
                                 Consts.concat(Tai_const.Create_32bit(len));
@@ -338,8 +338,8 @@ implementation
                              Consts.concat(Tai_const.Create_32bit(0))
                              Consts.concat(Tai_const.Create_32bit(0))
                            else
                            else
                              begin
                              begin
-                                getdatalabel(l1);
-                                getdatalabel(l2);
+                                current_library.getdatalabel(l1);
+                                current_library.getdatalabel(l2);
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_const_symbol.Create(l1));
                                 Consts.concat(Tai_const_symbol.Create(l1));
 
 
@@ -460,7 +460,7 @@ implementation
              { :-(, we must generate a new entry }
              { :-(, we must generate a new entry }
              if not assigned(lab_set) then
              if not assigned(lab_set) then
                begin
                begin
-                 getdatalabel(lastlabel);
+                 current_library.getdatalabel(lastlabel);
                  lab_set:=lastlabel;
                  lab_set:=lastlabel;
                  if (cs_create_smart in aktmoduleswitches) then
                  if (cs_create_smart in aktmoduleswitches) then
                   Consts.concat(Tai_cut.Create);
                   Consts.concat(Tai_cut.Create);
@@ -503,7 +503,7 @@ implementation
       begin
       begin
         location_reset(location,LOC_CREFERENCE,OS_NO);
         location_reset(location,LOC_CREFERENCE,OS_NO);
         { label for GUID }
         { label for GUID }
-        getdatalabel(tmplabel);
+        current_library.getdatalabel(tmplabel);
         consts.concat(Tai_label.Create(tmplabel));
         consts.concat(Tai_label.Create(tmplabel));
         consts.concat(Tai_const.Create_32bit(value.D1));
         consts.concat(Tai_const.Create_32bit(value.D1));
         consts.concat(Tai_const.Create_16bit(value.D2));
         consts.concat(Tai_const.Create_16bit(value.D2));
@@ -525,7 +525,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2002-08-10 17:15:06  jonas
+  Revision 1.17  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.16  2002/08/10 17:15:06  jonas
     * endianess fix
     * endianess fix
 
 
   Revision 1.15  2002/07/23 12:34:30  daniel
   Revision 1.15  2002/07/23 12:34:30  daniel

+ 68 - 59
compiler/ncgflw.pas

@@ -66,7 +66,7 @@ interface
        tcgfailnode = class(tfailnode)
        tcgfailnode = class(tfailnode)
           procedure pass_2;override;
           procedure pass_2;override;
        end;
        end;
-       
+
        tcgraisenode = class(traisenode)
        tcgraisenode = class(traisenode)
           procedure pass_2;override;
           procedure pass_2;override;
        end;
        end;
@@ -83,7 +83,7 @@ interface
           procedure pass_2;override;
           procedure pass_2;override;
        end;
        end;
 
 
-       
+
 
 
 implementation
 implementation
 
 
@@ -109,9 +109,9 @@ implementation
          otlabel,oflabel : tasmlabel;
          otlabel,oflabel : tasmlabel;
 
 
       begin
       begin
-         getlabel(lloop);
-         getlabel(lcont);
-         getlabel(lbreak);
+         current_library.getlabel(lloop);
+         current_library.getlabel(lcont);
+         current_library.getlabel(lbreak);
          { arrange continue and breaklabels: }
          { arrange continue and breaklabels: }
          oldclabel:=aktcontinuelabel;
          oldclabel:=aktcontinuelabel;
          oldblabel:=aktbreaklabel;
          oldblabel:=aktbreaklabel;
@@ -182,8 +182,8 @@ implementation
       begin
       begin
          otlabel:=truelabel;
          otlabel:=truelabel;
          oflabel:=falselabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          rg.cleartempgen;
          rg.cleartempgen;
          secondpass(left);
          secondpass(left);
 
 
@@ -221,7 +221,7 @@ implementation
            begin
            begin
               if assigned(right) then
               if assigned(right) then
                 begin
                 begin
-                   getlabel(hl);
+                   current_library.getlabel(hl);
                    { do go back to if line !! }
                    { do go back to if line !! }
                    if not(cs_regalloc in aktglobalswitches) then
                    if not(cs_regalloc in aktglobalswitches) then
                      aktfilepos:=exprasmList.getlasttaifilepos^
                      aktfilepos:=exprasmList.getlasttaifilepos^
@@ -307,9 +307,9 @@ implementation
       begin
       begin
          oldclabel:=aktcontinuelabel;
          oldclabel:=aktcontinuelabel;
          oldblabel:=aktbreaklabel;
          oldblabel:=aktbreaklabel;
-         getlabel(aktcontinuelabel);
-         getlabel(aktbreaklabel);
-         getlabel(l3);
+         current_library.getlabel(aktcontinuelabel);
+         current_library.getlabel(aktbreaklabel);
+         current_library.getlabel(l3);
 
 
          { only calculate reference }
          { only calculate reference }
          rg.cleartempgen;
          rg.cleartempgen;
@@ -476,8 +476,8 @@ implementation
               allocated_acchigh := false;
               allocated_acchigh := false;
               otlabel:=truelabel;
               otlabel:=truelabel;
               oflabel:=falselabel;
               oflabel:=falselabel;
-              getlabel(truelabel);
-              getlabel(falselabel);
+              current_library.getlabel(truelabel);
+              current_library.getlabel(falselabel);
               secondpass(left);
               secondpass(left);
               { the result of left is not needed anymore after this
               { the result of left is not needed anymore after this
                 node }
                 node }
@@ -664,7 +664,7 @@ do_jmp:
                 end
                 end
               else
               else
                 begin
                 begin
-                   getaddrlabel(a);
+                   current_library.getaddrlabel(a);
                    cg.a_label(exprasmlist,a);
                    cg.a_label(exprasmlist,a);
                    reference_reset_symbol(href2,a,0);
                    reference_reset_symbol(href2,a,0);
                    cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(2));
                    cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(2));
@@ -691,8 +691,8 @@ do_jmp:
 
 
     var
     var
        endexceptlabel : tasmlabel;
        endexceptlabel : tasmlabel;
-       
-       
+
+
     procedure try_new_exception(list : taasmoutput;var jmpbuf,envbuf, href : treference;
     procedure try_new_exception(list : taasmoutput;var jmpbuf,envbuf, href : treference;
       a : aword; exceptlabel : tasmlabel);
       a : aword; exceptlabel : tasmlabel);
      begin
      begin
@@ -701,8 +701,8 @@ do_jmp:
        tg.gettempofsizereferencepersistant(list,sizeof(aword),href);
        tg.gettempofsizereferencepersistant(list,sizeof(aword),href);
        new_exception(list, jmpbuf,envbuf, href, a, exceptlabel);
        new_exception(list, jmpbuf,envbuf, href, a, exceptlabel);
      end;
      end;
-     
-     
+
+
     procedure try_free_exception(list : taasmoutput;var jmpbuf, envbuf, href : treference;
     procedure try_free_exception(list : taasmoutput;var jmpbuf, envbuf, href : treference;
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      begin
      begin
@@ -710,8 +710,8 @@ do_jmp:
          tg.ungetpersistanttempreference(list,jmpbuf);
          tg.ungetpersistanttempreference(list,jmpbuf);
          tg.ungetpersistanttempreference(list,envbuf);
          tg.ungetpersistanttempreference(list,envbuf);
      end;
      end;
-     
-     
+
+
 
 
     { does the necessary things to clean up the object stack }
     { does the necessary things to clean up the object stack }
     { in the except block                                    }
     { in the except block                                    }
@@ -765,23 +765,23 @@ do_jmp:
            end;
            end;
 
 
          { get new labels for the control flow statements }
          { get new labels for the control flow statements }
-         getlabel(exittrylabel);
-         getlabel(exitexceptlabel);
+         current_library.getlabel(exittrylabel);
+         current_library.getlabel(exitexceptlabel);
          if assigned(aktbreaklabel) then
          if assigned(aktbreaklabel) then
            begin
            begin
-              getlabel(breaktrylabel);
-              getlabel(continuetrylabel);
-              getlabel(breakexceptlabel);
-              getlabel(continueexceptlabel);
+              current_library.getlabel(breaktrylabel);
+              current_library.getlabel(continuetrylabel);
+              current_library.getlabel(breakexceptlabel);
+              current_library.getlabel(continueexceptlabel);
            end;
            end;
 
 
-         getlabel(exceptlabel);
-         getlabel(doexceptlabel);
-         getlabel(endexceptlabel);
-         getlabel(lastonlabel);
+         current_library.getlabel(exceptlabel);
+         current_library.getlabel(doexceptlabel);
+         current_library.getlabel(endexceptlabel);
+         current_library.getlabel(lastonlabel);
 
 
          try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,exceptlabel);
          try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,exceptlabel);
-         
+
          { try block }
          { try block }
          { set control flow labels for the try block }
          { set control flow labels for the try block }
          aktexitlabel:=exittrylabel;
          aktexitlabel:=exittrylabel;
@@ -800,10 +800,10 @@ do_jmp:
 
 
          cg.a_label(exprasmlist,exceptlabel);
          cg.a_label(exprasmlist,exceptlabel);
 
 
-                 
+
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,endexceptlabel,false);
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,endexceptlabel,false);
-         
-         
+
+
          cg.a_label(exprasmlist,doexceptlabel);
          cg.a_label(exprasmlist,doexceptlabel);
 
 
          { set control flow labels for the except block }
          { set control flow labels for the except block }
@@ -834,9 +834,9 @@ do_jmp:
 
 
               { the destruction of the exception object must be also }
               { the destruction of the exception object must be also }
               { guarded by an exception frame                        }
               { guarded by an exception frame                        }
-              getlabel(doobjectdestroy);
-              getlabel(doobjectdestroyandreraise);
-              
+              current_library.getlabel(doobjectdestroy);
+              current_library.getlabel(doobjectdestroyandreraise);
+
               try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,exceptlabel);
               try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,exceptlabel);
 
 
               { here we don't have to reset flowcontrol           }
               { here we don't have to reset flowcontrol           }
@@ -845,7 +845,7 @@ do_jmp:
               exceptflowcontrol:=flowcontrol;
               exceptflowcontrol:=flowcontrol;
 
 
               cg.a_label(exprasmlist,doobjectdestroyandreraise);
               cg.a_label(exprasmlist,doobjectdestroyandreraise);
-              
+
               try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
               try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
 
 
               cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
               cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
@@ -966,13 +966,13 @@ do_jmp:
       begin
       begin
          oldflowcontrol:=flowcontrol;
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[];
          flowcontrol:=[];
-         getlabel(nextonlabel);
+         current_library.getlabel(nextonlabel);
 
 
          { send the vmt parameter }
          { send the vmt parameter }
-         reference_reset_symbol(href2,newasmsymbol(excepttype.vmt_mangledname),0);
+         reference_reset_symbol(href2,current_library.newasmsymbol(excepttype.vmt_mangledname),0);
          cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(1));
          cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(1));
          cg.a_call_name(exprasmlist,'FPC_CATCHES');
          cg.a_call_name(exprasmlist,'FPC_CATCHES');
-         
+
          { is it this catch? No. go to next onlabel }
          { is it this catch? No. go to next onlabel }
          cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,accumulator,nextonlabel);
          cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,accumulator,nextonlabel);
          ref.symbol:=nil;
          ref.symbol:=nil;
@@ -982,28 +982,28 @@ do_jmp:
          if assigned(exceptsymtable) then
          if assigned(exceptsymtable) then
            tvarsym(exceptsymtable.symindex.first).address:=ref.offset;
            tvarsym(exceptsymtable.symindex.first).address:=ref.offset;
          cg.a_load_reg_ref(exprasmlist, OS_ADDR, accumulator, ref);
          cg.a_load_reg_ref(exprasmlist, OS_ADDR, accumulator, ref);
-         
+
 
 
          { in the case that another exception is risen }
          { in the case that another exception is risen }
          { we've to destroy the old one                }
          { we've to destroy the old one                }
-         getlabel(doobjectdestroyandreraise);
-         
+         current_library.getlabel(doobjectdestroyandreraise);
+
          { call setjmp, and jump to finally label on non-zero result }
          { call setjmp, and jump to finally label on non-zero result }
          try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,doobjectdestroyandreraise);
          try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,doobjectdestroyandreraise);
-         
+
          if assigned(right) then
          if assigned(right) then
            begin
            begin
               oldaktexitlabel:=aktexitlabel;
               oldaktexitlabel:=aktexitlabel;
               oldaktexit2label:=aktexit2label;
               oldaktexit2label:=aktexit2label;
-              getlabel(exitonlabel);
+              current_library.getlabel(exitonlabel);
               aktexitlabel:=exitonlabel;
               aktexitlabel:=exitonlabel;
               aktexit2label:=exitonlabel;
               aktexit2label:=exitonlabel;
               if assigned(aktbreaklabel) then
               if assigned(aktbreaklabel) then
                begin
                begin
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktbreaklabel:=aktbreaklabel;
                  oldaktbreaklabel:=aktbreaklabel;
-                 getlabel(breakonlabel);
-                 getlabel(continueonlabel);
+                 current_library.getlabel(breakonlabel);
+                 current_library.getlabel(continueonlabel);
                  aktcontinuelabel:=continueonlabel;
                  aktcontinuelabel:=continueonlabel;
                  aktbreaklabel:=breakonlabel;
                  aktbreaklabel:=breakonlabel;
                end;
                end;
@@ -1012,9 +1012,9 @@ do_jmp:
               cg.g_maybe_loadself(exprasmlist);
               cg.g_maybe_loadself(exprasmlist);
               secondpass(right);
               secondpass(right);
            end;
            end;
-         getlabel(doobjectdestroy);
+         current_library.getlabel(doobjectdestroy);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
-         
+
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
 
 
          cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
          cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
@@ -1098,23 +1098,23 @@ do_jmp:
          { check if child nodes do a break/continue/exit }
          { check if child nodes do a break/continue/exit }
          oldflowcontrol:=flowcontrol;
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[];
          flowcontrol:=[];
-         getlabel(finallylabel);
-         getlabel(endfinallylabel);
-         getlabel(reraiselabel);
+         current_library.getlabel(finallylabel);
+         current_library.getlabel(endfinallylabel);
+         current_library.getlabel(reraiselabel);
 
 
          { the finally block must catch break, continue and exit }
          { the finally block must catch break, continue and exit }
          { statements                                            }
          { statements                                            }
          oldaktexitlabel:=aktexitlabel;
          oldaktexitlabel:=aktexitlabel;
          oldaktexit2label:=aktexit2label;
          oldaktexit2label:=aktexit2label;
-         getlabel(exitfinallylabel);
+         current_library.getlabel(exitfinallylabel);
          aktexitlabel:=exitfinallylabel;
          aktexitlabel:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          if assigned(aktbreaklabel) then
          if assigned(aktbreaklabel) then
           begin
           begin
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktbreaklabel:=aktbreaklabel;
             oldaktbreaklabel:=aktbreaklabel;
-            getlabel(breakfinallylabel);
-            getlabel(continuefinallylabel);
+            current_library.getlabel(breakfinallylabel);
+            current_library.getlabel(continuefinallylabel);
             aktcontinuelabel:=continuefinallylabel;
             aktcontinuelabel:=continuefinallylabel;
             aktbreaklabel:=breakfinallylabel;
             aktbreaklabel:=breakfinallylabel;
           end;
           end;
@@ -1142,9 +1142,9 @@ do_jmp:
            CGMessage(cg_e_control_flow_outside_finally);
            CGMessage(cg_e_control_flow_outside_finally);
          if codegenerror then
          if codegenerror then
            exit;
            exit;
-    
+
          { the value should now be in the exception handler }
          { the value should now be in the exception handler }
-         cg.g_exception_reason_load(exprasmlist,href);  
+         cg.g_exception_reason_load(exprasmlist,href);
          cg.a_cmp_reg_reg_label(exprasmlist,OS_S32,OC_NE,accumulator,accumulator,finallylabel);
          cg.a_cmp_reg_reg_label(exprasmlist,OS_S32,OC_NE,accumulator,accumulator,finallylabel);
          cg.a_op_const_reg(exprasmlist,OP_SUB,1,accumulator);
          cg.a_op_const_reg(exprasmlist,OP_SUB,1,accumulator);
          cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,accumulator,reraiselabel);
          cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,accumulator,reraiselabel);
@@ -1226,7 +1226,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.32  2002-08-09 19:10:59  carl
+  Revision 1.33  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.32  2002/08/09 19:10:59  carl
     * fixed generic exception management
     * fixed generic exception management
 
 
   Revision 1.31  2002/08/04 19:06:41  carl
   Revision 1.31  2002/08/04 19:06:41  carl

+ 34 - 25
compiler/ncginl.pas

@@ -39,7 +39,7 @@ interface
           procedure second_predsucc;virtual;
           procedure second_predsucc;virtual;
           procedure second_incdec;virtual;
           procedure second_incdec;virtual;
           procedure second_typeinfo;virtual;
           procedure second_typeinfo;virtual;
-          procedure second_includeexclude;virtual; 
+          procedure second_includeexclude;virtual;
           procedure second_pi; virtual;
           procedure second_pi; virtual;
           procedure second_arctan_real; virtual;
           procedure second_arctan_real; virtual;
           procedure second_abs_real; virtual;
           procedure second_abs_real; virtual;
@@ -184,8 +184,8 @@ implementation
           internalerror(7123458);
           internalerror(7123458);
        otlabel:=truelabel;
        otlabel:=truelabel;
        oflabel:=falselabel;
        oflabel:=falselabel;
-       getlabel(truelabel);
-       getlabel(falselabel);
+       current_library.getlabel(truelabel);
+       current_library.getlabel(falselabel);
        secondpass(tcallparanode(left).left);
        secondpass(tcallparanode(left).left);
        maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
        maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
        cg.a_label(exprasmlist,falselabel);
        cg.a_label(exprasmlist,falselabel);
@@ -227,7 +227,7 @@ implementation
         if left.nodetype=typen then
         if left.nodetype=typen then
           begin
           begin
             hregister:=rg.getaddressregister(exprasmlist);
             hregister:=rg.getaddressregister(exprasmlist);
-            reference_reset_symbol(href,newasmsymbol(tobjectdef(left.resulttype.def).vmt_mangledname),0);
+            reference_reset_symbol(href,current_library.newasmsymbol(tobjectdef(left.resulttype.def).vmt_mangledname),0);
             cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
             cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
           end
           end
         else
         else
@@ -269,7 +269,7 @@ implementation
             begin
             begin
               location_force_reg(exprasmlist,left.location,OS_ADDR,false);
               location_force_reg(exprasmlist,left.location,OS_ADDR,false);
               hregister:=left.location.register;
               hregister:=left.location.register;
-              getlabel(lengthlab);
+              current_library.getlabel(lengthlab);
               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,lengthlab);
               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,lengthlab);
               reference_reset_base(href,hregister,-8);
               reference_reset_base(href,hregister,-8);
               cg.a_load_ref_reg(exprasmlist,OS_32,href,hregister);
               cg.a_load_ref_reg(exprasmlist,OS_32,href,hregister);
@@ -429,7 +429,7 @@ implementation
             end
             end
           else
           else
             begin
             begin
-              getlabel(ptrvalidlabel);
+              current_library.getlabel(ptrvalidlabel);
               cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg);
               cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg);
               cg.a_cmp_const_ref_label(exprasmlist, OS_ADDR, OC_NE, 0,
               cg.a_cmp_const_ref_label(exprasmlist, OS_ADDR, OC_NE, 0,
                   tcallparanode(left).left.location.reference, ptrvalidlabel);
                   tcallparanode(left).left.location.reference, ptrvalidlabel);
@@ -490,24 +490,24 @@ implementation
             begin
             begin
              use_small:=
              use_small:=
                  { set type }
                  { set type }
-                 (tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset) 
+                 (tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset)
                   and
                   and
-                   { elemenut number between 1 and 32 } 
-                  ((tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=orddef) and 
+                   { elemenut number between 1 and 32 }
+                  ((tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=orddef) and
                    (torddef(tcallparanode(tcallparanode(left).right).left.resulttype.def).high<=32) or
                    (torddef(tcallparanode(tcallparanode(left).right).left.resulttype.def).high<=32) or
-                   (tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=enumdef) and 
+                   (tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=enumdef) and
                    (tenumdef(tcallparanode(tcallparanode(left).right).left.resulttype.def).max<=32));
                    (tenumdef(tcallparanode(tcallparanode(left).right).left.resulttype.def).max<=32));
-            
+
               { generate code for the element to set }
               { generate code for the element to set }
               maybe_save(exprasmlist,tcallparanode(tcallparanode(left).right).left.registers32,
               maybe_save(exprasmlist,tcallparanode(tcallparanode(left).right).left.registers32,
                         tcallparanode(left).left.location,pushedregs);
                         tcallparanode(left).left.location,pushedregs);
               secondpass(tcallparanode(tcallparanode(left).right).left);
               secondpass(tcallparanode(tcallparanode(left).right).left);
               maybe_restore(exprasmlist,tcallparanode(left).left.location,pushedregs);
               maybe_restore(exprasmlist,tcallparanode(left).left.location,pushedregs);
-              
+
               { bitnumber - which must be loaded into register }
               { bitnumber - which must be loaded into register }
               hregister := cg.get_scratch_reg_int(exprasmlist);
               hregister := cg.get_scratch_reg_int(exprasmlist);
               hregister2 := rg.getregisterint(exprasmlist);
               hregister2 := rg.getregisterint(exprasmlist);
-              
+
               case tcallparanode(tcallparanode(left).right).left.location.loc of
               case tcallparanode(tcallparanode(left).right).left.location.loc of
                  LOC_CREGISTER,
                  LOC_CREGISTER,
                  LOC_REGISTER:
                  LOC_REGISTER:
@@ -527,11 +527,11 @@ implementation
                { hregister contains the bitnumber to add }
                { hregister contains the bitnumber to add }
                cg.a_load_const_reg(exprasmlist, OS_INT, 1, hregister2);
                cg.a_load_const_reg(exprasmlist, OS_INT, 1, hregister2);
                cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_INT, hregister, hregister2);
                cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_INT, hregister, hregister2);
-              
-              
+
+
               if use_small then
               if use_small then
                 begin
                 begin
-                  { possiblities : 
+                  { possiblities :
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        set value : LOC_REFERENCE, LOC_REGISTER
                        set value : LOC_REFERENCE, LOC_REGISTER
                   }
                   }
@@ -540,24 +540,24 @@ implementation
                     begin
                     begin
                      if inlinenumber=in_include_x_y then
                      if inlinenumber=in_include_x_y then
                        begin
                        begin
-                         cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2, 
+                         cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2,
                          tcallparanode(left).left.location.reference);
                          tcallparanode(left).left.location.reference);
                        end
                        end
                      else
                      else
                        begin
                        begin
-                         cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, 
+                         cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2,
                          hregister2);
                          hregister2);
-                         cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2, 
+                         cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2,
                          tcallparanode(left).left.location.reference);
                          tcallparanode(left).left.location.reference);
                        end;
                        end;
-                      
+
                     end
                     end
                   else
                   else
                     internalerror(20020728);
                     internalerror(20020728);
                 end
                 end
               else
               else
                 begin
                 begin
-                  { possiblities : 
+                  { possiblities :
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        set value : LOC_REFERENCE
                        set value : LOC_REFERENCE
                   }
                   }
@@ -568,7 +568,7 @@ implementation
                   cg.a_loadaddr_ref_reg(exprasmlist, tcallparanode(left).left.location.reference,addrreg);
                   cg.a_loadaddr_ref_reg(exprasmlist, tcallparanode(left).left.location.reference,addrreg);
                   cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_INT, hregister, addrreg);
                   cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_INT, hregister, addrreg);
                   reference_reset_base(href,addrreg,0);
                   reference_reset_base(href,addrreg,0);
-                  
+
                   if inlinenumber=in_include_x_y then
                   if inlinenumber=in_include_x_y then
                        begin
                        begin
                          cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2, href);
                          cg.a_op_reg_ref(exprasmlist, OP_OR, OS_32, hregister2, href);
@@ -578,11 +578,11 @@ implementation
                          cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, hregister2);
                          cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, hregister2);
                          cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2, href);
                          cg.a_op_reg_ref(exprasmlist, OP_AND, OS_32, hregister2, href);
                        end;
                        end;
-                       
+
                   cg.free_scratch_reg(exprasmlist, addrreg);
                   cg.free_scratch_reg(exprasmlist, addrreg);
                 end;
                 end;
                 cg.free_scratch_reg(exprasmlist,hregister);
                 cg.free_scratch_reg(exprasmlist,hregister);
-                rg.ungetregisterint(exprasmlist,hregister2); 
+                rg.ungetregisterint(exprasmlist,hregister2);
             end;
             end;
         end;
         end;
 
 
@@ -641,7 +641,16 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2002-08-05 18:27:48  carl
+  Revision 1.11  2002-08-11 13:24:11  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.10  2002/08/05 18:27:48  carl
     + more more more documentation
     + more more more documentation
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
 
 

+ 24 - 15
compiler/ncgld.pas

@@ -92,14 +92,14 @@ implementation
                      location.reference.offset:=tabsolutesym(symtableentry).address;
                      location.reference.offset:=tabsolutesym(symtableentry).address;
                    end
                    end
                   else
                   else
-                   location.reference.symbol:=newasmsymbol(tabsolutesym(symtableentry).mangledname);
+                   location.reference.symbol:=current_library.newasmsymbol(tabsolutesym(symtableentry).mangledname);
                end;
                end;
             constsym:
             constsym:
               begin
               begin
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                    begin
                    begin
                       location_reset(location,LOC_CREFERENCE,OS_ADDR);
                       location_reset(location,LOC_CREFERENCE,OS_ADDR);
-                      location.reference.symbol:=newasmsymbol(tconstsym(symtableentry).owner.name^+'_RESOURCESTRINGLIST');
+                      location.reference.symbol:=current_library.newasmsymbol(tconstsym(symtableentry).owner.name^+'_RESOURCESTRINGLIST');
                       location.reference.offset:=tconstsym(symtableentry).resstrindex*16+8;
                       location.reference.offset:=tconstsym(symtableentry).resstrindex*16+8;
                    end
                    end
                  else
                  else
@@ -111,13 +111,13 @@ implementation
                   { C variable }
                   { C variable }
                   if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
                   if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
                     begin
                     begin
-                       location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                     end
                     end
                   { DLL variable }
                   { DLL variable }
                   else if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
                   else if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
                     begin
                     begin
                        hregister:=rg.getaddressregister(exprasmlist);
                        hregister:=rg.getaddressregister(exprasmlist);
-                       location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,location.reference,hregister);
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,location.reference,hregister);
                        location.reference.symbol:=nil;
                        location.reference.symbol:=nil;
                        location.reference.base:=hregister;
                        location.reference.base:=hregister;
@@ -125,7 +125,7 @@ implementation
                   { external variable }
                   { external variable }
                   else if (vo_is_external in tvarsym(symtableentry).varoptions) then
                   else if (vo_is_external in tvarsym(symtableentry).varoptions) then
                     begin
                     begin
-                       location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                     end
                     end
                   { thread variable }
                   { thread variable }
                   else if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
                   else if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
@@ -133,7 +133,7 @@ implementation
                        { we've to allocate the register before we save the used registers }
                        { we've to allocate the register before we save the used registers }
                        location.reference.base:=rg.getaddressregister(exprasmlist);
                        location.reference.base:=rg.getaddressregister(exprasmlist);
                        rg.saveusedregisters(exprasmlist,pushed,[accumulator]);
                        rg.saveusedregisters(exprasmlist,pushed,[accumulator]);
-                       reference_reset_symbol(href,newasmsymbol(tvarsym(symtableentry).mangledname),0);
+                       reference_reset_symbol(href,current_library.newasmsymbol(tvarsym(symtableentry).mangledname),0);
                        cg.a_param_ref(exprasmlist,OS_ADDR,href,paramanager.getintparaloc(1));
                        cg.a_param_ref(exprasmlist,OS_ADDR,href,paramanager.getintparaloc(1));
                        { the called procedure isn't allowed to change }
                        { the called procedure isn't allowed to change }
                        { any register except EAX                    }
                        { any register except EAX                    }
@@ -215,7 +215,7 @@ implementation
                                  globalsymtable,
                                  globalsymtable,
                                  staticsymtable :
                                  staticsymtable :
                                    begin
                                    begin
-                                     location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                                     location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                                    end;
                                    end;
                                  stt_exceptsymtable:
                                  stt_exceptsymtable:
                                    begin
                                    begin
@@ -225,7 +225,7 @@ implementation
                                  objectsymtable:
                                  objectsymtable:
                                    begin
                                    begin
                                       if (sp_static in tvarsym(symtableentry).symoptions) then
                                       if (sp_static in tvarsym(symtableentry).symoptions) then
-                                        location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname)
+                                        location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname)
                                       else
                                       else
                                         begin
                                         begin
                                            rg.getexplicitregisterint(exprasmlist,SELF_POINTER_REG);
                                            rg.getexplicitregisterint(exprasmlist,SELF_POINTER_REG);
@@ -352,7 +352,7 @@ implementation
                             if freereg then
                             if freereg then
                              rg.ungetregisterint(exprasmlist,hregister);
                              rg.ungetregisterint(exprasmlist,hregister);
                             { load address of the function }
                             { load address of the function }
-                            reference_reset_symbol(href,newasmsymbol(tprocdef(resulttype.def).mangledname),0);
+                            reference_reset_symbol(href,current_library.newasmsymbol(tprocdef(resulttype.def).mangledname),0);
                             hregister:=cg.get_scratch_reg_address(exprasmlist);
                             hregister:=cg.get_scratch_reg_address(exprasmlist);
                             cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
                             cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
                             cg.a_load_reg_ref(exprasmlist,OS_ADDR,hregister,location.reference);
                             cg.a_load_reg_ref(exprasmlist,OS_ADDR,hregister,location.reference);
@@ -362,12 +362,12 @@ implementation
                   else
                   else
                     begin
                     begin
                        {!!!!! Be aware, work on virtual methods too }
                        {!!!!! Be aware, work on virtual methods too }
-                       location.reference.symbol:=newasmsymbol(tprocdef(resulttype.def).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tprocdef(resulttype.def).mangledname);
                     end;
                     end;
                end;
                end;
             typedconstsym :
             typedconstsym :
                begin
                begin
-                  location.reference.symbol:=newasmsymbol(ttypedconstsym(symtableentry).mangledname);
+                  location.reference.symbol:=current_library.newasmsymbol(ttypedconstsym(symtableentry).mangledname);
                end;
                end;
             else internalerror(4);
             else internalerror(4);
          end;
          end;
@@ -391,8 +391,8 @@ implementation
       begin
       begin
         otlabel:=truelabel;
         otlabel:=truelabel;
         oflabel:=falselabel;
         oflabel:=falselabel;
-        getlabel(truelabel);
-        getlabel(falselabel);
+        current_library.getlabel(truelabel);
+        current_library.getlabel(falselabel);
 
 
         {
         {
           in most cases we can process first the right node which contains
           in most cases we can process first the right node which contains
@@ -614,7 +614,7 @@ implementation
               LOC_JUMP :
               LOC_JUMP :
                 begin
                 begin
                   cgsize:=def_cgsize(left.resulttype.def);
                   cgsize:=def_cgsize(left.resulttype.def);
-                  getlabel(hlabel);
+                  current_library.getlabel(hlabel);
                   { generate the leftnode for the true case, and
                   { generate the leftnode for the true case, and
                     release the location }
                     release the location }
                   cg.a_label(exprasmlist,truelabel);
                   cg.a_label(exprasmlist,truelabel);
@@ -929,7 +929,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2002-08-06 20:55:21  florian
+  Revision 1.19  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.18  2002/08/06 20:55:21  florian
     * first part of ppc calling conventions fix
     * first part of ppc calling conventions fix
 
 
   Revision 1.17  2002/07/28 09:25:37  carl
   Revision 1.17  2002/07/28 09:25:37  carl

+ 16 - 7
compiler/ncgmem.pas

@@ -107,7 +107,7 @@ implementation
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location.register:=rg.getregisterint(exprasmlist);
          location.register:=rg.getregisterint(exprasmlist);
          cg.a_load_sym_ofs_reg(exprasmlist,
          cg.a_load_sym_ofs_reg(exprasmlist,
-           newasmsymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname),
+           current_library.newasmsymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname),
            0,location.register);
            0,location.register);
       end;
       end;
 
 
@@ -407,8 +407,8 @@ implementation
                   if (cs_debuginfo in aktmoduleswitches) then
                   if (cs_debuginfo in aktmoduleswitches) then
                     begin
                     begin
                       inc(withlevel);
                       inc(withlevel);
-                      getaddrlabel(withstartlabel);
-                      getaddrlabel(withendlabel);
+                      current_library.getaddrlabel(withstartlabel);
+                      current_library.getaddrlabel(withendlabel);
                       cg.a_label(exprasmlist,withstartlabel);
                       cg.a_label(exprasmlist,withstartlabel);
                       withdebugList.concat(Tai_stabs.Create(strpnew(
                       withdebugList.concat(Tai_stabs.Create(strpnew(
                          '"with'+tostr(withlevel)+':'+tostr(symtablestack.getnewtypecount)+
                          '"with'+tostr(withlevel)+':'+tostr(symtablestack.getnewtypecount)+
@@ -749,9 +749,9 @@ implementation
               if isjump then
               if isjump then
                begin
                begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
                end;
                end;
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               secondpass(right);
               secondpass(right);
@@ -775,7 +775,7 @@ implementation
                         firstpass(hightree);
                         firstpass(hightree);
                         secondpass(hightree);
                         secondpass(hightree);
                         location_release(exprasmlist,hightree.location);
                         location_release(exprasmlist,hightree.location);
-                        reference_reset_symbol(href,newasmsymbol(tarraydef(left.resulttype.def).getrangecheckstring),4);
+                        reference_reset_symbol(href,current_library.newasmsymbol(tarraydef(left.resulttype.def).getrangecheckstring),4);
                         cg.a_load_loc_ref(exprasmlist,hightree.location,href);
                         cg.a_load_loc_ref(exprasmlist,hightree.location,href);
                         hightree.free;
                         hightree.free;
                         hightree:=nil;
                         hightree:=nil;
@@ -875,7 +875,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2002-08-11 11:36:57  jonas
+  Revision 1.22  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.21  2002/08/11 11:36:57  jonas
     * always first try to use base and only then index
     * always first try to use base and only then index
 
 
   Revision 1.20  2002/08/11 06:14:40  florian
   Revision 1.20  2002/08/11 06:14:40  florian

+ 21 - 13
compiler/ncgset.pas

@@ -283,7 +283,7 @@ implementation
          if genjumps then
          if genjumps then
           begin
           begin
             { Get a label to jump to the end }
             { Get a label to jump to the end }
-            getlabel(l);
+            current_library.getlabel(l);
 
 
             { clear the register value, indicating result is FALSE }
             { clear the register value, indicating result is FALSE }
             cg.a_load_const_reg(exprasmlist,OS_INT,0,location.register);
             cg.a_load_const_reg(exprasmlist,OS_INT,0,location.register);
@@ -378,7 +378,7 @@ implementation
               end;
               end;
              { To compensate for not doing a second pass }
              { To compensate for not doing a second pass }
              right.location.reference.symbol:=nil;
              right.location.reference.symbol:=nil;
-             getlabel(l3);
+             current_library.getlabel(l3);
              cg.a_jmp_always(exprasmlist,l3);
              cg.a_jmp_always(exprasmlist,l3);
              { Now place the end label if IN success }
              { Now place the end label if IN success }
              cg.a_label(exprasmlist,l);
              cg.a_label(exprasmlist,l);
@@ -507,8 +507,8 @@ implementation
                   { this section has not been tested!    }
                   { this section has not been tested!    }
                   { can it actually occur currently? CEC }
                   { can it actually occur currently? CEC }
                   { yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
                   { yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
-                  getlabel(l);
-                  getlabel(l2);
+                  current_library.getlabel(l);
+                  current_library.getlabel(l2);
 
 
                   case left.location.loc of
                   case left.location.loc of
                      LOC_REGISTER,
                      LOC_REGISTER,
@@ -691,7 +691,7 @@ implementation
              begin
              begin
                 if opsize in [OS_S64,OS_64] then
                 if opsize in [OS_S64,OS_64] then
                   begin
                   begin
-                     getlabel(l1);
+                     objectlibrary.getlabel(l1);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, OC_NE, longint(hi(int64(t^._low))),hregister2,l1);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, OC_NE, longint(hi(int64(t^._low))),hregister2,l1);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, OC_EQ, longint(lo(int64(t^._low))),hregister, t^.statement);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, OC_EQ, longint(lo(int64(t^._low))),hregister, t^.statement);
                      cg.a_label(exprasmlist,l1);
                      cg.a_label(exprasmlist,l1);
@@ -711,7 +711,7 @@ implementation
                   begin
                   begin
                      if opsize in [OS_64,OS_S64] then
                      if opsize in [OS_64,OS_S64] then
                        begin
                        begin
-                          getlabel(l1);
+                          objectlibrary.getlabel(l1);
                           cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._low))),
                           cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._low))),
                                hregister2, elselabel);
                                hregister2, elselabel);
                           cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_gt, longint(hi(int64(t^._low))),
                           cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_gt, longint(hi(int64(t^._low))),
@@ -729,7 +729,7 @@ implementation
 
 
                 if opsize in [OS_S64,OS_64] then
                 if opsize in [OS_S64,OS_64] then
                   begin
                   begin
-                     getlabel(l1);
+                     objectlibrary.getlabel(l1);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._high))), hregister2,
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._high))), hregister2,
                            t^.statement);
                            t^.statement);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_gt, longint(hi(int64(t^._high))), hregister2,
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_gt, longint(hi(int64(t^._high))), hregister2,
@@ -802,7 +802,6 @@ implementation
            gentreejmp(p^.greater);
            gentreejmp(p^.greater);
       end;
       end;
 
 
-
       var
       var
          lv,hv,
          lv,hv,
          max_label: tconstexprint;
          max_label: tconstexprint;
@@ -813,8 +812,8 @@ implementation
          dist : cardinal;
          dist : cardinal;
          hp : tnode;
          hp : tnode;
       begin
       begin
-         getlabel(endlabel);
-         getlabel(elselabel);
+         current_library.getlabel(endlabel);
+         current_library.getlabel(elselabel);
          with_sign:=is_signed(left.resulttype.def);
          with_sign:=is_signed(left.resulttype.def);
          if with_sign then
          if with_sign then
            begin
            begin
@@ -834,9 +833,9 @@ implementation
          if left.location.loc=LOC_JUMP then
          if left.location.loc=LOC_JUMP then
           begin
           begin
             otl:=truelabel;
             otl:=truelabel;
-            getlabel(truelabel);
+            current_library.getlabel(truelabel);
             ofl:=falselabel;
             ofl:=falselabel;
-            getlabel(falselabel);
+            current_library.getlabel(falselabel);
             isjump:=true;
             isjump:=true;
           end;
           end;
          secondpass(left);
          secondpass(left);
@@ -957,7 +956,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2002-08-11 11:37:42  jonas
+  Revision 1.15  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.14  2002/08/11 11:37:42  jonas
     * genlinear(cmp)list can now be overridden by descendents
     * genlinear(cmp)list can now be overridden by descendents
 
 
   Revision 1.13  2002/08/11 06:14:40  florian
   Revision 1.13  2002/08/11 06:14:40  florian

+ 40 - 27
compiler/ncgutil.pas

@@ -64,17 +64,17 @@ interface
    procedure genexitcode(list : TAAsmoutput;parasize:longint;nostackframe,inlined:boolean);
    procedure genexitcode(list : TAAsmoutput;parasize:longint;nostackframe,inlined:boolean);
    procedure genimplicitunitinit(list : TAAsmoutput);
    procedure genimplicitunitinit(list : TAAsmoutput);
    procedure genimplicitunitfinal(list : TAAsmoutput);
    procedure genimplicitunitfinal(list : TAAsmoutput);
-   
+
           {#
           {#
               Allocate the buffers for exception management and setjmp environment.
               Allocate the buffers for exception management and setjmp environment.
               Return a pointer to these buffers, send them to the utility routine
               Return a pointer to these buffers, send them to the utility routine
               so they are registered, and then call setjmp.
               so they are registered, and then call setjmp.
-  
+
               Then compare the result of setjmp with 0, and if not equal
               Then compare the result of setjmp with 0, and if not equal
               to zero, then jump to exceptlabel.
               to zero, then jump to exceptlabel.
-       
+
               Also store the result of setjmp to a temporary space by calling g_save_exception_reason
               Also store the result of setjmp to a temporary space by calling g_save_exception_reason
-              
+
               It is to note that this routine may be called *after* the stackframe of a
               It is to note that this routine may be called *after* the stackframe of a
               routine has been called, therefore on machines where the stack cannot
               routine has been called, therefore on machines where the stack cannot
               be modified, all temps should be allocated on the heap instead of the
               be modified, all temps should be allocated on the heap instead of the
@@ -84,7 +84,7 @@ interface
               a : aword; exceptlabel : tasmlabel);
               a : aword; exceptlabel : tasmlabel);
           procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
           procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
            a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
            a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
-   
+
 
 
 
 
 implementation
 implementation
@@ -243,17 +243,17 @@ implementation
 
 
        cg.a_param_reg(list,OS_ADDR,accumulator,paramanager.getintparaloc(1));
        cg.a_param_reg(list,OS_ADDR,accumulator,paramanager.getintparaloc(1));
        cg.a_call_name(list,'FPC_SETJMP');
        cg.a_call_name(list,'FPC_SETJMP');
-         
+
        cg.g_exception_reason_save(list, href);
        cg.g_exception_reason_save(list, href);
        cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,accumulator,exceptlabel);
        cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,accumulator,exceptlabel);
      end;
      end;
-     
-     
+
+
     procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
     procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      begin
      begin
          cg.a_call_name(list,'FPC_POPADDRSTACK');
          cg.a_call_name(list,'FPC_POPADDRSTACK');
-         
+
          if not onlyfree then
          if not onlyfree then
           begin
           begin
             cg.g_exception_reason_load(list, href);
             cg.g_exception_reason_load(list, href);
@@ -295,7 +295,7 @@ implementation
                   begin
                   begin
                     cg.a_label(list,truelabel);
                     cg.a_label(list,truelabel);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
-                    getlabel(hl);
+                    current_library.getlabel(hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_label(list,falselabel);
                     cg.a_label(list,falselabel);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
@@ -383,7 +383,7 @@ implementation
                begin
                begin
                  cg.a_label(list,truelabel);
                  cg.a_label(list,truelabel);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
-                 getlabel(hl);
+                 current_library.getlabel(hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_label(list,falselabel);
                  cg.a_label(list,falselabel);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
@@ -437,7 +437,7 @@ implementation
                   begin
                   begin
                     cg.a_label(list,truelabel);
                     cg.a_label(list,truelabel);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
-                    getlabel(hl);
+                    current_library.getlabel(hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_label(list,falselabel);
                     cg.a_label(list,falselabel);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
@@ -475,7 +475,7 @@ implementation
                begin
                begin
                  cg.a_label(list,truelabel);
                  cg.a_label(list,truelabel);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
-                 getlabel(hl);
+                 current_library.getlabel(hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_label(list,falselabel);
                  cg.a_label(list,falselabel);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
@@ -869,7 +869,7 @@ implementation
            (vo_is_thread_var in tvarsym(p).varoptions) then
            (vo_is_thread_var in tvarsym(p).varoptions) then
          begin
          begin
            cg.a_param_const(list,OS_INT,tvarsym(p).getsize,paramanager.getintparaloc(2));
            cg.a_param_const(list,OS_INT,tvarsym(p).getsize,paramanager.getintparaloc(2));
-           reference_reset_symbol(href,newasmsymbol(tvarsym(p).mangledname),0);
+           reference_reset_symbol(href,current_library.newasmsymbol(tvarsym(p).mangledname),0);
            cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(1));
            cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(1));
            rg.saveregvars(list,all_registers);
            rg.saveregvars(list,all_registers);
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
@@ -894,7 +894,7 @@ implementation
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
            else
            else
-            reference_reset_symbol(href,newasmsymbol(tvarsym(p).mangledname),0);
+            reference_reset_symbol(href,current_library.newasmsymbol(tvarsym(p).mangledname),0);
            cg.g_initialize(list,tvarsym(p).vartype.def,href,false);
            cg.g_initialize(list,tvarsym(p).vartype.def,href,false);
          end;
          end;
       end;
       end;
@@ -915,7 +915,7 @@ implementation
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
            else
            else
-            reference_reset_symbol(href,newasmsymbol(tvarsym(p).mangledname),0);
+            reference_reset_symbol(href,current_library.newasmsymbol(tvarsym(p).mangledname),0);
            cg.g_finalize(list,tvarsym(p).vartype.def,href,false);
            cg.g_finalize(list,tvarsym(p).vartype.def,href,false);
          end;
          end;
       end;
       end;
@@ -1139,12 +1139,12 @@ implementation
         stackalloclist : taasmoutput;
         stackalloclist : taasmoutput;
       begin
       begin
         stackalloclist:=taasmoutput.Create;
         stackalloclist:=taasmoutput.Create;
-        
+
         { the actual stack allocation code, symbol entry point and
         { the actual stack allocation code, symbol entry point and
           gdb stabs information is generated AFTER the rest of this
           gdb stabs information is generated AFTER the rest of this
           code, since temp. allocation might occur before - carl
           code, since temp. allocation might occur before - carl
-        }  
-        
+        }
+
         if (cs_profile in aktmoduleswitches) and
         if (cs_profile in aktmoduleswitches) and
               not(po_assembler in aktprocdef.procoptions) and not(inlined) then
               not(po_assembler in aktprocdef.procoptions) and not(inlined) then
             cg.g_profilecode(list);
             cg.g_profilecode(list);
@@ -1265,7 +1265,7 @@ implementation
 
 
         if inlined then
         if inlined then
          load_regvars(list,nil);
          load_regvars(list,nil);
-         
+
         {************************* Stack allocation **************************}
         {************************* Stack allocation **************************}
         { and symbol entry point as well as debug information                 }
         { and symbol entry point as well as debug information                 }
         { will be inserted in front of the rest of this list.                 }
         { will be inserted in front of the rest of this list.                 }
@@ -1308,7 +1308,7 @@ implementation
              else
              else
               stackalloclist.concat(Tai_symbol.Createname(hs,0));
               stackalloclist.concat(Tai_symbol.Createname(hs,0));
            until false;
            until false;
-        
+
         stackframe:=stackframe+tg.gettempsize;
         stackframe:=stackframe+tg.gettempsize;
 {$ifndef powerpc}
 {$ifndef powerpc}
            { at least for the ppc this applies always, so this code isn't usable (FK) }
            { at least for the ppc this applies always, so this code isn't usable (FK) }
@@ -1413,7 +1413,7 @@ implementation
           begin
           begin
              { the exception helper routines modify all registers }
              { the exception helper routines modify all registers }
              aktprocdef.usedregisters:=all_registers;
              aktprocdef.usedregisters:=all_registers;
-             getlabel(noreraiselabel);
+             current_library.getlabel(noreraiselabel);
              free_exception(list,
              free_exception(list,
                   procinfo^.exception_jmp_ref,
                   procinfo^.exception_jmp_ref,
                   procinfo^.exception_env_ref,
                   procinfo^.exception_env_ref,
@@ -1427,7 +1427,7 @@ implementation
                        pd:=procinfo^._class.searchdestructor;
                        pd:=procinfo^._class.searchdestructor;
                        if assigned(pd) then
                        if assigned(pd) then
                          begin
                          begin
-                            getlabel(nodestroycall);
+                            current_library.getlabel(nodestroycall);
                             reference_reset_base(href,procinfo^.framepointer,procinfo^.selfpointer_offset);
                             reference_reset_base(href,procinfo^.framepointer,procinfo^.selfpointer_offset);
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             if is_class(procinfo^._class) then
                             if is_class(procinfo^._class) then
@@ -1438,7 +1438,7 @@ implementation
                             else if is_object(procinfo^._class) then
                             else if is_object(procinfo^._class) then
                              begin
                              begin
                                cg.a_param_reg(list,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
                                cg.a_param_reg(list,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
-                               reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
+                               reference_reset_symbol(href,current_library.newasmsymbol(procinfo^._class.vmt_mangledname),0);
                                cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(1));
                                cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(1));
                              end
                              end
                             else
                             else
@@ -1500,7 +1500,7 @@ implementation
                 { successful constructor deletes the zero flag }
                 { successful constructor deletes the zero flag }
                 { and returns self in eax                   }
                 { and returns self in eax                   }
                 { eax must be set to zero if the allocation failed !!! }
                 { eax must be set to zero if the allocation failed !!! }
-                getlabel(okexitlabel);
+                current_library.getlabel(okexitlabel);
                 cg.a_jmp_always(list,okexitlabel);
                 cg.a_jmp_always(list,okexitlabel);
                 cg.a_label(list,faillabel);
                 cg.a_label(list,faillabel);
                 cg.g_call_fail_helper(list);
                 cg.g_call_fail_helper(list);
@@ -1529,7 +1529,7 @@ implementation
 {$ifdef GDB}
 {$ifdef GDB}
         if ((cs_debuginfo in aktmoduleswitches) and not inlined) then
         if ((cs_debuginfo in aktmoduleswitches) and not inlined) then
           begin
           begin
-            getlabel(stabsendlabel);
+            current_library.getlabel(stabsendlabel);
             cg.a_label(list,stabsendlabel);
             cg.a_label(list,stabsendlabel);
           end;
           end;
 {$endif GDB}
 {$endif GDB}
@@ -1598,9 +1598,13 @@ implementation
                     st:='*'
                     st:='*'
                   else
                   else
                     st:='';
                     st:='';
+{$ifdef i386}
                   list.concat(Tai_stabs.Create(strpnew(
                   list.concat(Tai_stabs.Create(strpnew(
                    '"$t:r'+st+procinfo^._class.numberstring+'",'+
                    '"$t:r'+st+procinfo^._class.numberstring+'",'+
                    tostr(N_RSYM)+',0,0,'+tostr(GDB_i386index[SELF_POINTER_REG]))));
                    tostr(N_RSYM)+',0,0,'+tostr(GDB_i386index[SELF_POINTER_REG]))));
+{$else}
+{$warning Missing stabs for classes!}
+{$endif}
                 end;
                 end;
 
 
             { define calling EBP as pseudo local var PM }
             { define calling EBP as pseudo local var PM }
@@ -1701,7 +1705,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2002-08-09 19:16:57  carl
+  Revision 1.32  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.31  2002/08/09 19:16:57  carl
     * stack allocation is now done separately (at the end) of genentrycode
     * stack allocation is now done separately (at the end) of genentrycode
       so temps. can be allocated before.
       so temps. can be allocated before.
     * fix generic exception handling
     * fix generic exception handling

+ 20 - 11
compiler/nobj.pas

@@ -273,7 +273,7 @@ implementation
     procedure tclassheader.writenames(p : pprocdeftree);
     procedure tclassheader.writenames(p : pprocdeftree);
 
 
       begin
       begin
-         getdatalabel(p^.nl);
+         current_library.getdatalabel(p^.nl);
          if assigned(p^.l) then
          if assigned(p^.l) then
            writenames(p^.l);
            writenames(p^.l);
          dataSegment.concat(Tai_label.Create(p^.nl));
          dataSegment.concat(Tai_label.Create(p^.nl));
@@ -312,7 +312,7 @@ implementation
            writenames(root);
            writenames(root);
 
 
          { now start writing of the message string table }
          { now start writing of the message string table }
-         getdatalabel(r);
+         current_library.getdatalabel(r);
          dataSegment.concat(Tai_label.Create(r));
          dataSegment.concat(Tai_label.Create(r));
          genstrmsgtab:=r;
          genstrmsgtab:=r;
          dataSegment.concat(Tai_const.Create_32bit(count));
          dataSegment.concat(Tai_const.Create_32bit(count));
@@ -348,7 +348,7 @@ implementation
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgint,nil);
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgint,nil);
 
 
          { now start writing of the message string table }
          { now start writing of the message string table }
-         getdatalabel(r);
+         current_library.getdatalabel(r);
          dataSegment.concat(Tai_label.Create(r));
          dataSegment.concat(Tai_label.Create(r));
          genintmsgtab:=r;
          genintmsgtab:=r;
          dataSegment.concat(Tai_const.Create_32bit(count));
          dataSegment.concat(Tai_const.Create_32bit(count));
@@ -424,7 +424,7 @@ implementation
 
 
          if count>0 then
          if count>0 then
            begin
            begin
-              getdatalabel(r);
+              current_library.getdatalabel(r);
               gendmt:=r;
               gendmt:=r;
               dataSegment.concat(Tai_label.Create(r));
               dataSegment.concat(Tai_label.Create(r));
               { entries for caching }
               { entries for caching }
@@ -466,7 +466,7 @@ implementation
               if assigned(tprocsym(p).defs^.next) then
               if assigned(tprocsym(p).defs^.next) then
                 internalerror(1209992);
                 internalerror(1209992);
               hp:=tprocsym(p).defs^.def;
               hp:=tprocsym(p).defs^.def;
-              getdatalabel(l);
+              current_library.getdatalabel(l);
 
 
               Consts.concat(Tai_label.Create(l));
               Consts.concat(Tai_label.Create(l));
               Consts.concat(Tai_const.Create_8bit(length(p.name)));
               Consts.concat(Tai_const.Create_8bit(length(p.name)));
@@ -487,7 +487,7 @@ implementation
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}do_count,nil);
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}do_count,nil);
          if count>0 then
          if count>0 then
            begin
            begin
-              getdatalabel(l);
+              current_library.getdatalabel(l);
               dataSegment.concat(Tai_label.Create(l));
               dataSegment.concat(Tai_label.Create(l));
               dataSegment.concat(Tai_const.Create_32bit(count));
               dataSegment.concat(Tai_const.Create_32bit(count));
               _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}genpubmethodtableentry,nil);
               _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}genpubmethodtableentry,nil);
@@ -820,7 +820,7 @@ implementation
         if curintf.objecttype in [odt_interfacecom] then
         if curintf.objecttype in [odt_interfacecom] then
           begin
           begin
             { label for GUID }
             { label for GUID }
-            getdatalabel(tmplabel);
+            current_library.getdatalabel(tmplabel);
             rawdata.concat(Tai_label.Create(tmplabel));
             rawdata.concat(Tai_label.Create(tmplabel));
             rawdata.concat(Tai_const.Create_32bit(curintf.iidguid.D1));
             rawdata.concat(Tai_const.Create_32bit(curintf.iidguid.D1));
             rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D2));
             rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D2));
@@ -839,7 +839,7 @@ implementation
         { IOffset field }
         { IOffset field }
         dataSegment.concat(Tai_const.Create_32bit(implintf.ioffsets(contintfindex)^));
         dataSegment.concat(Tai_const.Create_32bit(implintf.ioffsets(contintfindex)^));
         { IIDStr }
         { IIDStr }
-        getdatalabel(tmplabel);
+        current_library.getdatalabel(tmplabel);
         rawdata.concat(Tai_label.Create(tmplabel));
         rawdata.concat(Tai_label.Create(tmplabel));
         rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
         rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
         if curintf.objecttype=odt_interfacecom then
         if curintf.objecttype=odt_interfacecom then
@@ -1064,7 +1064,7 @@ implementation
           end;
           end;
         { 2. step calc required fieldcount and their offsets in the object memory map
         { 2. step calc required fieldcount and their offsets in the object memory map
              and write data }
              and write data }
-        getdatalabel(intftable);
+        current_library.getdatalabel(intftable);
         dataSegment.concat(Tai_label.Create(intftable));
         dataSegment.concat(Tai_label.Create(intftable));
         gintfwritedata;
         gintfwritedata;
         _class.implementedinterfaces.clearimplprocs; { release temporary information }
         _class.implementedinterfaces.clearimplprocs; { release temporary information }
@@ -1177,7 +1177,7 @@ implementation
             methodnametable:=genpublishedmethodstable;
             methodnametable:=genpublishedmethodstable;
             fieldtablelabel:=_class.generate_field_table;
             fieldtablelabel:=_class.generate_field_table;
             { write class name }
             { write class name }
-            getdatalabel(classnamelabel);
+            current_library.getdatalabel(classnamelabel);
             dataSegment.concat(Tai_label.Create(classnamelabel));
             dataSegment.concat(Tai_label.Create(classnamelabel));
             dataSegment.concat(Tai_const.Create_8bit(length(_class.objrealname^)));
             dataSegment.concat(Tai_const.Create_8bit(length(_class.objrealname^)));
             dataSegment.concat(Tai_string.Create(_class.objrealname^));
             dataSegment.concat(Tai_string.Create(_class.objrealname^));
@@ -1293,7 +1293,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2002-08-09 07:33:01  florian
+  Revision 1.24  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.23  2002/08/09 07:33:01  florian
     * a couple of interface related fixes
     * a couple of interface related fixes
 
 
   Revision 1.22  2002/07/20 11:57:55  florian
   Revision 1.22  2002/07/20 11:57:55  florian

+ 17 - 15
compiler/parser.pas

@@ -71,6 +71,7 @@ implementation
          aktprocsym:=nil;
          aktprocsym:=nil;
          aktprocdef:=nil;
          aktprocdef:=nil;
 
 
+         current_library:=nil;
          current_module:=nil;
          current_module:=nil;
          compiled_module:=nil;
          compiled_module:=nil;
          procinfo:=nil;
          procinfo:=nil;
@@ -247,7 +248,6 @@ implementation
          oldaktprocdef    : tprocdef;
          oldaktprocdef    : tprocdef;
          oldoverloaded_operators : toverloaded_operators;
          oldoverloaded_operators : toverloaded_operators;
        { cg }
        { cg }
-         oldnextlabelnr : longint;
          oldparse_only  : boolean;
          oldparse_only  : boolean;
        { asmlists }
        { asmlists }
          oldimports,
          oldimports,
@@ -262,7 +262,7 @@ implementation
          olddebuglist,
          olddebuglist,
          oldwithdebuglist,
          oldwithdebuglist,
          oldconsts     : taasmoutput;
          oldconsts     : taasmoutput;
-         oldasmsymbollist : tdictionary;
+         oldcurrent_library : tasmlibrarydata;
        { resourcestrings }
        { resourcestrings }
          OldResourceStrings : tResourceStrings;
          OldResourceStrings : tResourceStrings;
        { akt.. things }
        { akt.. things }
@@ -317,7 +317,6 @@ implementation
          oldcurrent_scanner:=current_scanner;
          oldcurrent_scanner:=current_scanner;
          oldsourcecodepage:=aktsourcecodepage;
          oldsourcecodepage:=aktsourcecodepage;
        { save cg }
        { save cg }
-         oldnextlabelnr:=nextlabelnr;
          oldparse_only:=parse_only;
          oldparse_only:=parse_only;
        { save assembler lists }
        { save assembler lists }
          olddatasegment:=datasegment;
          olddatasegment:=datasegment;
@@ -332,7 +331,7 @@ implementation
          oldexports:=exportssection;
          oldexports:=exportssection;
          oldresource:=resourcesection;
          oldresource:=resourcesection;
          oldresourcestringlist:=resourcestringlist;
          oldresourcestringlist:=resourcestringlist;
-         oldasmsymbollist:=asmsymbollist;
+         oldcurrent_library:=current_library;
          OldResourceStrings:=ResourceStrings;
          OldResourceStrings:=ResourceStrings;
        { save akt... state }
        { save akt... state }
        { handle the postponed case first }
        { handle the postponed case first }
@@ -467,10 +466,6 @@ implementation
          it's the default to release the trees }
          it's the default to release the trees }
          codegen_donemodule;
          codegen_donemodule;
 
 
-{$ifdef newcg}
-         dispose(cg,done);
-{$endif newcg}
-
        { free ppu }
        { free ppu }
          if assigned(tppumodule(current_module).ppufile) then
          if assigned(tppumodule(current_module).ppufile) then
           begin
           begin
@@ -487,9 +482,6 @@ implementation
 
 
          if (compile_level>1) then
          if (compile_level>1) then
            begin
            begin
-{$ifdef newcg}
-              cg:=oldcg;
-{$endif newcg}
 {$ifdef GDB}
 {$ifdef GDB}
               dbx_counter:=store_dbx;
               dbx_counter:=store_dbx;
 {$endif GDB}
 {$endif GDB}
@@ -502,9 +494,9 @@ implementation
               akttokenpos:=oldtokenpos;
               akttokenpos:=oldtokenpos;
               block_type:=old_block_type;
               block_type:=old_block_type;
               current_scanner:=oldcurrent_scanner;
               current_scanner:=oldcurrent_scanner;
-              parser_current_file:=current_scanner.inputfile.name^;
+              if not current_scanner.invalid then
+                parser_current_file:=current_scanner.inputfile.name^;
               { restore cg }
               { restore cg }
-              nextlabelnr:=oldnextlabelnr;
               parse_only:=oldparse_only;
               parse_only:=oldparse_only;
               { restore asmlists }
               { restore asmlists }
               exprasmlist:=oldexprasmlist;
               exprasmlist:=oldexprasmlist;
@@ -519,8 +511,9 @@ implementation
               resourcesection:=oldresource;
               resourcesection:=oldresource;
               rttilist:=oldrttilist;
               rttilist:=oldrttilist;
               resourcestringlist:=oldresourcestringlist;
               resourcestringlist:=oldresourcestringlist;
-              asmsymbollist:=oldasmsymbollist;
+              { object data }
               ResourceStrings:=OldResourceStrings;
               ResourceStrings:=OldResourceStrings;
+              current_library:=oldcurrent_library;
               { restore symtable state }
               { restore symtable state }
               refsymtable:=oldrefsymtable;
               refsymtable:=oldrefsymtable;
               symtablestack:=oldsymtablestack;
               symtablestack:=oldsymtablestack;
@@ -618,7 +611,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.36  2002-08-09 19:15:41  carl
+  Revision 1.37  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.36  2002/08/09 19:15:41  carl
      - removed newcg define
      - removed newcg define
 
 
   Revision 1.35  2002/07/20 17:16:03  florian
   Revision 1.35  2002/07/20 17:16:03  florian

+ 12 - 3
compiler/pdecl.pas

@@ -250,12 +250,12 @@ implementation
              begin
              begin
                 if (cs_create_smart in aktmoduleswitches) then
                 if (cs_create_smart in aktmoduleswitches) then
                   begin
                   begin
-                    getdatalabel(hl);
+                    current_library.getdatalabel(hl);
                     { we still want a warning if unused }
                     { we still want a warning if unused }
                     hl.refs:=0;
                     hl.refs:=0;
                   end
                   end
                 else
                 else
-                  getlabel(hl);
+                  current_library.getlabel(hl);
                 if token=_ID then
                 if token=_ID then
                  symtablestack.insert(tlabelsym.create(orgpattern,hl))
                  symtablestack.insert(tlabelsym.create(orgpattern,hl))
                 else
                 else
@@ -613,7 +613,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.49  2002-07-29 21:23:43  florian
+  Revision 1.50  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.49  2002/07/29 21:23:43  florian
     * more fixes for the ppc
     * more fixes for the ppc
     + wrappers for the tcnvnode.first_* stuff introduced
     + wrappers for the tcnvnode.first_* stuff introduced
 
 

+ 11 - 2
compiler/pdecsub.pas

@@ -1840,7 +1840,7 @@ const
                    if aprocdef.has_mangledname then
                    if aprocdef.has_mangledname then
                     begin
                     begin
                       { rename also asmsymbol first, because the name can already be used }
                       { rename also asmsymbol first, because the name can already be used }
-                      renameasmsymbol(hd.mangledname,aprocdef.mangledname);
+                      current_library.renameasmsymbol(hd.mangledname,aprocdef.mangledname);
                       { update the mangledname }
                       { update the mangledname }
                       hd.has_mangledname:=true;
                       hd.has_mangledname:=true;
                       hd.setmangledname(aprocdef.mangledname);
                       hd.setmangledname(aprocdef.mangledname);
@@ -1957,7 +1957,16 @@ const
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.61  2002-07-26 21:15:40  florian
+  Revision 1.62  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.61  2002/07/26 21:15:40  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.60  2002/07/20 11:57:55  florian
   Revision 1.60  2002/07/20 11:57:55  florian

+ 11 - 2
compiler/pmodules.pas

@@ -696,7 +696,7 @@ implementation
            (vo_is_thread_var in tvarsym(p).varoptions) then
            (vo_is_thread_var in tvarsym(p).varoptions) then
          begin
          begin
            { address of threadvar }
            { address of threadvar }
-           ltvTable.concat(tai_const_symbol.create(newasmsymbol(tvarsym(p).mangledname)));
+           ltvTable.concat(tai_const_symbol.createname(tvarsym(p).mangledname));
            { size of threadvar }
            { size of threadvar }
            ltvTable.concat(tai_const.create_32bit(tvarsym(p).getsize));
            ltvTable.concat(tai_const.create_32bit(tvarsym(p).getsize));
          end;
          end;
@@ -1388,7 +1388,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.70  2002-08-10 14:46:29  carl
+  Revision 1.71  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.70  2002/08/10 14:46:29  carl
     + moved target_cpu_string to cpuinfo
     + moved target_cpu_string to cpuinfo
     * renamed asmmode enum.
     * renamed asmmode enum.
     * assembler reader has now less ifdef's
     * assembler reader has now less ifdef's

+ 23 - 14
compiler/powerpc/cgcpu.pas

@@ -252,7 +252,7 @@ const
          { calls or cross TOC calls, but currently done always                      }
          { calls or cross TOC calls, but currently done always                      }
          reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
          reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
          list.concat(taicpu.op_reg_ref(A_STW,R_TOC,href));
          list.concat(taicpu.op_reg_ref(A_STW,R_TOC,href));
-         list.concat(taicpu.op_sym(A_BL,newasmsymbol(s)));
+         list.concat(taicpu.op_sym(A_BL,current_library.newasmsymbol(s)));
          reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
          reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
          list.concat(taicpu.op_reg_ref(A_LWZ,R_TOC,href));
          list.concat(taicpu.op_reg_ref(A_LWZ,R_TOC,href));
          procinfo^.flags:=procinfo^.flags or pi_do_call;
          procinfo^.flags:=procinfo^.flags or pi_do_call;
@@ -942,11 +942,11 @@ const
              { save floating-point registers }
              { save floating-point registers }
              if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then
              if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then
                begin
                begin
-                  list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g'),0));
+                  list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g'),0));
                   gotgot:=true;
                   gotgot:=true;
                end
                end
              else
              else
-               list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)),0));
+               list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)),0));
              { compute end of gpr save area }
              { compute end of gpr save area }
              list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,-(ord(R_F31)-ord(firstregfpu)+1)*8));
              list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,-(ord(R_F31)-ord(firstregfpu)+1)*8));
           end;
           end;
@@ -957,11 +957,11 @@ const
              {
              {
              if cs_create_pic in aktmoduleswitches then
              if cs_create_pic in aktmoduleswitches then
                begin
                begin
-                  list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g'),0));
+                  list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g'),0));
                   gotgot:=true;
                   gotgot:=true;
                end
                end
              else
              else
-               list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)),0))
+               list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)),0))
              }
              }
              reference_reset_base(href,R_11,-(ord(R_31)-ord(firstreggpr)+1)*4);
              reference_reset_base(href,R_11,-(ord(R_31)-ord(firstreggpr)+1)*4);
              list.concat(taicpu.op_reg_ref(A_STMW,firstreggpr,href));
              list.concat(taicpu.op_reg_ref(A_STMW,firstreggpr,href));
@@ -1036,7 +1036,7 @@ const
              { restore gprs }
              { restore gprs }
              { at least for now we use LMW }
              { at least for now we use LMW }
              {
              {
-             list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_restgpr_14'),0));
+             list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_restgpr_14'),0));
              }
              }
              reference_reset_base(href,R_11,-(ord(R_31)-ord(firstreggpr)+1)*4);
              reference_reset_base(href,R_11,-(ord(R_31)-ord(firstreggpr)+1)*4);
              list.concat(taicpu.op_reg_ref(A_LMW,firstreggpr,href));
              list.concat(taicpu.op_reg_ref(A_LMW,firstreggpr,href));
@@ -1048,11 +1048,11 @@ const
              { address of fpr save area to r11 }
              { address of fpr save area to r11 }
              list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,(ord(R_F31)-ord(firstregfpu)+1)*8));
              list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,(ord(R_F31)-ord(firstregfpu)+1)*8));
              if (procinfo^.flags and pi_do_call)<>0 then
              if (procinfo^.flags and pi_do_call)<>0 then
-               list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
+               list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
                  '_x'),0))
                  '_x'),0))
              else
              else
                { leaf node => lr haven't to be restored }
                { leaf node => lr haven't to be restored }
-               list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
+               list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
                  '_l'),0));
                  '_l'),0));
              genret:=false;
              genret:=false;
           end;
           end;
@@ -1100,7 +1100,7 @@ const
         a_reg_dealloc(list,R_0);
         a_reg_dealloc(list,R_0);
         { save floating-point registers }
         { save floating-point registers }
         { !!! has to be optimized: only save registers that are used }
         { !!! has to be optimized: only save registers that are used }
-        list.concat(taicpu.op_sym_ofs(A_BL,newasmsymbol('_savef14'),0));
+        list.concat(taicpu.op_sym_ofs(A_BL,current_library.newasmsymbol('_savef14'),0));
         { save gprs in gpr save area }
         { save gprs in gpr save area }
         { !!! has to be optimized: only save registers that are used }
         { !!! has to be optimized: only save registers that are used }
         reference_reset_base(href,STACK_POINTER_REG,-220);
         reference_reset_base(href,STACK_POINTER_REG,-220);
@@ -1294,7 +1294,7 @@ const
             { explicitely allocate R_0 since it can be used safely here }
             { explicitely allocate R_0 since it can be used safely here }
             { (for holding date that's being copied)                    }
             { (for holding date that's being copied)                    }
             a_reg_alloc(list,R_F0);
             a_reg_alloc(list,R_F0);
-            getlabel(lab);
+            current_library.getlabel(lab);
             a_label(list, lab);
             a_label(list, lab);
             list.concat(taicpu.op_reg_reg_const(A_SUBIC_,countreg,countreg,1));
             list.concat(taicpu.op_reg_reg_const(A_SUBIC_,countreg,countreg,1));
             list.concat(taicpu.op_reg_ref(A_LFDU,R_F0,src));
             list.concat(taicpu.op_reg_ref(A_LFDU,R_F0,src));
@@ -1366,7 +1366,7 @@ const
       begin
       begin
          if not(cs_check_overflow in aktlocalswitches) then
          if not(cs_check_overflow in aktlocalswitches) then
           exit;
           exit;
-         getlabel(hl);
+         current_library.getlabel(hl);
          if not ((p.resulttype.def.deftype=pointerdef) or
          if not ((p.resulttype.def.deftype=pointerdef) or
                 ((p.resulttype.def.deftype=orddef) and
                 ((p.resulttype.def.deftype=orddef) and
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
@@ -1405,7 +1405,7 @@ const
         reference_reset_base(href,STACK_POINTER_REG,8);
         reference_reset_base(href,STACK_POINTER_REG,8);
         list.concat(taicpu.op_reg_ref(A_LWZ,R_0,href));
         list.concat(taicpu.op_reg_ref(A_LWZ,R_0,href));
         { ... and return from _restf14 }
         { ... and return from _restf14 }
-        list.concat(taicpu.op_sym_ofs(A_B,newasmsymbol('_restf14'),0));
+        list.concat(taicpu.op_sym_ofs(A_B,current_library.newasmsymbol('_restf14'),0));
       end;
       end;
 
 
 
 
@@ -1561,7 +1561,7 @@ const
         p: taicpu;
         p: taicpu;
 
 
       begin
       begin
-        p := taicpu.op_sym(op,newasmsymbol(l.name));
+        p := taicpu.op_sym(op,current_library.newasmsymbol(l.name));
         if op <> A_B then
         if op <> A_B then
           create_cond_norm(c,crval,p.condition);
           create_cond_norm(c,crval,p.condition);
         p.is_jmp := true;
         p.is_jmp := true;
@@ -1674,7 +1674,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.38  2002-08-11 11:39:31  jonas
+  Revision 1.39  2002-08-11 13:24:18  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.38  2002/08/11 11:39:31  jonas
     + powerpc-specific genlinearlist
     + powerpc-specific genlinearlist
 
 
   Revision 1.37  2002/08/10 17:15:31  jonas
   Revision 1.37  2002/08/10 17:15:31  jonas

+ 16 - 7
compiler/powerpc/nppcadd.pas

@@ -293,9 +293,9 @@ interface
             if isjump then
             if isjump then
               begin
               begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
               end;
             secondpass(left);
             secondpass(left);
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
@@ -311,9 +311,9 @@ interface
             if isjump then
             if isjump then
               begin
               begin
                  otl:=truelabel;
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
               end;
             secondpass(right);
             secondpass(right);
             maybe_restore(exprasmlist,left.location,pushedregs);
             maybe_restore(exprasmlist,left.location,pushedregs);
@@ -388,7 +388,7 @@ interface
                    andn :
                    andn :
                      begin
                      begin
                         otl:=truelabel;
                         otl:=truelabel;
-                        getlabel(truelabel);
+                        current_library.getlabel(truelabel);
                         secondpass(left);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,truelabel);
                         cg.a_label(exprasmlist,truelabel);
@@ -397,7 +397,7 @@ interface
                    orn :
                    orn :
                      begin
                      begin
                         ofl:=falselabel;
                         ofl:=falselabel;
-                        getlabel(falselabel);
+                        current_library.getlabel(falselabel);
                         secondpass(left);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,falselabel);
                         cg.a_label(exprasmlist,falselabel);
@@ -1302,7 +1302,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2002-08-11 11:40:16  jonas
+  Revision 1.10  2002-08-11 13:24:18  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.9  2002/08/11 11:40:16  jonas
     * some overflow checking fixes
     * some overflow checking fixes
 
 
   Revision 1.8  2002/08/11 06:14:40  florian
   Revision 1.8  2002/08/11 06:14:40  florian

+ 12 - 2
compiler/ppu.pas

@@ -77,6 +77,8 @@ const
   ibendsymtablebrowser   = 14;
   ibendsymtablebrowser   = 14;
   ibbeginsymtablebrowser = 15;
   ibbeginsymtablebrowser = 15;
   ibusedmacros           = 16;
   ibusedmacros           = 16;
+  {implementation/objectdata}
+  ibasmsymbols    = 100;
   {syms}
   {syms}
   ibtypesym       = 20;
   ibtypesym       = 20;
   ibprocsym       = 21;
   ibprocsym       = 21;
@@ -111,7 +113,6 @@ const
   ibansistringdef  = 55;
   ibansistringdef  = 55;
   ibwidestringdef  = 56;
   ibwidestringdef  = 56;
   ibvariantdef     = 57;
   ibvariantdef     = 57;
-
 { unit flags }
 { unit flags }
   uf_init          = $1;
   uf_init          = $1;
   uf_finalize      = $2;
   uf_finalize      = $2;
@@ -981,7 +982,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2002-08-09 07:33:02  florian
+  Revision 1.22  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.21  2002/08/09 07:33:02  florian
     * a couple of interface related fixes
     * a couple of interface related fixes
 
 
   Revision 1.20  2002/05/18 13:34:13  peter
   Revision 1.20  2002/05/18 13:34:13  peter

+ 16 - 7
compiler/pstatmnt.pas

@@ -63,7 +63,7 @@ implementation
   {$ifndef NoRa386Att}
   {$ifndef NoRa386Att}
        ,ra386att
        ,ra386att
   {$endif NoRa386Att}
   {$endif NoRa386Att}
-{$else}  
+{$else}
        ,rasm
        ,rasm
 {$endif i386}
 {$endif i386}
        ;
        ;
@@ -170,7 +170,7 @@ implementation
            hcaselabel^.greater:=nil;
            hcaselabel^.greater:=nil;
            hcaselabel^.statement:=aktcaselabel;
            hcaselabel^.statement:=aktcaselabel;
            hcaselabel^.firstlabel:=first;
            hcaselabel^.firstlabel:=first;
-           getlabel(hcaselabel^._at);
+           current_library.getlabel(hcaselabel^._at);
            hcaselabel^._low:=l;
            hcaselabel^._low:=l;
            hcaselabel^._high:=h;
            hcaselabel^._high:=h;
            insertlabel(root);
            insertlabel(root);
@@ -205,7 +205,7 @@ implementation
          root:=nil;
          root:=nil;
          instruc:=nil;
          instruc:=nil;
          repeat
          repeat
-           getlabel(aktcaselabel);
+           current_library.getlabel(aktcaselabel);
            firstlabel:=true;
            firstlabel:=true;
 
 
            { maybe an instruction has more case labels }
            { maybe an instruction has more case labels }
@@ -725,7 +725,7 @@ implementation
            asmmode_i386_intel:
            asmmode_i386_intel:
              asmstat:=tasmnode(ra386int.assemble);
              asmstat:=tasmnode(ra386int.assemble);
   {$endif NoRA386Int}
   {$endif NoRA386Int}
-{$else}  
+{$else}
            asmmode_direct:
            asmmode_direct:
              begin
              begin
                if not target_asm.allowdirect then
                if not target_asm.allowdirect then
@@ -741,8 +741,8 @@ implementation
 
 
            asmmode_standard:
            asmmode_standard:
              asmstat:=tasmnode(rasm.assemble);
              asmstat:=tasmnode(rasm.assemble);
-{$endif}  
-             
+{$endif}
+
          else
          else
            Message(parser_f_assembler_reader_not_supported);
            Message(parser_f_assembler_reader_not_supported);
          end;
          end;
@@ -1142,7 +1142,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.68  2002-08-10 14:46:30  carl
+  Revision 1.69  2002-08-11 13:24:12  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.68  2002/08/10 14:46:30  carl
     + moved target_cpu_string to cpuinfo
     + moved target_cpu_string to cpuinfo
     * renamed asmmode enum.
     * renamed asmmode enum.
     * assembler reader has now less ifdef's
     * assembler reader has now less ifdef's

+ 14 - 5
compiler/psub.pas

@@ -233,13 +233,13 @@ implementation
          oldquickexitlabel:=quickexitlabel;
          oldquickexitlabel:=quickexitlabel;
          oldfaillabel:=faillabel;
          oldfaillabel:=faillabel;
          { get new labels }
          { get new labels }
-         getlabel(aktexitlabel);
-         getlabel(aktexit2label);
+         current_library.getlabel(aktexitlabel);
+         current_library.getlabel(aktexit2label);
          { exit for fail in constructors }
          { exit for fail in constructors }
          if (aktprocdef.proctypeoption=potype_constructor) then
          if (aktprocdef.proctypeoption=potype_constructor) then
            begin
            begin
-             getlabel(faillabel);
-             getlabel(quickexitlabel);
+             current_library.getlabel(faillabel);
+             current_library.getlabel(quickexitlabel);
            end;
            end;
          { reset break and continue labels }
          { reset break and continue labels }
          block_type:=bt_general;
          block_type:=bt_general;
@@ -814,7 +814,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2002-08-09 19:14:28  carl
+  Revision 1.65  2002-08-11 13:24:13  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.64  2002/08/09 19:14:28  carl
     * fixed stackframe parameter (should only contain local size),
     * fixed stackframe parameter (should only contain local size),
       set to zero currently
       set to zero currently
 
 

+ 28 - 19
compiler/ptconst.pas

@@ -80,10 +80,10 @@ implementation
          strval    : pchar;
          strval    : pchar;
          pw        : pcompilerwidestring;
          pw        : pcompilerwidestring;
          error     : boolean;
          error     : boolean;
-	 
+
       type
       type
          setbytes = array[0..31] of byte;
          setbytes = array[0..31] of byte;
-	 Psetbytes = ^setbytes;
+         Psetbytes = ^setbytes;
 
 
       procedure check_range(def:torddef);
       procedure check_range(def:torddef);
         begin
         begin
@@ -240,7 +240,7 @@ implementation
                       if not(tobjectdef(tclassrefdef(p.resulttype.def).pointertype.def).is_related(
                       if not(tobjectdef(tclassrefdef(p.resulttype.def).pointertype.def).is_related(
                         tobjectdef(tclassrefdef(t.def).pointertype.def))) then
                         tobjectdef(tclassrefdef(t.def).pointertype.def))) then
                         Message(cg_e_illegal_expression);
                         Message(cg_e_illegal_expression);
-                      curconstSegment.concat(Tai_const_symbol.Create(newasmsymbol(tobjectdef(
+                      curconstSegment.concat(Tai_const_symbol.Create(current_library.newasmsymbol(tobjectdef(
                         tclassrefdef(p.resulttype.def).pointertype.def).vmt_mangledname)));
                         tclassrefdef(p.resulttype.def).pointertype.def).vmt_mangledname)));
                    end;
                    end;
                  niln:
                  niln:
@@ -282,7 +282,7 @@ implementation
                 if is_char(tpointerdef(t.def).pointertype.def) and
                 if is_char(tpointerdef(t.def).pointertype.def) and
                    (p.nodetype<>addrn) then
                    (p.nodetype<>addrn) then
                   begin
                   begin
-                    getdatalabel(ll);
+                    current_library.getdatalabel(ll);
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     if p.nodetype=stringconstn then
                     if p.nodetype=stringconstn then
                      varalign:=size_2_align(tstringconstnode(p).len)
                      varalign:=size_2_align(tstringconstnode(p).len)
@@ -313,7 +313,7 @@ implementation
                 if is_widechar(tpointerdef(t.def).pointertype.def) and
                 if is_widechar(tpointerdef(t.def).pointertype.def) and
                    (p.nodetype<>addrn) then
                    (p.nodetype<>addrn) then
                   begin
                   begin
-                    getdatalabel(ll);
+                    current_library.getdatalabel(ll);
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     Consts.concat(Tai_label.Create(ll));
                     Consts.concat(Tai_label.Create(ll));
                     if (p.nodetype in [stringconstn,ordconstn]) then
                     if (p.nodetype in [stringconstn,ordconstn]) then
@@ -445,11 +445,11 @@ implementation
                         if source_info.endian = target_info.endian then
                         if source_info.endian = target_info.endian then
                           begin
                           begin
                             for l:=0 to p.resulttype.def.size-1 do
                             for l:=0 to p.resulttype.def.size-1 do
-			    {$ifdef oldset}
-			       curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[l]));
-			    {$else}
+                            {$ifdef oldset}
+                               curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[l]));
+                            {$else}
                                curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l]));
                                curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l]));
-			    {$endif}
+                            {$endif}
                           end
                           end
                         else
                         else
                           begin
                           begin
@@ -457,17 +457,17 @@ implementation
                             j:=0;
                             j:=0;
                             for l:=0 to ((p.resulttype.def.size-1) div 4) do
                             for l:=0 to ((p.resulttype.def.size-1) div 4) do
                               begin
                               begin
-			{$ifdef oldset}
-                		curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+3]));
-                		curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+2]));
-                		curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+1]));
-                		curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j]));
-			{$else}
+                        {$ifdef oldset}
+                                curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+3]));
+                                curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+2]));
+                                curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j+1]));
+                                curconstsegment.concat(tai_const.create_8bit(tsetconstnode(p).value_set^[j]));
+                        {$else}
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+3]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+3]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+1]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+1]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j]));
                                 curconstsegment.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j]));
-			{$endif}
+                        {$endif}
                                 Inc(j,4);
                                 Inc(j,4);
                               end;
                               end;
                           end;
                           end;
@@ -563,7 +563,7 @@ implementation
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                         else
                         else
                           begin
                           begin
-                            getdatalabel(ll);
+                            current_library.getdatalabel(ll);
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             { first write the maximum size }
                             { first write the maximum size }
                             Consts.concat(Tai_const.Create_32bit(strlength));
                             Consts.concat(Tai_const.Create_32bit(strlength));
@@ -590,7 +590,7 @@ implementation
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                         else
                         else
                           begin
                           begin
-                            getdatalabel(ll);
+                            current_library.getdatalabel(ll);
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             Consts.concat(Tai_const.Create_32bit(strlength));
                             Consts.concat(Tai_const.Create_32bit(strlength));
                             Consts.concat(Tai_const.Create_32bit(strlength));
                             Consts.concat(Tai_const.Create_32bit(strlength));
@@ -986,7 +986,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.53  2002-07-23 12:34:30  daniel
+  Revision 1.54  2002-08-11 13:24:13  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.53  2002/07/23 12:34:30  daniel
   * Readded old set code. To use it define 'oldset'. Activated by default
   * Readded old set code. To use it define 'oldset'. Activated by default
     for ppc.
     for ppc.
 
 

+ 16 - 7
compiler/rautils.pas

@@ -835,7 +835,7 @@ Begin
             end;
             end;
           globalsymtable,
           globalsymtable,
           staticsymtable :
           staticsymtable :
-            opr.ref.symbol:=newasmsymbol(tvarsym(sym).mangledname);
+            opr.ref.symbol:=current_library.newasmsymbol(tvarsym(sym).mangledname);
           parasymtable :
           parasymtable :
             begin
             begin
               { if we only want the offset we don't have to care
               { if we only want the offset we don't have to care
@@ -880,7 +880,7 @@ Begin
           localsymtable :
           localsymtable :
             begin
             begin
               if (vo_is_external in tvarsym(sym).varoptions) then
               if (vo_is_external in tvarsym(sym).varoptions) then
-                opr.ref.symbol:=newasmsymbol(tvarsym(sym).mangledname)
+                opr.ref.symbol:=current_library.newasmsymbol(tvarsym(sym).mangledname)
               else
               else
                 begin
                 begin
                   { if we only want the offset we don't have to care
                   { if we only want the offset we don't have to care
@@ -941,7 +941,7 @@ Begin
       end;
       end;
     typedconstsym :
     typedconstsym :
       begin
       begin
-        opr.ref.symbol:=newasmsymbol(ttypedconstsym(sym).mangledname);
+        opr.ref.symbol:=current_library.newasmsymbol(ttypedconstsym(sym).mangledname);
         case ttypedconstsym(sym).typedconsttype.def.deftype of
         case ttypedconstsym(sym).typedconsttype.def.deftype of
           orddef,
           orddef,
           enumdef,
           enumdef,
@@ -989,7 +989,7 @@ Begin
           Message(asmr_w_calling_overload_func);
           Message(asmr_w_calling_overload_func);
         l:=opr.ref.offset;
         l:=opr.ref.offset;
         opr.typ:=OPR_SYMBOL;
         opr.typ:=OPR_SYMBOL;
-        opr.symbol:=newasmsymbol(tprocsym(sym).defs^.def.mangledname);
+        opr.symbol:=current_library.newasmsymbol(tprocsym(sym).defs^.def.mangledname);
         opr.symofs:=l;
         opr.symofs:=l;
         hasvar:=true;
         hasvar:=true;
         SetupVar:=TRUE;
         SetupVar:=TRUE;
@@ -1010,7 +1010,7 @@ var
   p : tasmsymbol;
   p : tasmsymbol;
 begin
 begin
   SetupDirectVar:=false;
   SetupDirectVar:=false;
-  p:=getasmsymbol(hs);
+  p:=current_library.getasmsymbol(hs);
   if assigned(p) then
   if assigned(p) then
    begin
    begin
      opr.ref.symbol:=p;
      opr.ref.symbol:=p;
@@ -1129,7 +1129,7 @@ function TLocalLabel.Gettasmlabel:tasmlabel;
 begin
 begin
   if not assigned(lab) then
   if not assigned(lab) then
    begin
    begin
-     getlabel(lab);
+     current_library.getlabel(lab);
      { this label is forced to be used so it's always written }
      { this label is forced to be used so it's always written }
      inc(lab.refs);
      inc(lab.refs);
    end;
    end;
@@ -1592,7 +1592,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.38  2002-07-20 11:57:57  florian
+  Revision 1.39  2002-08-11 13:24:13  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.38  2002/07/20 11:57:57  florian
     * types.pas renamed to defbase.pas because D6 contains a types
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added
     + Willamette/SSE2 instructions to assembler added

+ 30 - 10
compiler/symdef.pas

@@ -69,6 +69,7 @@ interface
           procedure write(ppufile:tcompilerppufile);virtual;abstract;
           procedure write(ppufile:tcompilerppufile);virtual;abstract;
           procedure deref;override;
           procedure deref;override;
           procedure derefimpl;override;
           procedure derefimpl;override;
+          procedure derefobjectdata;override;
           function  size:longint;override;
           function  size:longint;override;
           function  alignment:longint;override;
           function  alignment:longint;override;
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
@@ -512,6 +513,7 @@ interface
           procedure write(ppufile:tcompilerppufile);override;
           procedure write(ppufile:tcompilerppufile);override;
           procedure deref;override;
           procedure deref;override;
           procedure derefimpl;override;
           procedure derefimpl;override;
+          procedure derefobjectdata;override;
           function  getsymtable(t:tgetsymtable):tsymtable;override;
           function  getsymtable(t:tgetsymtable):tsymtable;override;
           function  haspara:boolean;
           function  haspara:boolean;
           function  mangledname : string;
           function  mangledname : string;
@@ -922,6 +924,11 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tstoreddef.derefobjectdata;
+      begin
+      end;
+
+
     function tstoreddef.size : longint;
     function tstoreddef.size : longint;
       begin
       begin
          size:=savesize;
          size:=savesize;
@@ -1096,7 +1103,7 @@ implementation
           begin
           begin
             if not assigned(localrttilab[rt]) then
             if not assigned(localrttilab[rt]) then
              begin
              begin
-               getdatalabel(localrttilab[rt]);
+               current_library.getdatalabel(localrttilab[rt]);
                write_child_rtti_data(rt);
                write_child_rtti_data(rt);
                if (cs_create_smart in aktmoduleswitches) then
                if (cs_create_smart in aktmoduleswitches) then
                 rttiList.concat(Tai_cut.Create);
                 rttiList.concat(Tai_cut.Create);
@@ -1516,7 +1523,7 @@ implementation
          if rangenr=0 then
          if rangenr=0 then
            begin
            begin
               { generate two constant for bounds }
               { generate two constant for bounds }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
               else
               else
@@ -1736,7 +1743,7 @@ implementation
               else
               else
                rangechecksize:=16;
                rangechecksize:=16;
               { generate two constant for bounds }
               { generate two constant for bounds }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,rangechecksize))
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,rangechecksize))
               else
               else
@@ -2615,7 +2622,7 @@ implementation
          if rangenr=0 then
          if rangenr=0 then
            begin
            begin
               { generates the data for range checking }
               { generates the data for range checking }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
               else
               else
@@ -3792,6 +3799,11 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tprocdef.derefobjectdata;
+      begin
+      end;
+
+
     function tprocdef.mangledname : string;
     function tprocdef.mangledname : string;
       var
       var
         s  : string;
         s  : string;
@@ -4364,7 +4376,7 @@ implementation
     begin
     begin
         { if we found already a destructor, then we exit }
         { if we found already a destructor, then we exit }
         if (sd=nil) and (Tsym(sym).typ=procsym) then
         if (sd=nil) and (Tsym(sym).typ=procsym) then
-    	    sd:=Tprocsym(sym).search_procdef_bytype(potype_destructor);
+            sd:=Tprocsym(sym).search_procdef_bytype(potype_destructor);
     end;
     end;
 
 
    function tobjectdef.searchdestructor : tprocdef;
    function tobjectdef.searchdestructor : tprocdef;
@@ -4444,14 +4456,13 @@ implementation
           para : TParaItem;
           para : TParaItem;
           arglength : byte;
           arglength : byte;
           sp : char;
           sp : char;
-          pdl : pprocdeflist;
       begin
       begin
         If tsym(p).typ = procsym then
         If tsym(p).typ = procsym then
          begin
          begin
            pd := tprocsym(p).first_procdef;
            pd := tprocsym(p).first_procdef;
            { this will be used for full implementation of object stabs
            { this will be used for full implementation of object stabs
            not yet done }
            not yet done }
-	   ipd := Tprocsym(p).last_procdef;
+           ipd := Tprocsym(p).last_procdef;
            if (po_virtualmethod in pd.procoptions) then
            if (po_virtualmethod in pd.procoptions) then
              begin
              begin
                lindex := pd.extnumber;
                lindex := pd.extnumber;
@@ -4911,8 +4922,8 @@ implementation
 
 
       begin
       begin
          classtablelist:=TLinkedList.Create;
          classtablelist:=TLinkedList.Create;
-         getdatalabel(fieldtable);
-         getdatalabel(classtable);
+         current_library.getdatalabel(fieldtable);
+         current_library.getdatalabel(classtable);
          count:=0;
          count:=0;
          tablecount:=0;
          tablecount:=0;
          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields,nil);
          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields,nil);
@@ -5490,7 +5501,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.86  2002-08-09 07:33:03  florian
+  Revision 1.87  2002-08-11 13:24:13  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.86  2002/08/09 07:33:03  florian
     * a couple of interface related fixes
     * a couple of interface related fixes
 
 
   Revision 1.85  2002/07/23 09:51:24  daniel
   Revision 1.85  2002/07/23 09:51:24  daniel

+ 33 - 1
compiler/symppu.pas

@@ -26,23 +26,28 @@ unit symppu;
 interface
 interface
 
 
     uses
     uses
+       cclasses,
        globtype,globals,
        globtype,globals,
+       aasmbase,
        symbase,symtype,
        symbase,symtype,
        ppu;
        ppu;
 
 
     type
     type
        tcompilerppufile=class(tppufile)
        tcompilerppufile=class(tppufile)
+       public
          procedure checkerror;
          procedure checkerror;
          procedure getguid(var g: tguid);
          procedure getguid(var g: tguid);
          procedure getposinfo(var p:tfileposinfo);
          procedure getposinfo(var p:tfileposinfo);
          function  getderef : pointer;
          function  getderef : pointer;
          function  getsymlist:tsymlist;
          function  getsymlist:tsymlist;
          procedure gettype(var t:ttype);
          procedure gettype(var t:ttype);
+         function  getasmsymbol:tasmsymbol;
          procedure putguid(const g: tguid);
          procedure putguid(const g: tguid);
          procedure putposinfo(const p:tfileposinfo);
          procedure putposinfo(const p:tfileposinfo);
          procedure putderef(p : tsymtableentry);
          procedure putderef(p : tsymtableentry);
          procedure putsymlist(p:tsymlist);
          procedure putsymlist(p:tsymlist);
          procedure puttype(const t:ttype);
          procedure puttype(const t:ttype);
+         procedure putasmsymbol(s:tasmsymbol);
        end;
        end;
 
 
 
 
@@ -177,6 +182,12 @@ implementation
       end;
       end;
 
 
 
 
+    function  tcompilerppufile.getasmsymbol:tasmsymbol;
+      begin
+        getasmsymbol:=tasmsymbol(pointer(getlongint));
+      end;
+
+
     procedure tcompilerppufile.putposinfo(const p:tfileposinfo);
     procedure tcompilerppufile.putposinfo(const p:tfileposinfo);
       var
       var
         oldcrc : boolean;
         oldcrc : boolean;
@@ -385,10 +396,31 @@ implementation
          end;
          end;
       end;
       end;
 
 
+
+    procedure tcompilerppufile.putasmsymbol(s:tasmsymbol);
+      begin
+        if s.ppuidx=-1 then
+         begin
+           s.ppuidx:=current_library.asmsymbolppuidx;
+           inc(current_library.asmsymbolppuidx);
+         end;
+        putlongint(s.ppuidx);
+      end;
+
+
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-05-18 13:34:18  peter
+  Revision 1.13  2002-08-11 13:24:14  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.12  2002/05/18 13:34:18  peter
     * readded missing revisions
     * readded missing revisions
 
 
   Revision 1.11  2002/05/16 19:46:45  carl
   Revision 1.11  2002/05/16 19:46:45  carl

+ 121 - 112
compiler/symsym.pas

@@ -124,13 +124,13 @@ interface
           procedure write(ppufile:tcompilerppufile);override;
           procedure write(ppufile:tcompilerppufile);override;
           procedure deref;override;
           procedure deref;override;
           procedure addprocdef(p:tprocdef);
           procedure addprocdef(p:tprocdef);
-	  procedure concat_procdefs_to(s:Tprocsym);
-	  function first_procdef:Tprocdef;
-	  function last_procdef:Tprocdef;
-	  function search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
-	  function search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
-	  function search_procdef_byretdef_by1paradef(retdef,firstpara:Tdef;
-						      matchtype:Tdefmatch):Tprocdef;
+          procedure concat_procdefs_to(s:Tprocsym);
+          function first_procdef:Tprocdef;
+          function last_procdef:Tprocdef;
+          function search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
+          function search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
+          function search_procdef_byretdef_by1paradef(retdef,firstpara:Tdef;
+                                                      matchtype:Tdefmatch):Tprocdef;
           function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
           function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
 {$ifdef GDB}
 {$ifdef GDB}
           function stabstring : pchar;override;
           function stabstring : pchar;override;
@@ -870,24 +870,24 @@ implementation
         pd^.next:=defs;
         pd^.next:=defs;
         defs:=pd;
         defs:=pd;
       end;
       end;
-    
+
     procedure Tprocsym.concat_procdefs_to(s:Tprocsym);
     procedure Tprocsym.concat_procdefs_to(s:Tprocsym);
-    
+
     var pd:Pprocdeflist;
     var pd:Pprocdeflist;
-    
+
     begin
     begin
-	pd:=defs;
-	while assigned(defs) do
-	    begin
-		s.addprocdef(pd^.def);
-		pd:=pd^.next;
-	    end;
+        pd:=defs;
+        while assigned(defs) do
+            begin
+                s.addprocdef(pd^.def);
+                pd:=pd^.next;
+            end;
     end;
     end;
 
 
     function Tprocsym.first_procdef:Tprocdef;
     function Tprocsym.first_procdef:Tprocdef;
 
 
     begin
     begin
-	first_procdef:=defs^.def;
+        first_procdef:=defs^.def;
     end;
     end;
 
 
     function Tprocsym.last_procdef:Tprocdef;
     function Tprocsym.last_procdef:Tprocdef;
@@ -895,36 +895,36 @@ implementation
     var pd:Pprocdeflist;
     var pd:Pprocdeflist;
 
 
     begin
     begin
-	pd:=defs;
-	while assigned(pd) do
-	    begin
-		last_procdef:=pd^.def;
-		pd:=pd^.next;
-	    end;
+        pd:=defs;
+        while assigned(pd) do
+            begin
+                last_procdef:=pd^.def;
+                pd:=pd^.next;
+            end;
     end;
     end;
 
 
     function Tprocsym.search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
     function Tprocsym.search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
-    
+
     var p:Pprocdeflist;
     var p:Pprocdeflist;
-    
+
     begin
     begin
-	search_procdef_bytype:=nil;
-	p:=defs;
-	while p<>nil do
-	    begin
-		if p^.def.proctypeoption=pt then
-		    begin
-			search_procdef_bytype:=p^.def;
-			break;
-		    end;
-		p:=p^.next;
-	    end;
+        search_procdef_bytype:=nil;
+        p:=defs;
+        while p<>nil do
+            begin
+                if p^.def.proctypeoption=pt then
+                    begin
+                        search_procdef_bytype:=p^.def;
+                        break;
+                    end;
+                p:=p^.next;
+            end;
     end;
     end;
-    
+
     function Tprocsym.search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
     function Tprocsym.search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
 
 
     var pd:Pprocdeflist;
     var pd:Pprocdeflist;
-    
+
     begin
     begin
         {This function will return the pprocdef of pprocsym that
         {This function will return the pprocdef of pprocsym that
          is the best match for procvardef. When there are multiple
          is the best match for procvardef. When there are multiple
@@ -933,76 +933,76 @@ implementation
         search_procdef_byprocvardef:=nil;
         search_procdef_byprocvardef:=nil;
         pd:=defs;
         pd:=defs;
         while assigned(pd) do
         while assigned(pd) do
-	    begin
-		if proc_to_procvar_equal(pd^.def,d,true) then
-		    begin
-			{ already found a match ? Then stop and return nil }
-            		if assigned(search_procdef_byprocvardef) then
-            		    begin
-                		search_procdef_byprocvardef:=nil;
-                		break;
-            		    end;
-        		search_procdef_byprocvardef:=pd^.def;
-		    end;
-		pd:=pd^.next;
-	    end;
+            begin
+                if proc_to_procvar_equal(pd^.def,d,true) then
+                    begin
+                        { already found a match ? Then stop and return nil }
+                        if assigned(search_procdef_byprocvardef) then
+                            begin
+                                search_procdef_byprocvardef:=nil;
+                                break;
+                            end;
+                        search_procdef_byprocvardef:=pd^.def;
+                    end;
+                pd:=pd^.next;
+            end;
         {Try a convertable match, if no exact match was found.}
         {Try a convertable match, if no exact match was found.}
         if not assigned(search_procdef_byprocvardef) and not assigned(pd) then
         if not assigned(search_procdef_byprocvardef) and not assigned(pd) then
-    	    begin
-    		pd:=defs;
-    	        while assigned(pd) do
-        	    begin
-            		if proc_to_procvar_equal(pd^.def,d,false) then
-            		    begin
-                		{ already found a match ? Then stop and return nil }
-                		if assigned(search_procdef_byprocvardef) then
-                		    begin
-                			search_procdef_byprocvardef:=nil;
-                			break;
-                		    end;
-                		search_procdef_byprocvardef:=pd^.def;
-            		    end;
-            		pd:=pd^.next;
-        	    end;
-	    end;
+            begin
+                pd:=defs;
+                while assigned(pd) do
+                    begin
+                        if proc_to_procvar_equal(pd^.def,d,false) then
+                            begin
+                                { already found a match ? Then stop and return nil }
+                                if assigned(search_procdef_byprocvardef) then
+                                    begin
+                                        search_procdef_byprocvardef:=nil;
+                                        break;
+                                    end;
+                                search_procdef_byprocvardef:=pd^.def;
+                            end;
+                        pd:=pd^.next;
+                    end;
+            end;
     end;
     end;
 
 
     function Tprocsym.search_procdef_byretdef_by1paradef(retdef,firstpara:Tdef;
     function Tprocsym.search_procdef_byretdef_by1paradef(retdef,firstpara:Tdef;
-		      matchtype:Tdefmatch):Tprocdef;
+                      matchtype:Tdefmatch):Tprocdef;
 
 
     var pd:Pprocdeflist;
     var pd:Pprocdeflist;
-	convtyp:Tconverttype;
-	a,b:boolean;
+        convtyp:Tconverttype;
+        a,b:boolean;
 
 
     begin
     begin
-	search_procdef_byretdef_by1paradef:=nil;
-	pd:=defs;
-	while assigned(pd) do
-	    begin
-		a:=is_equal(retdef,pd^.def.rettype.def);
-		{Alert alert alert alert alert alert alert!!!
-
-		 Make sure you never call isconvertable when a=false. You get
-		 endless recursion then.  Originally a and b were placed in a
-		 single if statement. There was only one reason that it worked:
-		 short circuit boolean eval.}
-		if a then
-		    case matchtype of
-			dm_exact:
-			    b:=TParaItem(pd^.def.para.first).paratype.def=firstpara;
-			dm_equal:
-			    b:=is_equal(Tparaitem(pd^.def.para.first).paratype.def,firstpara);
-			dm_convertl1:
-			    b:=isconvertable(firstpara,Tparaitem(pd^.def.para.first).paratype.def,
-				convtyp,ordconstn,false)=1;
-		    end;
-		if a and b then
-		    begin
-			search_procdef_byretdef_by1paradef:=pd^.def;
-			break;
-		    end;
-		pd:=pd^.next;
-	    end;
+        search_procdef_byretdef_by1paradef:=nil;
+        pd:=defs;
+        while assigned(pd) do
+            begin
+                a:=is_equal(retdef,pd^.def.rettype.def);
+                {Alert alert alert alert alert alert alert!!!
+
+                 Make sure you never call isconvertable when a=false. You get
+                 endless recursion then.  Originally a and b were placed in a
+                 single if statement. There was only one reason that it worked:
+                 short circuit boolean eval.}
+                if a then
+                    case matchtype of
+                        dm_exact:
+                            b:=TParaItem(pd^.def.para.first).paratype.def=firstpara;
+                        dm_equal:
+                            b:=is_equal(Tparaitem(pd^.def.para.first).paratype.def,firstpara);
+                        dm_convertl1:
+                            b:=isconvertable(firstpara,Tparaitem(pd^.def.para.first).paratype.def,
+                                convtyp,ordconstn,false)=1;
+                    end;
+                if a and b then
+                    begin
+                        search_procdef_byretdef_by1paradef:=pd^.def;
+                        break;
+                    end;
+                pd:=pd^.next;
+            end;
     end;
     end;
 
 
     procedure tprocsym.write(ppufile:tcompilerppufile);
     procedure tprocsym.write(ppufile:tcompilerppufile);
@@ -1659,17 +1659,17 @@ implementation
                    else
                    else
                      bssSegment.concat(Tai_datablock.Create(mangledname,l));
                      bssSegment.concat(Tai_datablock.Create(mangledname,l));
                    {Global variables (in implementation part of course)
                    {Global variables (in implementation part of course)
-		    *can* be loaded into registers, they just may not be
-		    accessed from procedures. The lexlevel  test in nld.pas,
-		    Tloadnode.pass_1, should take care of this.
-		    
-		    If for some reason you think it isn't safe, try isolating
-		    and disabling those specific cases, because small programs
-		    without procedures can be very speed critical. For example,
-		    think of benchmarks and programming contests. Also, new
-		    users often test the quality of the code the compiler
-		    generates and they do that with small programs, we should
-		    show them the full optimizing power. (DM)}
+                    *can* be loaded into registers, they just may not be
+                    accessed from procedures. The lexlevel  test in nld.pas,
+                    Tloadnode.pass_1, should take care of this.
+
+                    If for some reason you think it isn't safe, try isolating
+                    and disabling those specific cases, because small programs
+                    without procedures can be very speed critical. For example,
+                    think of benchmarks and programming contests. Also, new
+                    users often test the quality of the code the compiler
+                    generates and they do that with small programs, we should
+                    show them the full optimizing power. (DM)}
                    {exclude(varoptions,vo_regable);
                    {exclude(varoptions,vo_regable);
                    exclude(varoptions,vo_fpuregable);}
                    exclude(varoptions,vo_fpuregable);}
                  end;
                  end;
@@ -2592,7 +2592,7 @@ implementation
       begin
       begin
         { the label is always a global label }
         { the label is always a global label }
         if not assigned(lab) then
         if not assigned(lab) then
-         lab:=newasmsymboltype(mangledname,AB_GLOBAL,AT_DATA);
+         lab:=current_library.newasmsymboltype(mangledname,AB_GLOBAL,AT_DATA);
         get_label:=lab;
         get_label:=lab;
       end;
       end;
 
 
@@ -2672,7 +2672,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  2002-07-23 10:13:23  daniel
+  Revision 1.47  2002-08-11 13:24:14  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.46  2002/07/23 10:13:23  daniel
   * Added important comment
   * Added important comment
 
 
   Revision 1.45  2002/07/23 09:51:26  daniel
   Revision 1.45  2002/07/23 09:51:26  daniel

+ 25 - 2
compiler/symtable.pas

@@ -73,6 +73,7 @@ interface
           procedure write_references(ppufile:tcompilerppufile;locals:boolean);virtual;
           procedure write_references(ppufile:tcompilerppufile;locals:boolean);virtual;
           procedure deref;virtual;
           procedure deref;virtual;
           procedure derefimpl;virtual;
           procedure derefimpl;virtual;
+          procedure derefobjectdata;virtual;
           procedure insert(sym : tsymentry);override;
           procedure insert(sym : tsymentry);override;
           function  speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;override;
           function  speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;override;
           procedure allsymbolsused;
           procedure allsymbolsused;
@@ -535,6 +536,19 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tstoredsymtable.derefobjectdata;
+      var
+        hp : tdef;
+      begin
+        hp:=tdef(defindex.first);
+        while assigned(hp) do
+         begin
+           hp.derefobjectdata;
+           hp:=tdef(hp.indexnext);
+         end;
+      end;
+
+
     procedure tstoredsymtable.insert(sym:tsymentry);
     procedure tstoredsymtable.insert(sym:tsymentry);
       var
       var
          hsym : tsym;
          hsym : tsym;
@@ -863,7 +877,7 @@ implementation
                           overloaded_operators[t]:=tprocsym(srsym)
                           overloaded_operators[t]:=tprocsym(srsym)
                        else
                        else
                           { already got a procsym, only add defs of the current procsym }
                           { already got a procsym, only add defs of the current procsym }
-			  Tprocsym(srsym).concat_procdefs_to(overloaded_operators[t]);
+                          Tprocsym(srsym).concat_procdefs_to(overloaded_operators[t]);
                        symtablestack:=srsym.owner.next;
                        symtablestack:=srsym.owner.next;
                     end
                     end
                   else
                   else
@@ -2058,7 +2072,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.65  2002-07-23 09:51:27  daniel
+  Revision 1.66  2002-08-11 13:24:15  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.65  2002/07/23 09:51:27  daniel
   * Tried to make Tprocsym.defs protected. I didn't succeed but the cleanups
   * Tried to make Tprocsym.defs protected. I didn't succeed but the cleanups
     are worth comitting.
     are worth comitting.
 
 

+ 11 - 1
compiler/symtype.pas

@@ -68,6 +68,7 @@ interface
          constructor create;
          constructor create;
          procedure deref;virtual;abstract;
          procedure deref;virtual;abstract;
          procedure derefimpl;virtual;abstract;
          procedure derefimpl;virtual;abstract;
+         procedure derefobjectdata;virtual;abstract;
          function  typename:string;
          function  typename:string;
          function  gettypename:string;virtual;
          function  gettypename:string;virtual;
          function  mangledparaname:string;
          function  mangledparaname:string;
@@ -528,7 +529,16 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2002-07-01 18:46:29  peter
+  Revision 1.20  2002-08-11 13:24:16  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.19  2002/07/01 18:46:29  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 11 - 2
compiler/targets/t_beos.pas

@@ -172,7 +172,7 @@ begin
            { place jump in codesegment }
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            codesegment.concat(Tai_align.Create_op(4,$90));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
+           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,current_library.newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;
@@ -465,7 +465,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2002-07-26 21:15:45  florian
+  Revision 1.21  2002-08-11 13:24:19  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.20  2002/07/26 21:15:45  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.19  2002/07/01 18:46:34  peter
   Revision 1.19  2002/07/01 18:46:34  peter

+ 11 - 2
compiler/targets/t_fbsd.pas

@@ -174,7 +174,7 @@ begin
            { place jump in codesegment }
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            codesegment.concat(Tai_align.Create_op(4,$90));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
+           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,current_library.newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;
@@ -514,7 +514,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2002-07-26 21:15:45  florian
+  Revision 1.26  2002-08-11 13:24:19  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.25  2002/07/26 21:15:45  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.24  2002/07/24 13:51:34  marco
   Revision 1.24  2002/07/24 13:51:34  marco

+ 11 - 2
compiler/targets/t_linux.pas

@@ -181,7 +181,7 @@ begin
            { place jump in codesegment }
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            codesegment.concat(Tai_align.Create_op(4,$90));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
+           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,current_library.newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;
@@ -524,7 +524,16 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2002-07-26 21:15:46  florian
+  Revision 1.30  2002-08-11 13:24:19  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.29  2002/07/26 21:15:46  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.28  2002/07/04 20:43:02  florian
   Revision 1.28  2002/07/04 20:43:02  florian

+ 11 - 2
compiler/targets/t_nwm.pas

@@ -239,7 +239,7 @@ begin
            { place jump in codesegment }
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            codesegment.concat(Tai_align.Create_op(4,$90));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
+           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,current_library.newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;
@@ -484,7 +484,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.26  2002-07-26 21:15:46  florian
+  Revision 1.27  2002-08-11 13:24:20  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.26  2002/07/26 21:15:46  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.25  2002/07/01 18:46:35  peter
   Revision 1.25  2002/07/01 18:46:35  peter

+ 11 - 2
compiler/targets/t_sunos.pas

@@ -188,7 +188,7 @@ begin
            { place jump in codesegment }
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            codesegment.concat(Tai_align.Create_op(4,$90));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
            codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
-           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
+           codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,current_library.newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
            codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
 {$endif i386}
 {$endif i386}
          end;
          end;
@@ -486,7 +486,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2002-07-26 21:15:46  florian
+  Revision 1.26  2002-08-11 13:24:20  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.25  2002/07/26 21:15:46  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.24  2002/07/01 18:46:35  peter
   Revision 1.24  2002/07/01 18:46:35  peter

+ 31 - 22
compiler/targets/t_win32.pas

@@ -249,10 +249,10 @@ const
          while assigned(hp1) do
          while assigned(hp1) do
            begin
            begin
            { Get labels for the sections }
            { Get labels for the sections }
-             getdatalabel(lhead);
-             getdatalabel(lname);
-             getaddrlabel(lidata4);
-             getaddrlabel(lidata5);
+             current_library.getdatalabel(lhead);
+             current_library.getdatalabel(lname);
+             current_library.getaddrlabel(lidata4);
+             current_library.getaddrlabel(lidata5);
            { create header for this importmodule }
            { create header for this importmodule }
              importsSection.concat(Tai_cut.Create_begin);
              importsSection.concat(Tai_cut.Create_begin);
              importsSection.concat(Tai_section.Create(sec_idata2));
              importsSection.concat(Tai_section.Create(sec_idata2));
@@ -284,7 +284,7 @@ const
                  { create indirect jump }
                  { create indirect jump }
                  if not hp2.is_var then
                  if not hp2.is_var then
                   begin
                   begin
-                    getlabel(lcode);
+                    current_library.getlabel(lcode);
                     reference_reset_symbol(href,lcode,0);
                     reference_reset_symbol(href,lcode,0);
                     { place jump in codesegment, insert a code section in the
                     { place jump in codesegment, insert a code section in the
                       imporTSection to reduce the amount of .s files (PFV) }
                       imporTSection to reduce the amount of .s files (PFV) }
@@ -301,7 +301,7 @@ const
                  importsSection.concat(Tai_section.Create(sec_idata7));
                  importsSection.concat(Tai_section.Create(sec_idata7));
                  importsSection.concat(Tai_const_symbol.Create_rva(lhead));
                  importsSection.concat(Tai_const_symbol.Create_rva(lhead));
                  { fixup }
                  { fixup }
-                 getlabel(tasmlabel(hp2.lab));
+                 current_library.getlabel(tasmlabel(hp2.lab));
                  importsSection.concat(Tai_section.Create(sec_idata4));
                  importsSection.concat(Tai_section.Create(sec_idata4));
                  importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab));
                  importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab));
                  { add jump field to imporTSection }
                  { add jump field to imporTSection }
@@ -317,7 +317,7 @@ const
                       begin
                       begin
                         importname:='__imp_'+hp2.name^;
                         importname:='__imp_'+hp2.name^;
                         suffix:=0;
                         suffix:=0;
-                        while assigned(getasmsymbol(importname)) do
+                        while assigned(current_library.getasmsymbol(importname)) do
                          begin
                          begin
                            inc(suffix);
                            inc(suffix);
                            importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
                            importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
@@ -328,7 +328,7 @@ const
                       begin
                       begin
                         importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                         importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                         suffix:=0;
                         suffix:=0;
-                        while assigned(getasmsymbol(importname)) do
+                        while assigned(current_library.getasmsymbol(importname)) do
                          begin
                          begin
                            inc(suffix);
                            inc(suffix);
                            importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
                            importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
@@ -391,9 +391,9 @@ const
               importsSection.concat(Tai_section.Create(sec_code));
               importsSection.concat(Tai_section.Create(sec_code));
               importsSection.concat(Tai_align.Create_op(4,$90));
               importsSection.concat(Tai_align.Create_op(4,$90));
               { Get labels for the sections }
               { Get labels for the sections }
-              getlabel(l1);
-              getlabel(l2);
-              getlabel(l3);
+              current_library.getlabel(l1);
+              current_library.getlabel(l2);
+              current_library.getlabel(l3);
               importsSection.concat(Tai_section.Create(sec_idata2));
               importsSection.concat(Tai_section.Create(sec_idata2));
               { pointer to procedure names }
               { pointer to procedure names }
               importsSection.concat(Tai_const_symbol.Create_rva(l2));
               importsSection.concat(Tai_const_symbol.Create_rva(l2));
@@ -415,7 +415,7 @@ const
               hp2:=timported_item(hp1.imported_items.first);
               hp2:=timported_item(hp1.imported_items.first);
               while assigned(hp2) do
               while assigned(hp2) do
                 begin
                 begin
-                   getlabel(tasmlabel(hp2.lab));
+                   current_library.getlabel(tasmlabel(hp2.lab));
                    if hp2.name^<>'' then
                    if hp2.name^<>'' then
                      importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab))
                      importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab))
                    else
                    else
@@ -433,7 +433,7 @@ const
                 begin
                 begin
                    if not hp2.is_var then
                    if not hp2.is_var then
                     begin
                     begin
-                      getlabel(l4);
+                      current_library.getlabel(l4);
                       { create indirect jump }
                       { create indirect jump }
                       reference_reset_symbol(href,l4,0);
                       reference_reset_symbol(href,l4,0);
                       { place jump in codesegment }
                       { place jump in codesegment }
@@ -450,7 +450,7 @@ const
                           begin
                           begin
                             importname:='__imp_'+hp2.name^;
                             importname:='__imp_'+hp2.name^;
                             suffix:=0;
                             suffix:=0;
-                            while assigned(getasmsymbol(importname)) do
+                            while assigned(current_library.getasmsymbol(importname)) do
                              begin
                              begin
                                inc(suffix);
                                inc(suffix);
                                importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
                                importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
@@ -461,7 +461,7 @@ const
                           begin
                           begin
                             importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                             importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                             suffix:=0;
                             suffix:=0;
-                            while assigned(getasmsymbol(importname)) do
+                            while assigned(current_library.getasmsymbol(importname)) do
                              begin
                              begin
                                inc(suffix);
                                inc(suffix);
                                importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
                                importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
@@ -513,7 +513,7 @@ const
          if not(assigned(exportssection)) then
          if not(assigned(exportssection)) then
            exportssection:=TAAsmoutput.create;
            exportssection:=TAAsmoutput.create;
          last_index:=0;
          last_index:=0;
-         getdatalabel(edatalabel);
+         current_library.getdatalabel(edatalabel);
       end;
       end;
 
 
 
 
@@ -609,10 +609,10 @@ const
          ordinal_min:=$7FFFFFFF;
          ordinal_min:=$7FFFFFFF;
          entries:=0;
          entries:=0;
          named_entries:=0;
          named_entries:=0;
-         getlabel(dll_name_label);
-         getlabel(export_address_table);
-         getlabel(export_name_table_pointers);
-         getlabel(export_ordinal_table);
+         current_library.getlabel(dll_name_label);
+         current_library.getlabel(export_address_table);
+         current_library.getlabel(export_name_table_pointers);
+         current_library.getlabel(export_ordinal_table);
 
 
          { count entries }
          { count entries }
          while assigned(hp) do
          while assigned(hp) do
@@ -684,7 +684,7 @@ const
            begin
            begin
               if (hp.options and eo_name)<>0 then
               if (hp.options and eo_name)<>0 then
                 begin
                 begin
-                   getlabel(name_label);
+                   current_library.getlabel(name_label);
                    name_table_pointers.concat(Tai_const_symbol.Create_rva(name_label));
                    name_table_pointers.concat(Tai_const_symbol.Create_rva(name_label));
                    ordinal_table.concat(Tai_const.Create_16bit(hp.index-ordinal_base));
                    ordinal_table.concat(Tai_const.Create_16bit(hp.index-ordinal_base));
                    name_table.concat(Tai_align.Create_op(2,0));
                    name_table.concat(Tai_align.Create_op(2,0));
@@ -1553,7 +1553,16 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.36  2002-07-26 21:15:46  florian
+  Revision 1.37  2002-08-11 13:24:20  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.36  2002/07/26 21:15:46  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.35  2002/07/01 18:46:35  peter
   Revision 1.35  2002/07/01 18:46:35  peter

+ 63 - 5
compiler/utils/ppudump.pp

@@ -298,6 +298,50 @@ begin
 end;
 end;
 
 
 
 
+Procedure ReadAsmSymbols;
+type
+  { Copied from aasmbase.pas }
+  TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
+  TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION);
+var
+  s,
+  bindstr,
+  typestr  : string;
+  i : longint;
+begin
+  writeln(space,'Number of AsmSymbols: ',ppufile.getlongint);
+  i:=0;
+  while (not ppufile.endofentry) and (not ppufile.error) do
+   begin
+     s:=ppufile.getstring;
+     case tasmsymbind(ppufile.getbyte) of
+       AB_EXTERNAL :
+         bindstr:='External';
+       AB_COMMON :
+         bindstr:='Common';
+       AB_LOCAL :
+         bindstr:='Local';
+       AB_GLOBAL :
+         bindstr:='Global';
+       else
+         bindstr:='<Error !!>'
+     end;
+     case tasmsymtype(ppufile.getbyte) of
+       AT_FUNCTION :
+         typestr:='Function';
+       AT_DATA :
+         typestr:='Data';
+       AT_SECTION :
+         typestr:='Section';
+       else
+         typestr:='<Error !!>'
+     end;
+     Writeln(space,'  ',i,' : ',s,' [',bindstr,',',typestr,']');
+     inc(i);
+   end;
+end;
+
+
 Procedure ReadPosInfo;
 Procedure ReadPosInfo;
 var
 var
   info : byte;
   info : byte;
@@ -579,6 +623,7 @@ var
   procoptions     : tprocoptions;
   procoptions     : tprocoptions;
   i,params : longint;
   i,params : longint;
   first    : boolean;
   first    : boolean;
+  paraloc  : array[0..9] of byte;
 begin
 begin
   write(space,'      Return type : ');
   write(space,'      Return type : ');
   readtype;
   readtype;
@@ -629,6 +674,7 @@ begin
        readsymref;
        readsymref;
        write(space,'    Symbol  : ');
        write(space,'    Symbol  : ');
        readsymref;
        readsymref;
+       ppufile.getdata(paraloc,sizeof(paraloc));
        dec(params);
        dec(params);
      until params=0;
      until params=0;
    end;
    end;
@@ -883,7 +929,6 @@ begin
              readcommonsym('Typed constant ');
              readcommonsym('Typed constant ');
              write  (space,' Constant Type: ');
              write  (space,' Constant Type: ');
              readtype;
              readtype;
-             writeln(space,'         Label: ',getstring);
              writeln(space,'   ReallyConst: ',(getbyte<>0));
              writeln(space,'   ReallyConst: ',(getbyte<>0));
            end;
            end;
 
 
@@ -1473,6 +1518,9 @@ begin
      repeat
      repeat
        b:=readentry;
        b:=readentry;
        case b of
        case b of
+         ibasmsymbols :
+           ReadAsmSymbols;
+
          iberror :
          iberror :
            begin
            begin
              Writeln('Error in PPU');
              Writeln('Error in PPU');
@@ -1593,7 +1641,9 @@ begin
      Writeln('-------');
      Writeln('-------');
      with ppufile.header do
      with ppufile.header do
       begin
       begin
-        Writeln('Compiler version        : ',hi(ppufile.header.compiler and $ff),'.',lo(ppufile.header.compiler));
+        Writeln('Compiler version        : ',ppufile.header.compiler shr 14,'.',
+                                             (ppufile.header.compiler shr 7) and $7f,'.',
+                                             ppufile.header.compiler and $7f);
         WriteLn('Target processor        : ',Cpu2Str(cpu));
         WriteLn('Target processor        : ',Cpu2Str(cpu));
         WriteLn('Target operating system : ',Target2Str(target));
         WriteLn('Target operating system : ',Target2Str(target));
         Writeln('Unit flags              : ',PPUFlags2Str(flags));
         Writeln('Unit flags              : ',PPUFlags2Str(flags));
@@ -1633,7 +1683,6 @@ begin
   else
   else
    ppufile.skipuntilentry(ibendsyms);
    ppufile.skipuntilentry(ibendsyms);
 {read the implementation stuff}
 {read the implementation stuff}
-{ Not used at the moment (PFV)
   if (verbose and v_implementation)<>0 then
   if (verbose and v_implementation)<>0 then
    begin
    begin
      Writeln;
      Writeln;
@@ -1641,7 +1690,7 @@ begin
      Writeln('-----------------------');
      Writeln('-----------------------');
      readimplementation;
      readimplementation;
    end
    end
-  else}
+  else
    ppufile.skipuntilentry(ibendimplementation);
    ppufile.skipuntilentry(ibendimplementation);
 {read the static browser units stuff}
 {read the static browser units stuff}
   if (ppufile.header.flags and uf_local_browser)<>0 then
   if (ppufile.header.flags and uf_local_browser)<>0 then
@@ -1774,7 +1823,16 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2002-05-18 13:34:27  peter
+  Revision 1.26  2002-08-11 13:24:20  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.25  2002/05/18 13:34:27  peter
     * readded missing revisions
     * readded missing revisions
 
 
   Revision 1.24  2002/05/16 19:46:54  carl
   Revision 1.24  2002/05/16 19:46:54  carl

+ 17 - 8
compiler/x86/cgx86.pas

@@ -401,7 +401,7 @@ unit cgx86;
     procedure tcgx86.a_call_name(list : taasmoutput;const s : string);
     procedure tcgx86.a_call_name(list : taasmoutput;const s : string);
 
 
       begin
       begin
-        list.concat(taicpu.op_sym(A_CALL,S_NO,newasmsymbol(s)));
+        list.concat(taicpu.op_sym(A_CALL,S_NO,current_library.newasmsymbol(s)));
       end;
       end;
 
 
     procedure tcgx86.a_call_ref(list : taasmoutput;const ref : treference);
     procedure tcgx86.a_call_ref(list : taasmoutput;const ref : treference);
@@ -1268,8 +1268,8 @@ unit cgx86;
         { so we have to access every page first              }
         { so we have to access every page first              }
         if target_info.system=system_i386_win32 then
         if target_info.system=system_i386_win32 then
           begin
           begin
-             getlabel(again);
-             getlabel(ok);
+             current_library.getlabel(again);
+             current_library.getlabel(ok);
              a_label(list,again);
              a_label(list,again);
              list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,R_EDI));
              list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,R_EDI));
              a_jmp_cond(list,OC_B,ok);
              a_jmp_cond(list,OC_B,ok);
@@ -1401,7 +1401,7 @@ unit cgx86;
            system_i386_wdosx,
            system_i386_wdosx,
            system_i386_linux:
            system_i386_linux:
              begin
              begin
-                getaddrlabel(pl);
+                current_library.getaddrlabel(pl);
                 list.concat(Tai_section.Create(sec_data));
                 list.concat(Tai_section.Create(sec_data));
                 list.concat(Tai_align.Create(4));
                 list.concat(Tai_align.Create(4));
                 list.concat(Tai_label.Create(pl));
                 list.concat(Tai_label.Create(pl));
@@ -1448,7 +1448,7 @@ unit cgx86;
                  end
                  end
                else
                else
                  begin
                  begin
-                    getlabel(again);
+                    current_library.getlabel(again);
                     rg.getexplicitregisterint(list,R_EDI);
                     rg.getexplicitregisterint(list,R_EDI);
                     list.concat(Taicpu.op_const_reg(A_MOV,S_L,localsize div winstackpagesize,R_EDI));
                     list.concat(Taicpu.op_const_reg(A_MOV,S_L,localsize div winstackpagesize,R_EDI));
                     a_label(list,again);
                     a_label(list,again);
@@ -1531,7 +1531,7 @@ unit cgx86;
            { must the object be finalized ? }
            { must the object be finalized ? }
            if procinfo^._class.needs_inittable then
            if procinfo^._class.needs_inittable then
             begin
             begin
-              getlabel(nofinal);
+              current_library.getlabel(nofinal);
               reference_reset_base(href,R_EBP,8);
               reference_reset_base(href,R_EBP,8);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               reference_reset_base(href,R_ESI,0);
               reference_reset_base(href,R_ESI,0);
@@ -1630,7 +1630,7 @@ unit cgx86;
       begin
       begin
          if not(cs_check_overflow in aktlocalswitches) then
          if not(cs_check_overflow in aktlocalswitches) then
           exit;
           exit;
-         getlabel(hl);
+         current_library.getlabel(hl);
          if not ((p.resulttype.def.deftype=pointerdef) or
          if not ((p.resulttype.def.deftype=pointerdef) or
                 ((p.resulttype.def.deftype=orddef) and
                 ((p.resulttype.def.deftype=orddef) and
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
@@ -1651,7 +1651,16 @@ unit cgx86;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2002-08-10 10:06:04  jonas
+  Revision 1.8  2002-08-11 13:24:20  peter
+    * saving of asmsymbols in ppu supported
+    * asmsymbollist global is removed and moved into a new class
+      tasmlibrarydata that will hold the info of a .a file which
+      corresponds with a single module. Added librarydata to tmodule
+      to keep the library info stored for the module. In the future the
+      objectfiles will also be stored to the tasmlibrarydata class
+    * all getlabel/newasmsymbol and friends are moved to the new class
+
+  Revision 1.7  2002/08/10 10:06:04  jonas
     * fixed stupid bug of mine in g_flags2reg() when optimizations are on
     * fixed stupid bug of mine in g_flags2reg() when optimizations are on
 
 
   Revision 1.6  2002/08/09 19:18:27  carl
   Revision 1.6  2002/08/09 19:18:27  carl