Pārlūkot izejas kodu

* 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 23 gadi atpakaļ
vecāks
revīzija
ac71268ce6
61 mainītis faili ar 1547 papildinājumiem un 752 dzēšanām
  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;
          { assembler pass label is set, used for detecting multiple labels }
          pass : byte;
+         ppuidx : longint;
          constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
          procedure reset;
          function  is_used:boolean;
          procedure setaddress(_pass:byte;sec:TSection;offset,len:longint);
-         procedure GenerateAltSymbol;
        end;
 
        TAsmLabel = class(TAsmSymbol)
@@ -81,9 +81,9 @@ interface
          { checks -> true) or is it a jump target (false)               }
          is_addr : boolean;
          labelnr : longint;
-         constructor create;
-         constructor createdata;
-         constructor createaddr;
+         constructor create(nr:longint);
+         constructor createdata(nr:longint);
+         constructor createaddr(nr:longint);
          function getname:string;override;
        end;
 
@@ -125,18 +125,32 @@ interface
          procedure addsectionreloc(ofs:longint;sec:TSection;relative:TAsmRelocationType);
        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)
+       public
          name      : string[80];
          currsec   : TSection;
          sects     : array[TSection] of TAsmSection;
-         symbols   : tindexarray;
+         symbols   : tindexarray; { contains symbols that will be defined in object file }
          constructor create(const n:string);
          destructor  destroy;override;
          procedure createsection(sec:TSection);virtual;
          procedure defaulTSection(sec:TSection);
          function  sectionsize(s:TSection):longint;
          function  currsectionsize:longint;
-         procedure seTSectionsizes(var s:TAsmSectionSizes);virtual;
+         procedure setsectionsizes(var s:TAsmSectionSizes);virtual;
          procedure alloc(len:longint);
          procedure allocalign(len:longint);
          procedure writebytes(var data;len:longint);
@@ -147,52 +161,51 @@ interface
          procedure fixuprelocs;virtual;
        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;
-         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;
-       TAsmObjectDataclass = class of TAsmObjectAlloc;
 
 
     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
@@ -221,21 +234,11 @@ implementation
         typ:=_typ;
         inusedlist:=false;
         pass:=255;
+        ppuidx:=-1;
         { mainly used to remove unused labels from the codesegment }
         refs:=0;
       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;
       begin
         { reset section info }
@@ -275,10 +278,9 @@ implementation
                                  TAsmLabel
 *****************************************************************************}
 
-    constructor tasmlabel.create;
+    constructor tasmlabel.create(nr:longint);
       begin;
-        labelnr:=nextlabelnr;
-        inc(nextlabelnr);
+        labelnr:=nr;
         inherited create(target_asm.labelprefix+tostr(labelnr),AB_LOCAL,AT_FUNCTION);
         proclocal:=true;
         is_set:=false;
@@ -286,10 +288,9 @@ implementation
       end;
 
 
-    constructor tasmlabel.createdata;
+    constructor tasmlabel.createdata(nr:longint);
       begin;
-        labelnr:=nextlabelnr;
-        inc(nextlabelnr);
+        labelnr:=nr;
         if (cs_create_smart in aktmoduleswitches) or
            target_asm.labelprefix_only_inside_procedure then
           inherited create('_$'+current_module.modulename^+'$_L'+tostr(labelnr),AB_GLOBAL,AT_DATA)
@@ -301,9 +302,9 @@ implementation
         refs:=1;
       end;
 
-    constructor tasmlabel.createaddr;
+    constructor tasmlabel.createaddr(nr:longint);
       begin;
-        create;
+        create(nr);
         is_addr := true;
       end;
 
@@ -620,60 +621,98 @@ implementation
       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
         hp : tasmsymbol;
       begin
-        hp:=tasmsymbol(asmsymbollist.search(s));
+        hp:=tasmsymbol(symbolsearch.search(s));
         if not assigned(hp) then
          begin
            { Not found, insert it as an External }
            hp:=tasmsymbol.create(s,AB_EXTERNAL,AT_FUNCTION);
-           asmsymbollist.insert(hp);
+           symbolsearch.insert(hp);
          end;
         newasmsymbol:=hp;
       end;
 
 
-    function newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
+    function TAsmLibraryData.newasmsymboltype(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol;
       var
         hp : tasmsymbol;
       begin
-        hp:=tasmsymbol(asmsymbollist.search(s));
+        hp:=tasmsymbol(symbolsearch.search(s));
         if assigned(hp) then
          hp.defbind:=_bind
         else
          begin
            { Not found, insert it as an External }
            hp:=tasmsymbol.create(s,_bind,_typ);
-           asmsymbollist.insert(hp);
+           symbolsearch.insert(hp);
          end;
         newasmsymboltype:=hp;
       end;
 
 
-    function getasmsymbol(const s : string) : tasmsymbol;
+    function TAsmLibraryData.getasmsymbol(const s : string) : tasmsymbol;
       begin
-        getasmsymbol:=tasmsymbol(asmsymbollist.search(s));
+        getasmsymbol:=tasmsymbol(symbolsearch.search(s));
       end;
 
 
-    { renames an asmsymbol }
-    function renameasmsymbol(const sold, snew : string):tasmsymbol;
+    function TAsmLibraryData.renameasmsymbol(const sold, snew : string):tasmsymbol;
       begin
-        renameasmsymbol:=tasmsymbol(asmsymbollist.rename(sold,snew));
+        renameasmsymbol:=tasmsymbol(symbolsearch.rename(sold,snew));
       end;
 
 
-{*****************************************************************************
-                              Used AsmSymbolList
-*****************************************************************************}
-
-    procedure CreateUsedAsmSymbolList;
+    procedure TAsmLibraryData.CreateUsedAsmSymbolList;
       begin
         if assigned(usedasmsymbollist) then
          internalerror(78455782);
@@ -681,14 +720,14 @@ implementation
       end;
 
 
-    procedure DestroyUsedAsmSymbolList;
+    procedure TAsmLibraryData.DestroyUsedAsmSymbolList;
       begin
         usedasmsymbollist.destroy;
         usedasmsymbollist:=nil;
       end;
 
 
-    procedure UsedAsmSymbolListInsert(p:tasmsymbol);
+    procedure TAsmLibraryData.UsedAsmSymbolListInsert(p:tasmsymbol);
       begin
         if not p.inusedlist then
          usedasmsymbollist.insert(p);
@@ -696,7 +735,24 @@ implementation
       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
         hp : tasmsymbol;
       begin
@@ -713,7 +769,7 @@ implementation
       end;
 
 
-    procedure UsedAsmSymbolListResetAltSym;
+    procedure TAsmLibraryData.UsedAsmSymbolListResetAltSym;
       var
         hp : tasmsymbol;
       begin
@@ -730,7 +786,7 @@ implementation
       end;
 
 
-    procedure UsedAsmSymbolListCheckUndefined;
+    procedure TAsmLibraryData.UsedAsmSymbolListCheckUndefined;
       var
         hp : tasmsymbol;
       begin
@@ -749,30 +805,31 @@ implementation
       end;
 
 
-{*****************************************************************************
-                              Label Helpers
-*****************************************************************************}
-
-    procedure getlabel(var l : tasmlabel);
+    procedure TAsmLibraryData.getlabel(var l : tasmlabel);
       begin
-        l:=tasmlabel.create;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.create(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
 
 
-    procedure getdatalabel(var l : tasmlabel);
+    procedure TAsmLibraryData.getdatalabel(var l : tasmlabel);
       begin
-        l:=tasmlabel.createdata;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.createdata(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
 
-    procedure getaddrlabel(var l : tasmlabel);
+
+    procedure TAsmLibraryData.getaddrlabel(var l : tasmlabel);
       begin
-        l:=tasmlabel.createaddr;
-        asmsymbollist.insert(l);
+        l:=tasmlabel.createaddr(nextlabelnr);
+        inc(nextlabelnr);
+        symbolsearch.insert(l);
       end;
 
-    procedure getlabelnr(var l : longint);
+
+    procedure TAsmLibraryData.getlabelnr(var l : longint);
       begin
          l:=nextlabelnr;
          inc(nextlabelnr);
@@ -782,7 +839,16 @@ implementation
 end.
 {
   $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
 
   Revision 1.2  2002/07/07 09:52:32  florian

+ 24 - 15
compiler/aasmtai.pas

@@ -121,7 +121,7 @@ interface
           constructor Create;
        end;
 
-       {# Generates an assembler string } 
+       {# Generates an assembler string }
        tai_string = class(tai)
           str : pchar;
           { extra len so the string can contain an \0 }
@@ -150,7 +150,7 @@ interface
           constructor Createname(const _name : string);
        end;
 
-       {# Generates an assembler label } 
+       {# Generates an assembler label }
        tai_label = class(tai)
           is_global : boolean;
           l : tasmlabel;
@@ -226,8 +226,8 @@ interface
           constructor Create(_value : ts80real);
        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
           really supported on other processors.
        }
@@ -361,7 +361,7 @@ uses
       begin
          inherited Create;
          typ:=ait_datablock;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_DATA);
          { keep things aligned }
          if _size<=0 then
            _size:=4;
@@ -374,7 +374,7 @@ uses
       begin
          inherited Create;
          typ:=ait_datablock;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
          { keep things aligned }
          if _size<=0 then
            _size:=4;
@@ -400,7 +400,7 @@ uses
       begin
          inherited Create;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_FUNCTION);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_FUNCTION);
          size:=siz;
          is_global:=false;
       end;
@@ -409,7 +409,7 @@ uses
       begin
          inherited Create;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_FUNCTION);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_FUNCTION);
          size:=siz;
          is_global:=true;
       end;
@@ -418,7 +418,7 @@ uses
       begin
          inherited Create;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_LOCAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_LOCAL,AT_DATA);
          size:=siz;
          is_global:=false;
       end;
@@ -427,7 +427,7 @@ uses
       begin
          inherited Create;
          typ:=ait_symbol;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_DATA);
          size:=siz;
          is_global:=true;
       end;
@@ -448,7 +448,7 @@ uses
       begin
          inherited Create;
          typ:=ait_symbol_end;
-         sym:=newasmsymboltype(_name,AB_GLOBAL,AT_NONE);
+         sym:=current_library.newasmsymboltype(_name,AB_GLOBAL,AT_NONE);
       end;
 
 
@@ -519,7 +519,7 @@ uses
       begin
          inherited Create;
          typ:=ait_const_symbol;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=0;
          { update sym info }
          inc(sym.refs);
@@ -529,7 +529,7 @@ uses
       begin
          inherited Create;
          typ:=ait_const_symbol;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=ofs;
          { update sym info }
          inc(sym.refs);
@@ -539,7 +539,7 @@ uses
       begin
          inherited Create;
          typ:=ait_const_rva;
-         sym:=newasmsymbol(name);
+         sym:=current_library.newasmsymbol(name);
          offset:=0;
          { update sym info }
          inc(sym.refs);
@@ -983,7 +983,16 @@ uses
 end.
 {
   $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
     + first version include/exclude (can't test though, not enough scratch for i386 :()...
 

+ 42 - 31
compiler/assemble.pas

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

+ 13 - 4
compiler/cclasses.pas

@@ -87,7 +87,7 @@ interface
           procedure insertList(p : TLinkedList);
           { concats another List at the end and make this List empty }
           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.
           }
           procedure insertListcopy(p : TLinkedList);
@@ -188,7 +188,7 @@ interface
        private
          FRoot      : TNamedIndexItem;
          FHashArray : Pdictionaryhasharray;
-         procedure cleartree(obj:TNamedIndexItem);
+         procedure cleartree(var obj:TNamedIndexItem);
          function  insertNode(NewNode:TNamedIndexItem;var currNode:TNamedIndexItem):TNamedIndexItem;
          procedure inserttree(currtree,currroot:TNamedIndexItem);
        public
@@ -890,7 +890,7 @@ end;
       end;
 
 
-    procedure Tdictionary.cleartree(obj:TNamedIndexItem);
+    procedure Tdictionary.cleartree(var obj:TNamedIndexItem);
       begin
         if assigned(obj.Fleft) then
           cleartree(obj.FLeft);
@@ -1735,7 +1735,16 @@ end;
 end.
 {
   $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
 
   Revision 1.15  2002/07/01 18:46:21  peter

+ 15 - 6
compiler/cg64f32.pas

@@ -486,7 +486,7 @@ unit cg64f32;
                  got_scratch := true;
                  a_load64high_ref_reg(list,p.location.reference,hreg);
                end;
-             getlabel(poslabel);
+             current_library.getlabel(poslabel);
 
              { check high dword, must be 0 (for positive numbers) }
              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 }
              if from_signed and to_signed then
                begin
-                 getlabel(neglabel);
+                 current_library.getlabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,aword(-1),hreg,neglabel);
                end;
              { !!! freeing of register should happen directly after compare! (JM) }
@@ -518,7 +518,7 @@ unit cg64f32;
 
              if from_signed and to_signed then
                begin
-                 getlabel(endlabel);
+                 current_library.getlabel(endlabel);
                  cg.a_jmp_always(list,endlabel);
                  { if the high dword = $ffffffff, then the low dword (when }
                  { considered as a longint) must be < 0                    }
@@ -535,7 +535,7 @@ unit cg64f32;
                      a_load64low_ref_reg(list,p.location.reference,hreg);
                    end;
                  { 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);
                  { !!! freeing of register should happen directly after compare! (JM) }
                  if got_scratch then
@@ -593,7 +593,7 @@ unit cg64f32;
                    else
                      cg.a_load_ref_reg(list,opsize,p.location.reference,hreg);
                  end;
-               getlabel(poslabel);
+               current_library.getlabel(poslabel);
                cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel);
 
                { !!! freeing of register should happen directly after compare! (JM) }
@@ -617,7 +617,16 @@ begin
 end.
 {
   $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
 
   Revision 1.21  2002/07/20 11:57:52  florian

+ 15 - 14
compiler/cgbase.pas

@@ -232,7 +232,8 @@ implementation
         systems,
         cresstr,
         rgobj,
-        defbase
+        defbase,
+        fmodule
 {$ifdef fixLeaksOnError}
         ,comphook
 {$endif fixLeaksOnError}
@@ -432,15 +433,13 @@ implementation
          importssection:=nil;
          exportssection:=nil;
          resourcesection:=nil;
-         { assembler symbols }
-         asmsymbollist:=tdictionary.create;
-         asmsymbollist.usehash;
          { resourcestrings }
          ResourceStrings:=TResourceStrings.Create;
+         { use the librarydata from current_module }
+         current_library:=current_module.librarydata;
       end;
 
 
-
     procedure codegen_donemodule;
 {$ifdef MEMDEBUG}
       var
@@ -468,17 +467,10 @@ implementation
           resourcesection.free;
 {$ifdef MEMDEBUG}
          d.free;
-{$endif}
-         { assembler symbols }
-{$ifdef MEMDEBUG}
-         d:=tmemdebug.create('asmsymbol');
-{$endif}
-         asmsymbollist.free;
-{$ifdef MEMDEBUG}
-         d.free;
 {$endif}
          { resource strings }
          ResourceStrings.free;
+         current_library:=nil;
       end;
 
 
@@ -590,7 +582,16 @@ begin
 end.
 {
   $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
 
   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);
             a_op_const_reg(list,OP_SUB,aword(lto),hreg);
           end;
-        getlabel(neglabel);
+        current_library.getlabel(neglabel);
         a_cmp_const_reg_label(list,OS_INT,OC_BE,aword(hto-lto),hreg,neglabel);
         { !!! should happen right after the compare (JM) }
         free_scratch_reg(list,hreg);
@@ -1339,7 +1339,7 @@ unit cgobj;
            { must the object be finalized ? }
            if procinfo^._class.needs_inittable then
             begin
-              getlabel(nofinal);
+              current_library.getlabel(nofinal);
               reference_reset_base(href,procinfo^.framepointer,target_info.first_parm_offset);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               reference_reset_base(href,SELF_POINTER_REG,0);
@@ -1470,7 +1470,16 @@ finalization
 end.
 {
   $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
 
   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))
        else
          begin
-            getdatalabel(l1);
+            current_library.getdatalabel(l1);
             resourcestringlist.concat(tai_const_symbol.create(l1));
             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(hash));
        { Append the name as a ansistring. }
-       getdatalabel(l1);
+       current_library.getdatalabel(l1);
        L:=Length(Name);
        resourcestringlist.concat(tai_const_symbol.create(l1));
        consts.concat(tai_const.create_32bit(l));
@@ -294,7 +294,16 @@ end;
 end.
 {
   $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
     * reorganized aasm layer
 

+ 22 - 9
compiler/finput.pas

@@ -248,16 +248,16 @@ uses
         if is_macro then
          begin
            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;
            exit;
          end;
         if not closed then
          begin
-           if fileclose then;
+           fileclose;
            closed:=true;
          end;
         if assigned(buf) then
@@ -275,13 +275,17 @@ uses
          exit;
         if not closed then
          begin
-           if fileclose then;
-           Freemem(buf,maxbufsize);
-           buf:=nil;
+           fileclose;
+           if assigned(buf) then
+            begin
+              Freemem(buf,maxbufsize);
+              buf:=nil;
+            end;
            closed:=true;
          end;
       end;
 
+
     function tinputfile.tempopen:boolean;
       begin
         tempopen:=false;
@@ -698,7 +702,16 @@ uses
 end.
 {
   $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
 
   Revision 1.16  2002/07/01 18:46:22  peter

+ 22 - 2
compiler/fmodule.pas

@@ -39,7 +39,7 @@ interface
     uses
        cutils,cclasses,
        globals,finput,
-       symbase;
+       symbase,aasmbase;
 
     const
        maxunits = 1024;
@@ -124,6 +124,7 @@ interface
           locallibrarysearchpath : TSearchPathList;
 
           asmprefix     : pstring;  { prefix for the smartlink asmfiles }
+          librarydata   : tasmlibrarydata;   { librarydata for this module }
           constructor create(const s:string;_is_unit:boolean);
           destructor destroy;override;
           procedure reset;virtual;
@@ -411,6 +412,7 @@ uses
         imports:=TLinkedList.Create;
         _exports:=TLinkedList.Create;
         externals:=TLinkedList.Create;
+        librarydata:=tasmlibrarydata.create(realmodulename^);
       end;
 
 
@@ -469,6 +471,13 @@ uses
         localsymtable:=nil;
 {$ifdef MEMDEBUG}
         d.free;
+{$endif}
+{$ifdef MEMDEBUG}
+        d:=tmemdebug.create('librarydata');
+{$endif}
+        librarydata.free;
+{$ifdef MEMDEBUG}
+        d.free;
 {$endif}
         inherited Destroy;
       end;
@@ -497,6 +506,8 @@ uses
          end;
         sourcefiles.free;
         sourcefiles:=tinputfilemanager.create;
+        librarydata.free;
+        librarydata:=tasmlibrarydata.create(realmodulename^);
         imports.free;
         imports:=tlinkedlist.create;
         _exports.free;
@@ -584,7 +595,16 @@ uses
 end.
 {
   $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
   + try to fix temp allocation (still in ifdef)
   + generic constructor calls

+ 101 - 6
compiler/fppu.pas

@@ -56,6 +56,7 @@ interface
           procedure loadppu;
        private
           procedure load_interface;
+          procedure load_implementation;
           procedure load_symtable_refs;
           procedure load_usedunits;
           procedure writeusedmacro(p:TNamedIndexItem;arg:pointer);
@@ -63,10 +64,13 @@ interface
           procedure writesourcefiles;
           procedure writeusedunit;
           procedure writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
+          procedure putasmsymbol_in_idx(s:tnamedindexitem;arg:pointer);
+          procedure writeasmsymbols;
           procedure readusedmacros;
           procedure readsourcefiles;
           procedure readloadunit;
           procedure readlinkcontainer(var p:tlinkcontainer);
+          procedure readasmsymbols;
        end;
 
 
@@ -79,6 +83,7 @@ uses
   verbose,systems,version,
   symtable,
   scanner,
+  aasmbase,
   parser;
 
 
@@ -443,6 +448,37 @@ uses
       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;
       var
         hs : string;
@@ -619,6 +655,28 @@ uses
       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;
       var
         b : byte;
@@ -666,6 +724,30 @@ uses
       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;
       var
          b : byte;
@@ -754,6 +836,11 @@ uses
 
          { everything after this doesn't affect the crc }
          ppufile.do_crc:=false;
+
+         { write asmsymbols }
+         writeasmsymbols;
+
+         { end of implementation }
          ppufile.writeentry(ibendimplementation);
 
          { write static symtable
@@ -860,7 +947,6 @@ uses
         loaded_unit  : tmodule;
         load_refs    : boolean;
         nextmapentry : longint;
-        b            : byte;
       begin
         load_refs:=true;
         { init the map }
@@ -948,10 +1034,10 @@ uses
             end;
            pu:=tused_unit(pu.next);
          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 }
         if ((flags and uf_has_browser)<>0) and load_refs then
          begin
@@ -1173,7 +1259,16 @@ uses
 end.
 {
   $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
 
   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;
       begin
         currentasmlist:=self;
-        AsmSymbolList.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
+        current_library.symbolsearch.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
       end;
 
 
@@ -823,7 +823,16 @@ initialization
 end.
 {
   $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
 
   Revision 1.22  2002/07/01 18:46:29  peter

+ 11 - 2
compiler/i386/ag386nsm.pas

@@ -738,7 +738,7 @@ interface
     procedure T386NasmAssembler.WriteExternals;
       begin
         currentasmlist:=self;
-        AsmSymbolList.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
+        current_library.symbolsearch.foreach_static({$ifdef fpcprocvar}@{$endif}writeexternal,nil);
       end;
 
 
@@ -898,7 +898,16 @@ initialization
 end.
 {
   $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
 
   Revision 1.21  2002/07/01 18:46:29  peter

+ 18 - 9
compiler/i386/n386add.pas

@@ -289,7 +289,7 @@ interface
          begin
            if cs_check_overflow in aktlocalswitches  then
             begin
-              getlabel(hl4);
+              current_library.getlabel(hl4);
               if unsigned then
                emitjmp(C_NB,hl4)
               else
@@ -457,9 +457,9 @@ interface
             if isjump then
               begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
             secondpass(left);
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
@@ -475,9 +475,9 @@ interface
             if isjump then
               begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
             secondpass(right);
             maybe_restore(exprasmlist,left.location,pushedregs);
@@ -529,7 +529,7 @@ interface
                    andn :
                      begin
                         otl:=truelabel;
-                        getlabel(truelabel);
+                        current_library.getlabel(truelabel);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,truelabel);
@@ -538,7 +538,7 @@ interface
                    orn :
                      begin
                         ofl:=falselabel;
-                        getlabel(falselabel);
+                        current_library.getlabel(falselabel);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,falselabel);
@@ -1086,7 +1086,7 @@ interface
          begin
            if cs_check_overflow in aktlocalswitches  then
             begin
-              getlabel(hl4);
+              current_library.getlabel(hl4);
               if unsigned then
                emitjmp(C_NB,hl4)
               else
@@ -1551,7 +1551,16 @@ begin
 end.
 {
   $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
       a shl is moved from n386add/secondpass to nadd/resulttypepass
 

+ 24 - 15
compiler/i386/n386cal.pas

@@ -111,8 +111,8 @@ implementation
 
          otlabel:=truelabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
@@ -395,7 +395,7 @@ implementation
                  (po_iocheck in procdefinition.procoptions) and
                  not(po_iocheck in aktprocdef.procoptions) then
                 begin
-                   getaddrlabel(iolabel);
+                   current_library.getaddrlabel(iolabel);
                    cg.a_label(exprasmlist,iolabel);
                 end
               else
@@ -626,7 +626,7 @@ implementation
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                          else
                                            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);
                                            end;
                                          { 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_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(2));
                                     { 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));
                                     extended_new:=true;
                                  end;
@@ -697,7 +697,7 @@ implementation
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     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));
                                  end;
                                else
@@ -769,7 +769,7 @@ implementation
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                                 begin
                                                   { 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);
                                                   cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
                                                 end
@@ -825,7 +825,7 @@ implementation
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                       { 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));
                                     end
                                   { destructors haven't to dispose the instance, if this is }
@@ -956,7 +956,7 @@ implementation
                      begin
                         if (cs_check_object in aktlocalswitches) then
                           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_param_reg(exprasmlist,OS_ADDR,href.base,paramanager.getintparaloc(1));
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
@@ -1126,7 +1126,7 @@ implementation
            assigned(methodpointer) and
            (methodpointer.nodetype<>typen) then
            begin
-              getlabel(constructorfailed);
+              current_library.getlabel(constructorfailed);
               emitjmp(C_Z,constructorfailed);
               cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paramanager.getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
@@ -1355,8 +1355,8 @@ implementation
           oldexitlabel:=aktexitlabel;
           oldexit2label:=aktexit2label;
           oldquickexitlabel:=quickexitlabel;
-          getlabel(aktexitlabel);
-          getlabel(aktexit2label);
+          current_library.getlabel(aktexitlabel);
+          current_library.getlabel(aktexit2label);
           { we're inlining a procedure }
           inlining_procedure:=true;
           { save old procinfo }
@@ -1388,8 +1388,8 @@ implementation
 {$ifdef GDB}
           if (cs_debuginfo in aktmoduleswitches) then
             begin
-              getaddrlabel(startlabel);
-              getaddrlabel(endlabel);
+              current_library.getaddrlabel(startlabel);
+              current_library.getaddrlabel(endlabel);
               cg.a_label(exprasmlist,startlabel);
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
@@ -1481,7 +1481,16 @@ begin
 end.
 {
   $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
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added

+ 17 - 8
compiler/i386/n386cnv.pas

@@ -164,8 +164,8 @@ implementation
                 rg.ungetregisterint(exprasmlist,R_EDI);
                 reference_reset_base(href,R_ESP,0);
                 emit_ref(A_FILD,S_IQ,href);
-                getdatalabel(l1);
-                getlabel(l2);
+                current_library.getdatalabel(l1);
+                current_library.getlabel(l2);
                 emitjmp(C_Z,l2);
                 Consts.concat(Tai_label.Create(l1));
                 { I got this constant from a test progtram (FK) }
@@ -198,8 +198,8 @@ implementation
       begin
          oldtruelabel:=truelabel;
          oldfalselabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          if codegenerror then
           exit;
@@ -255,7 +255,7 @@ implementation
             LOC_JUMP :
               begin
                 hregister:=rg.getregisterint(exprasmlist);
-                getlabel(hlabel);
+                current_library.getlabel(hlabel);
                 cg.a_label(exprasmlist,truelabel);
                 cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister);
                 cg.a_jmp_always(exprasmlist,hlabel);
@@ -294,14 +294,14 @@ implementation
          { NIL must be accepted !! }
          emit_reg_reg(A_OR,S_L,r^.base,r^.base);
          rg.ungetregisterint(exprasmlist,R_EDI);
-         getlabel(nillabel);
+         current_library.getlabel(nillabel);
          emitjmp(C_E,nillabel);
          { this is one point where we need vmt_offset (PM) }
          r^.offset:= tobjectdef(tpointerdef(p^.resulttype.def).definition).vmt_offset;
          rg.getexplicitregisterint(exprasmlist,R_EDI);
          emit_ref_reg(A_MOV,S_L,r,R_EDI);
          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);
          rg.ungetregister32(exprasmlist,R_EDI);
          emitcall('FPC_CHECK_OBJECT_EXT');
@@ -365,7 +365,16 @@ begin
 end.
 {
   $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()
     * tcg.flags2xxx() now also needs a size parameter
 

+ 36 - 27
compiler/i386/n386flw.pas

@@ -90,7 +90,7 @@ implementation
                 end
               else
                 begin
-                   getaddrlabel(a);
+                   current_library.getaddrlabel(a);
                    cg.a_label(exprasmlist,a);
                    cg.a_param_reg(exprasmlist,OS_INT,R_EBP,paramanager.getintparaloc(2));
                    emit_sym(A_PUSH,S_L,a);
@@ -185,20 +185,20 @@ implementation
            end;
 
          { get new labels for the control flow statements }
-         getlabel(exittrylabel);
-         getlabel(exitexceptlabel);
+         current_library.getlabel(exittrylabel);
+         current_library.getlabel(exitexceptlabel);
          if assigned(aktbreaklabel) then
            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;
 
-         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,12,tempaddr);
@@ -275,8 +275,8 @@ implementation
 
               { the destruction of the exception object must be also }
               { 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,12,tempaddr);
@@ -422,11 +422,11 @@ implementation
       begin
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[];
-         getlabel(nextonlabel);
+         current_library.getlabel(nextonlabel);
 
          { push the vmt }
          emit_sym(A_PUSH,S_L,
-           newasmsymbol(excepttype.vmt_mangledname));
+           current_library.newasmsymbol(excepttype.vmt_mangledname));
          cg.a_call_name(exprasmlist,'FPC_CATCHES');
          { allocate eax }
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
@@ -445,7 +445,7 @@ implementation
 
          { in the case that another exception is risen }
          { we've to destroy the old one                }
-         getlabel(doobjectdestroyandreraise);
+         current_library.getlabel(doobjectdestroyandreraise);
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
@@ -468,15 +468,15 @@ implementation
            begin
               oldaktexitlabel:=aktexitlabel;
               oldaktexit2label:=aktexit2label;
-              getlabel(exitonlabel);
+              current_library.getlabel(exitonlabel);
               aktexitlabel:=exitonlabel;
               aktexit2label:=exitonlabel;
               if assigned(aktbreaklabel) then
                begin
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktbreaklabel:=aktbreaklabel;
-                 getlabel(breakonlabel);
-                 getlabel(continueonlabel);
+                 current_library.getlabel(breakonlabel);
+                 current_library.getlabel(continueonlabel);
                  aktcontinuelabel:=continueonlabel;
                  aktbreaklabel:=breakonlabel;
                end;
@@ -485,7 +485,7 @@ implementation
               cg.g_maybe_loadself(exprasmlist);
               secondpass(right);
            end;
-         getlabel(doobjectdestroy);
+         current_library.getlabel(doobjectdestroy);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
          cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
          tg.ungetpersistanttempreference(exprasmlist,tempaddr);
@@ -580,23 +580,23 @@ implementation
          flowcontrol:=[];
          { we modify 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 }
          { statements                                            }
          oldaktexitlabel:=aktexitlabel;
          oldaktexit2label:=aktexit2label;
-         getlabel(exitfinallylabel);
+         current_library.getlabel(exitfinallylabel);
          aktexitlabel:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          if assigned(aktbreaklabel) then
           begin
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktbreaklabel:=aktbreaklabel;
-            getlabel(breakfinallylabel);
-            getlabel(continuefinallylabel);
+            current_library.getlabel(breakfinallylabel);
+            current_library.getlabel(continuefinallylabel);
             aktcontinuelabel:=continuefinallylabel;
             aktbreaklabel:=breakfinallylabel;
           end;
@@ -726,7 +726,16 @@ begin
 end.
 {
   $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
 
   Revision 1.29  2002/07/07 09:52:34  florian

+ 17 - 8
compiler/i386/n386mat.pas

@@ -138,7 +138,7 @@ implementation
                         begin
                           { a jump, but less operations }
                           emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
-                          getlabel(hl);
+                          current_library.getlabel(hl);
                           emitjmp(C_NS,hl);
                           if power=1 then
                             emit_reg(A_INC,S_L,hreg1)
@@ -396,9 +396,9 @@ implementation
                    { so we've to do some tricks here                           }
                    if nodetype=shln then
                      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);
                         emitjmp(C_L,l1);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
@@ -422,9 +422,9 @@ implementation
                      end
                    else
                      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);
                         emitjmp(C_L,l1);
                         emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
@@ -830,7 +830,16 @@ begin
 end.
 {
   $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
     * add nodes now can also evaluate constant expressions at compile time
       that contain nil nodes

+ 13 - 4
compiler/i386/n386mem.pas

@@ -380,9 +380,9 @@ implementation
               if isjump then
                begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
                end;
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               secondpass(right);
@@ -406,7 +406,7 @@ implementation
                         firstpass(hightree);
                         secondpass(hightree);
                         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);
                         hightree.free;
                         hightree:=nil;
@@ -507,7 +507,16 @@ begin
 end.
 {
   $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
     + dummy tcgvecnode
 

+ 11 - 2
compiler/i386/n386obj.pas

@@ -216,7 +216,7 @@ begin
   { case 0 }
   else
     begin
-      lab:=newasmsymbol(procdef.mangledname);
+      lab:=current_library.newasmsymbol(procdef.mangledname);
       emit_sym(A_JMP,S_NO,lab);
     end;
   exprasmlist:=oldexprasmlist;
@@ -228,7 +228,16 @@ initialization
 end.
 {
   $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
 
   Revision 1.12  2002/07/16 15:34:21  florian

+ 11 - 2
compiler/i386/n386opt.pas

@@ -142,7 +142,7 @@ begin
   if checklength then
     begin
       { is it already maximal? }
-      getlabel(l);
+      current_library.getlabel(l);
       if tg.istemp(left.location.reference) then
         len:=255
       else
@@ -248,7 +248,16 @@ end.
 
 {
   $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
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added

+ 21 - 12
compiler/i386/n386set.pas

@@ -255,7 +255,7 @@ implementation
             else
               location.resflags:=F_E;
 
-            getlabel(l);
+            current_library.getlabel(l);
 
             { how much have we already substracted from the x in the }
             { "x in [y..z]" expression                               }
@@ -438,8 +438,8 @@ implementation
                if right.location.loc=LOC_CONSTANT then
                 begin
                   location.resflags:=F_C;
-                  getlabel(l);
-                  getlabel(l2);
+                  current_library.getlabel(l);
+                  current_library.getlabel(l2);
 
                   { Is this treated in firstpass ?? }
                   if left.nodetype=ordconstn then
@@ -614,7 +614,7 @@ implementation
                begin
                   if opsize=S_Q then
                     begin
-                       getlabel(l1);
+                       current_library.getlabel(l1);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                        emitjmp(C_NZ,l1);
                        emit_const_reg(A_CMP,S_L,longint(lo(int64(t^._low))),hregister);
@@ -637,7 +637,7 @@ implementation
                     begin
                        if opsize=S_Q then
                          begin
-                            getlabel(l1);
+                            current_library.getlabel(l1);
                             emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._low))),hregister2);
                             emitjmp(jmp_le,elselabel);
                             emitjmp(jmp_gt,l1);
@@ -655,7 +655,7 @@ implementation
 
                   if opsize=S_Q then
                     begin
-                       getlabel(l1);
+                       current_library.getlabel(l1);
                        emit_const_reg(A_CMP,S_L,longint(hi(int64(t^._high))),hregister2);
                        emitjmp(jmp_le,t^.statement);
                        emitjmp(jmp_gt,l1);
@@ -797,7 +797,7 @@ implementation
                 emit_const_reg(A_CMP,opsize,longint(max_),hregister);
                 emitjmp(jmp_gt,elselabel);
              end;
-           getlabel(table);
+           current_library.getlabel(table);
            { extend with sign }
            if opsize=S_W then
              begin
@@ -850,8 +850,8 @@ implementation
          dist : dword;
 {$endif Delphi}
       begin
-         getlabel(endlabel);
-         getlabel(elselabel);
+         current_library.getlabel(endlabel);
+         current_library.getlabel(elselabel);
          if (cs_create_smart in aktmoduleswitches) then
            jumpsegment:=procinfo^.aktlocaldata
          else
@@ -875,9 +875,9 @@ implementation
          if left.location.loc=LOC_JUMP then
           begin
             otl:=truelabel;
-            getlabel(truelabel);
+            current_library.getlabel(truelabel);
             ofl:=falselabel;
-            getlabel(falselabel);
+            current_library.getlabel(falselabel);
             isjump:=true;
           end;
          secondpass(left);
@@ -1023,7 +1023,16 @@ begin
 end.
 {
   $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 []'
 
   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(
                     strpnew('previous label inserted'))));
   {$endif finaldestdebug}
-                  getlabel(l);
+                  current_library.getlabel(l);
                   insertllitem(asml,p1,p1.next,Tai_label.Create(l));
                   dec(tasmlabel(Taicpu(hp).oper[0].sym).refs);
                   hp.oper[0].sym := l;
@@ -2044,7 +2044,16 @@ End.
 
 {
   $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
 
   Revision 1.29  2002/07/01 18:46:34  peter

+ 12 - 3
compiler/i386/ra386att.pas

@@ -1275,7 +1275,7 @@ begin
    begin
      opr.typ:=OPR_SYMBOL;
      opr.symofs:=l;
-     opr.symbol:=newasmsymbol(tempstr);
+     opr.symbol:=current_library.newasmsymbol(tempstr);
    end
   else
    begin
@@ -1543,7 +1543,7 @@ Begin
                           Begin
                             { not found, finally ... add it anyways ... }
                             Message1(asmr_w_id_supposed_external,expr);
-                            opr.ref.symbol:=newasmsymbol(expr);
+                            opr.ref.symbol:=current_library.newasmsymbol(expr);
                           end;
                        end
                     else
@@ -2129,7 +2129,16 @@ finalization
 end.
 {
   $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
 
   Revision 1.25  2002/07/01 18:46:34  peter

+ 12 - 3
compiler/i386/ra386int.pas

@@ -1254,7 +1254,7 @@ Begin
              if GotStar then
               Message(asmr_e_only_add_relocatable_symbol);
              if not assigned(opr.ref.symbol) then
-              opr.ref.symbol:=newasmsymbol(tempstr)
+              opr.ref.symbol:=current_library.newasmsymbol(tempstr)
              else
               Message(asmr_e_cant_have_multiple_relocatable_symbols);
            end;
@@ -1310,7 +1310,7 @@ begin
    begin
      opr.typ:=OPR_SYMBOL;
      opr.symofs:=l;
-     opr.symbol:=newasmsymbol(tempstr);
+     opr.symbol:=current_library.newasmsymbol(tempstr);
    end
   else
    begin
@@ -1959,7 +1959,16 @@ finalization
 end.
 {
   $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
     * reorganized aasm layer
 

+ 15 - 6
compiler/m68k/rasm.pas

@@ -1618,7 +1618,7 @@ var
                           l:=instr.operands[operandnum]^.opr.val;
                           instr.operands[operandnum]^.opr.typ := OPR_SYMBOL;
                           instr.operands[operandnum]^.opr.symofs := l;
-                          instr.operands[operandnum]^.opr.symbol := newasmsymbol(tempstr);
+                          instr.operands[operandnum]^.opr.symbol := current_library.newasmsymbol(tempstr);
                         end;
                  end;
    { // Constant memory offset .              // }
@@ -1715,7 +1715,7 @@ var
                             Begin
                              if getasmsymbol(actasmpattern) =nil then
                                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
                            else
                              Message(asmr_e_syntax_error);
@@ -2218,16 +2218,25 @@ Begin
 end.
 {
   $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
 
   Revision 1.1.2.7  2001/08/09 11:41:08  pierre
    + add more errors
 
   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
 
   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
               begin
                 { generatealtsymbol will also increase the refs }
-                p.GenerateAltSymbol;
-                UsedAsmSymbolListInsert(p);
+                current_library.GenerateAltSymbol(p);
               end
              else
               begin
@@ -136,7 +135,7 @@ interface
       begin
          if inlining_procedure then
            begin
-             CreateUsedAsmSymbolList;
+             current_library.CreateUsedAsmSymbolList;
              localfixup:=aktprocdef.localst.address_fixup;
              parafixup:=aktprocdef.parast.address_fixup;
              hp:=tai(p_asm.first);
@@ -204,8 +203,8 @@ interface
                 hp:=tai(hp.next);
               end;
              { restore used symbols }
-             UsedAsmSymbolListResetAltSym;
-             DestroyUsedAsmSymbolList;
+             current_library.UsedAsmSymbolListResetAltSym;
+             current_library.DestroyUsedAsmSymbolList;
            end
          else
            begin
@@ -294,7 +293,16 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 24 - 15
compiler/ncgcal.pas

@@ -106,8 +106,8 @@ implementation
 
          otlabel:=truelabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
@@ -390,7 +390,7 @@ implementation
                  (po_iocheck in procdefinition.procoptions) and
                  not(po_iocheck in aktprocdef.procoptions) then
                 begin
-                   getaddrlabel(iolabel);
+                   current_library.getaddrlabel(iolabel);
                    cg.a_label(exprasmlist,iolabel);
                 end
               else
@@ -627,7 +627,7 @@ implementation
                                            cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
                                          else
                                            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);
                                            end;
                                          { 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_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
                                     { 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);
                                     extended_new:=true;
                                  end;
@@ -698,7 +698,7 @@ implementation
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     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);
                                  end;
                                else
@@ -770,7 +770,7 @@ implementation
                                               if (procdefinition.proctypeoption=potype_constructor) then
                                                 begin
                                                   { 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);
                                                   cg.a_paramaddr_ref(exprasmlist,href,1);
                                                 end
@@ -826,7 +826,7 @@ implementation
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                       { 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);
                                     end
                                   { destructors haven't to dispose the instance, if this is }
@@ -958,7 +958,7 @@ implementation
                      begin
                         if (cs_check_object in aktlocalswitches) then
                           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_param_reg(exprasmlist,OS_ADDR,href.base,1);
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
@@ -1135,7 +1135,7 @@ implementation
            assigned(methodpointer) and
            (methodpointer.nodetype<>typen) then
            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_param_reg(exprasmlist,OS_ADDR,accumulator,paramanager.getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
@@ -1374,8 +1374,8 @@ implementation
           oldexitlabel:=aktexitlabel;
           oldexit2label:=aktexit2label;
           oldquickexitlabel:=quickexitlabel;
-          getlabel(aktexitlabel);
-          getlabel(aktexit2label);
+          current_library.getlabel(aktexitlabel);
+          current_library.getlabel(aktexit2label);
           { we're inlining a procedure }
           inlining_procedure:=true;
           { save old procinfo }
@@ -1407,8 +1407,8 @@ implementation
 {$ifdef GDB}
           if (cs_debuginfo in aktmoduleswitches) then
             begin
-              getaddrlabel(startlabel);
-              getaddrlabel(endlabel);
+              current_library.getaddrlabel(startlabel);
+              current_library.getaddrlabel(endlabel);
               cg.a_label(exprasmlist,startlabel);
               inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
               inlineprocdef.parast.symtabletype:=inlineparasymtable;
@@ -1500,7 +1500,16 @@ begin
 end.
 {
   $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
 
   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
                 begin
                   reference_reset(hr);
-                  hr.symbol:=newasmsymbol('FPC_EMPTYCHAR');
+                  hr.symbol:=current_library.newasmsymbol('FPC_EMPTYCHAR');
                   location.register:=rg.getregisterint(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
@@ -141,7 +141,7 @@ interface
                   (str_length(left)=0) then
                 begin
                   reference_reset(hr);
-                  hr.symbol:=newasmsymbol('FPC_EMPTYCHAR');
+                  hr.symbol:=current_library.newasmsymbol('FPC_EMPTYCHAR');
                   location.register:=rg.getregisterint(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
@@ -291,8 +291,8 @@ interface
       begin
          oldtruelabel:=truelabel;
          oldfalselabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          secondpass(left);
          location_copy(location,left.location);
          { byte(boolean) or word(wordbool) or longint(longbool) must }
@@ -328,7 +328,7 @@ interface
          hr : treference;
       begin
          location_reset(location,LOC_REGISTER,OS_ADDR);
-         getlabel(l1);
+         current_library.getlabel(l1);
          case left.location.loc of
             LOC_CREGISTER,LOC_REGISTER:
               location.register:=left.location.register;
@@ -343,7 +343,7 @@ interface
          end;
          cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_NE,0,location.register,l1);
          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_label(exprasmlist,l1);
       end;
@@ -372,7 +372,7 @@ interface
             else
               internalerror(121120001);
          end;
-         getlabel(l1);
+         current_library.getlabel(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(
            tobjectdef(left.resulttype.def).implementedinterfaces.ioffsets(
@@ -490,7 +490,16 @@ end.
 
 {
   $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
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added

+ 18 - 9
compiler/ncgcon.pas

@@ -123,7 +123,7 @@ implementation
              { :-(, we must generate a new entry }
              if not assigned(lab_real) then
                begin
-                  getdatalabel(lastlabel);
+                  current_library.getdatalabel(lastlabel);
                   lab_real:=lastlabel;
                   if (cs_create_smart in aktmoduleswitches) then
                    Consts.concat(Tai_cut.Create);
@@ -299,7 +299,7 @@ implementation
               { :-(, we must generate a new entry }
               if not assigned(lab_str) then
                 begin
-                   getdatalabel(lastlabel);
+                   current_library.getdatalabel(lastlabel);
                    lab_str:=lastlabel;
                    if (cs_create_smart in aktmoduleswitches) then
                     Consts.concat(Tai_cut.Create);
@@ -313,8 +313,8 @@ implementation
                              Consts.concat(Tai_const.Create_32bit(0))
                            else
                              begin
-                                getdatalabel(l1);
-                                getdatalabel(l2);
+                                current_library.getdatalabel(l1);
+                                current_library.getdatalabel(l2);
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_const_symbol.Create(l1));
                                 Consts.concat(Tai_const.Create_32bit(len));
@@ -338,8 +338,8 @@ implementation
                              Consts.concat(Tai_const.Create_32bit(0))
                            else
                              begin
-                                getdatalabel(l1);
-                                getdatalabel(l2);
+                                current_library.getdatalabel(l1);
+                                current_library.getdatalabel(l2);
                                 Consts.concat(Tai_label.Create(l2));
                                 Consts.concat(Tai_const_symbol.Create(l1));
 
@@ -460,7 +460,7 @@ implementation
              { :-(, we must generate a new entry }
              if not assigned(lab_set) then
                begin
-                 getdatalabel(lastlabel);
+                 current_library.getdatalabel(lastlabel);
                  lab_set:=lastlabel;
                  if (cs_create_smart in aktmoduleswitches) then
                   Consts.concat(Tai_cut.Create);
@@ -503,7 +503,7 @@ implementation
       begin
         location_reset(location,LOC_CREFERENCE,OS_NO);
         { label for GUID }
-        getdatalabel(tmplabel);
+        current_library.getdatalabel(tmplabel);
         consts.concat(Tai_label.Create(tmplabel));
         consts.concat(Tai_const.Create_32bit(value.D1));
         consts.concat(Tai_const.Create_16bit(value.D2));
@@ -525,7 +525,16 @@ begin
 end.
 {
   $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
 
   Revision 1.15  2002/07/23 12:34:30  daniel

+ 68 - 59
compiler/ncgflw.pas

@@ -66,7 +66,7 @@ interface
        tcgfailnode = class(tfailnode)
           procedure pass_2;override;
        end;
-       
+
        tcgraisenode = class(traisenode)
           procedure pass_2;override;
        end;
@@ -83,7 +83,7 @@ interface
           procedure pass_2;override;
        end;
 
-       
+
 
 implementation
 
@@ -109,9 +109,9 @@ implementation
          otlabel,oflabel : tasmlabel;
 
       begin
-         getlabel(lloop);
-         getlabel(lcont);
-         getlabel(lbreak);
+         current_library.getlabel(lloop);
+         current_library.getlabel(lcont);
+         current_library.getlabel(lbreak);
          { arrange continue and breaklabels: }
          oldclabel:=aktcontinuelabel;
          oldblabel:=aktbreaklabel;
@@ -182,8 +182,8 @@ implementation
       begin
          otlabel:=truelabel;
          oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
+         current_library.getlabel(truelabel);
+         current_library.getlabel(falselabel);
          rg.cleartempgen;
          secondpass(left);
 
@@ -221,7 +221,7 @@ implementation
            begin
               if assigned(right) then
                 begin
-                   getlabel(hl);
+                   current_library.getlabel(hl);
                    { do go back to if line !! }
                    if not(cs_regalloc in aktglobalswitches) then
                      aktfilepos:=exprasmList.getlasttaifilepos^
@@ -307,9 +307,9 @@ implementation
       begin
          oldclabel:=aktcontinuelabel;
          oldblabel:=aktbreaklabel;
-         getlabel(aktcontinuelabel);
-         getlabel(aktbreaklabel);
-         getlabel(l3);
+         current_library.getlabel(aktcontinuelabel);
+         current_library.getlabel(aktbreaklabel);
+         current_library.getlabel(l3);
 
          { only calculate reference }
          rg.cleartempgen;
@@ -476,8 +476,8 @@ implementation
               allocated_acchigh := false;
               otlabel:=truelabel;
               oflabel:=falselabel;
-              getlabel(truelabel);
-              getlabel(falselabel);
+              current_library.getlabel(truelabel);
+              current_library.getlabel(falselabel);
               secondpass(left);
               { the result of left is not needed anymore after this
                 node }
@@ -664,7 +664,7 @@ do_jmp:
                 end
               else
                 begin
-                   getaddrlabel(a);
+                   current_library.getaddrlabel(a);
                    cg.a_label(exprasmlist,a);
                    reference_reset_symbol(href2,a,0);
                    cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(2));
@@ -691,8 +691,8 @@ do_jmp:
 
     var
        endexceptlabel : tasmlabel;
-       
-       
+
+
     procedure try_new_exception(list : taasmoutput;var jmpbuf,envbuf, href : treference;
       a : aword; exceptlabel : tasmlabel);
      begin
@@ -701,8 +701,8 @@ do_jmp:
        tg.gettempofsizereferencepersistant(list,sizeof(aword),href);
        new_exception(list, jmpbuf,envbuf, href, a, exceptlabel);
      end;
-     
-     
+
+
     procedure try_free_exception(list : taasmoutput;var jmpbuf, envbuf, href : treference;
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      begin
@@ -710,8 +710,8 @@ do_jmp:
          tg.ungetpersistanttempreference(list,jmpbuf);
          tg.ungetpersistanttempreference(list,envbuf);
      end;
-     
-     
+
+
 
     { does the necessary things to clean up the object stack }
     { in the except block                                    }
@@ -765,23 +765,23 @@ do_jmp:
            end;
 
          { get new labels for the control flow statements }
-         getlabel(exittrylabel);
-         getlabel(exitexceptlabel);
+         current_library.getlabel(exittrylabel);
+         current_library.getlabel(exitexceptlabel);
          if assigned(aktbreaklabel) then
            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;
 
-         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 block }
          { set control flow labels for the try block }
          aktexitlabel:=exittrylabel;
@@ -800,10 +800,10 @@ do_jmp:
 
          cg.a_label(exprasmlist,exceptlabel);
 
-                 
+
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,endexceptlabel,false);
-         
-         
+
+
          cg.a_label(exprasmlist,doexceptlabel);
 
          { set control flow labels for the except block }
@@ -834,9 +834,9 @@ do_jmp:
 
               { the destruction of the exception object must be also }
               { 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);
 
               { here we don't have to reset flowcontrol           }
@@ -845,7 +845,7 @@ do_jmp:
               exceptflowcontrol:=flowcontrol;
 
               cg.a_label(exprasmlist,doobjectdestroyandreraise);
-              
+
               try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
 
               cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
@@ -966,13 +966,13 @@ do_jmp:
       begin
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[];
-         getlabel(nextonlabel);
+         current_library.getlabel(nextonlabel);
 
          { 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_call_name(exprasmlist,'FPC_CATCHES');
-         
+
          { is it this catch? No. go to next onlabel }
          cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,accumulator,nextonlabel);
          ref.symbol:=nil;
@@ -982,28 +982,28 @@ do_jmp:
          if assigned(exceptsymtable) then
            tvarsym(exceptsymtable.symindex.first).address:=ref.offset;
          cg.a_load_reg_ref(exprasmlist, OS_ADDR, accumulator, ref);
-         
+
 
          { in the case that another exception is risen }
          { we've to destroy the old one                }
-         getlabel(doobjectdestroyandreraise);
-         
+         current_library.getlabel(doobjectdestroyandreraise);
+
          { call setjmp, and jump to finally label on non-zero result }
          try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,doobjectdestroyandreraise);
-         
+
          if assigned(right) then
            begin
               oldaktexitlabel:=aktexitlabel;
               oldaktexit2label:=aktexit2label;
-              getlabel(exitonlabel);
+              current_library.getlabel(exitonlabel);
               aktexitlabel:=exitonlabel;
               aktexit2label:=exitonlabel;
               if assigned(aktbreaklabel) then
                begin
                  oldaktcontinuelabel:=aktcontinuelabel;
                  oldaktbreaklabel:=aktbreaklabel;
-                 getlabel(breakonlabel);
-                 getlabel(continueonlabel);
+                 current_library.getlabel(breakonlabel);
+                 current_library.getlabel(continueonlabel);
                  aktcontinuelabel:=continueonlabel;
                  aktbreaklabel:=breakonlabel;
                end;
@@ -1012,9 +1012,9 @@ do_jmp:
               cg.g_maybe_loadself(exprasmlist);
               secondpass(right);
            end;
-         getlabel(doobjectdestroy);
+         current_library.getlabel(doobjectdestroy);
          cg.a_label(exprasmlist,doobjectdestroyandreraise);
-         
+
          try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
 
          cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
@@ -1098,23 +1098,23 @@ do_jmp:
          { check if child nodes do a break/continue/exit }
          oldflowcontrol:=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 }
          { statements                                            }
          oldaktexitlabel:=aktexitlabel;
          oldaktexit2label:=aktexit2label;
-         getlabel(exitfinallylabel);
+         current_library.getlabel(exitfinallylabel);
          aktexitlabel:=exitfinallylabel;
          aktexit2label:=exitfinallylabel;
          if assigned(aktbreaklabel) then
           begin
             oldaktcontinuelabel:=aktcontinuelabel;
             oldaktbreaklabel:=aktbreaklabel;
-            getlabel(breakfinallylabel);
-            getlabel(continuefinallylabel);
+            current_library.getlabel(breakfinallylabel);
+            current_library.getlabel(continuefinallylabel);
             aktcontinuelabel:=continuefinallylabel;
             aktbreaklabel:=breakfinallylabel;
           end;
@@ -1142,9 +1142,9 @@ do_jmp:
            CGMessage(cg_e_control_flow_outside_finally);
          if codegenerror then
            exit;
-    
+
          { 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_op_const_reg(exprasmlist,OP_SUB,1,accumulator);
          cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,accumulator,reraiselabel);
@@ -1226,7 +1226,16 @@ begin
 end.
 {
   $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
 
   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_incdec;virtual;
           procedure second_typeinfo;virtual;
-          procedure second_includeexclude;virtual; 
+          procedure second_includeexclude;virtual;
           procedure second_pi; virtual;
           procedure second_arctan_real; virtual;
           procedure second_abs_real; virtual;
@@ -184,8 +184,8 @@ implementation
           internalerror(7123458);
        otlabel:=truelabel;
        oflabel:=falselabel;
-       getlabel(truelabel);
-       getlabel(falselabel);
+       current_library.getlabel(truelabel);
+       current_library.getlabel(falselabel);
        secondpass(tcallparanode(left).left);
        maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
        cg.a_label(exprasmlist,falselabel);
@@ -227,7 +227,7 @@ implementation
         if left.nodetype=typen then
           begin
             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);
           end
         else
@@ -269,7 +269,7 @@ implementation
             begin
               location_force_reg(exprasmlist,left.location,OS_ADDR,false);
               hregister:=left.location.register;
-              getlabel(lengthlab);
+              current_library.getlabel(lengthlab);
               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,lengthlab);
               reference_reset_base(href,hregister,-8);
               cg.a_load_ref_reg(exprasmlist,OS_32,href,hregister);
@@ -429,7 +429,7 @@ implementation
             end
           else
             begin
-              getlabel(ptrvalidlabel);
+              current_library.getlabel(ptrvalidlabel);
               cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg);
               cg.a_cmp_const_ref_label(exprasmlist, OS_ADDR, OC_NE, 0,
                   tcallparanode(left).left.location.reference, ptrvalidlabel);
@@ -490,24 +490,24 @@ implementation
             begin
              use_small:=
                  { set type }
-                 (tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset) 
+                 (tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset)
                   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
-                   (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));
-            
+
               { generate code for the element to set }
               maybe_save(exprasmlist,tcallparanode(tcallparanode(left).right).left.registers32,
                         tcallparanode(left).left.location,pushedregs);
               secondpass(tcallparanode(tcallparanode(left).right).left);
               maybe_restore(exprasmlist,tcallparanode(left).left.location,pushedregs);
-              
+
               { bitnumber - which must be loaded into register }
               hregister := cg.get_scratch_reg_int(exprasmlist);
               hregister2 := rg.getregisterint(exprasmlist);
-              
+
               case tcallparanode(tcallparanode(left).right).left.location.loc of
                  LOC_CREGISTER,
                  LOC_REGISTER:
@@ -527,11 +527,11 @@ implementation
                { hregister contains the bitnumber to add }
                cg.a_load_const_reg(exprasmlist, OS_INT, 1, hregister2);
                cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_INT, hregister, hregister2);
-              
-              
+
+
               if use_small then
                 begin
-                  { possiblities : 
+                  { possiblities :
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        set value : LOC_REFERENCE, LOC_REGISTER
                   }
@@ -540,24 +540,24 @@ implementation
                     begin
                      if inlinenumber=in_include_x_y then
                        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);
                        end
                      else
                        begin
-                         cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, hregister2, 
+                         cg.a_op_reg_reg(exprasmlist, OP_NOT, OS_32, 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);
                        end;
-                      
+
                     end
                   else
                     internalerror(20020728);
                 end
               else
                 begin
-                  { possiblities : 
+                  { possiblities :
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        set value : LOC_REFERENCE
                   }
@@ -568,7 +568,7 @@ implementation
                   cg.a_loadaddr_ref_reg(exprasmlist, tcallparanode(left).left.location.reference,addrreg);
                   cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_INT, hregister, addrreg);
                   reference_reset_base(href,addrreg,0);
-                  
+
                   if inlinenumber=in_include_x_y then
                        begin
                          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_ref(exprasmlist, OP_AND, OS_32, hregister2, href);
                        end;
-                       
+
                   cg.free_scratch_reg(exprasmlist, addrreg);
                 end;
                 cg.free_scratch_reg(exprasmlist,hregister);
-                rg.ungetregisterint(exprasmlist,hregister2); 
+                rg.ungetregisterint(exprasmlist,hregister2);
             end;
         end;
 
@@ -641,7 +641,16 @@ end.
 
 {
   $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
     + 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;
                    end
                   else
-                   location.reference.symbol:=newasmsymbol(tabsolutesym(symtableentry).mangledname);
+                   location.reference.symbol:=current_library.newasmsymbol(tabsolutesym(symtableentry).mangledname);
                end;
             constsym:
               begin
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                    begin
                       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;
                    end
                  else
@@ -111,13 +111,13 @@ implementation
                   { C variable }
                   if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
                     begin
-                       location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                     end
                   { DLL variable }
                   else if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
                     begin
                        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);
                        location.reference.symbol:=nil;
                        location.reference.base:=hregister;
@@ -125,7 +125,7 @@ implementation
                   { external variable }
                   else if (vo_is_external in tvarsym(symtableentry).varoptions) then
                     begin
-                       location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                       location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                     end
                   { thread variable }
                   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 }
                        location.reference.base:=rg.getaddressregister(exprasmlist);
                        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));
                        { the called procedure isn't allowed to change }
                        { any register except EAX                    }
@@ -215,7 +215,7 @@ implementation
                                  globalsymtable,
                                  staticsymtable :
                                    begin
-                                     location.reference.symbol:=newasmsymbol(tvarsym(symtableentry).mangledname);
+                                     location.reference.symbol:=current_library.newasmsymbol(tvarsym(symtableentry).mangledname);
                                    end;
                                  stt_exceptsymtable:
                                    begin
@@ -225,7 +225,7 @@ implementation
                                  objectsymtable:
                                    begin
                                       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
                                         begin
                                            rg.getexplicitregisterint(exprasmlist,SELF_POINTER_REG);
@@ -352,7 +352,7 @@ implementation
                             if freereg then
                              rg.ungetregisterint(exprasmlist,hregister);
                             { 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);
                             cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
                             cg.a_load_reg_ref(exprasmlist,OS_ADDR,hregister,location.reference);
@@ -362,12 +362,12 @@ implementation
                   else
                     begin
                        {!!!!! 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;
             typedconstsym :
                begin
-                  location.reference.symbol:=newasmsymbol(ttypedconstsym(symtableentry).mangledname);
+                  location.reference.symbol:=current_library.newasmsymbol(ttypedconstsym(symtableentry).mangledname);
                end;
             else internalerror(4);
          end;
@@ -391,8 +391,8 @@ implementation
       begin
         otlabel:=truelabel;
         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
@@ -614,7 +614,7 @@ implementation
               LOC_JUMP :
                 begin
                   cgsize:=def_cgsize(left.resulttype.def);
-                  getlabel(hlabel);
+                  current_library.getlabel(hlabel);
                   { generate the leftnode for the true case, and
                     release the location }
                   cg.a_label(exprasmlist,truelabel);
@@ -929,7 +929,16 @@ begin
 end.
 {
   $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
 
   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.register:=rg.getregisterint(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);
       end;
 
@@ -407,8 +407,8 @@ implementation
                   if (cs_debuginfo in aktmoduleswitches) then
                     begin
                       inc(withlevel);
-                      getaddrlabel(withstartlabel);
-                      getaddrlabel(withendlabel);
+                      current_library.getaddrlabel(withstartlabel);
+                      current_library.getaddrlabel(withendlabel);
                       cg.a_label(exprasmlist,withstartlabel);
                       withdebugList.concat(Tai_stabs.Create(strpnew(
                          '"with'+tostr(withlevel)+':'+tostr(symtablestack.getnewtypecount)+
@@ -749,9 +749,9 @@ implementation
               if isjump then
                begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
                end;
               maybe_save(exprasmlist,right.registers32,location,pushedregs);
               secondpass(right);
@@ -775,7 +775,7 @@ implementation
                         firstpass(hightree);
                         secondpass(hightree);
                         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);
                         hightree.free;
                         hightree:=nil;
@@ -875,7 +875,16 @@ begin
 end.
 {
   $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
 
   Revision 1.20  2002/08/11 06:14:40  florian

+ 21 - 13
compiler/ncgset.pas

@@ -283,7 +283,7 @@ implementation
          if genjumps then
           begin
             { Get a label to jump to the end }
-            getlabel(l);
+            current_library.getlabel(l);
 
             { clear the register value, indicating result is FALSE }
             cg.a_load_const_reg(exprasmlist,OS_INT,0,location.register);
@@ -378,7 +378,7 @@ implementation
               end;
              { To compensate for not doing a second pass }
              right.location.reference.symbol:=nil;
-             getlabel(l3);
+             current_library.getlabel(l3);
              cg.a_jmp_always(exprasmlist,l3);
              { Now place the end label if IN success }
              cg.a_label(exprasmlist,l);
@@ -507,8 +507,8 @@ implementation
                   { this section has not been tested!    }
                   { can it actually occur currently? CEC }
                   { 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
                      LOC_REGISTER,
@@ -691,7 +691,7 @@ implementation
              begin
                 if opsize in [OS_S64,OS_64] then
                   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_EQ, longint(lo(int64(t^._low))),hregister, t^.statement);
                      cg.a_label(exprasmlist,l1);
@@ -711,7 +711,7 @@ implementation
                   begin
                      if opsize in [OS_64,OS_S64] then
                        begin
-                          getlabel(l1);
+                          objectlibrary.getlabel(l1);
                           cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._low))),
                                hregister2, elselabel);
                           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
                   begin
-                     getlabel(l1);
+                     objectlibrary.getlabel(l1);
                      cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, longint(hi(int64(t^._high))), hregister2,
                            t^.statement);
                      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);
       end;
 
-
       var
          lv,hv,
          max_label: tconstexprint;
@@ -813,8 +812,8 @@ implementation
          dist : cardinal;
          hp : tnode;
       begin
-         getlabel(endlabel);
-         getlabel(elselabel);
+         current_library.getlabel(endlabel);
+         current_library.getlabel(elselabel);
          with_sign:=is_signed(left.resulttype.def);
          if with_sign then
            begin
@@ -834,9 +833,9 @@ implementation
          if left.location.loc=LOC_JUMP then
           begin
             otl:=truelabel;
-            getlabel(truelabel);
+            current_library.getlabel(truelabel);
             ofl:=falselabel;
-            getlabel(falselabel);
+            current_library.getlabel(falselabel);
             isjump:=true;
           end;
          secondpass(left);
@@ -957,7 +956,16 @@ begin
 end.
 {
   $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
 
   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 genimplicitunitinit(list : TAAsmoutput);
    procedure genimplicitunitfinal(list : TAAsmoutput);
-   
+
           {#
               Allocate the buffers for exception management and setjmp environment.
               Return a pointer to these buffers, send them to the utility routine
               so they are registered, and then call setjmp.
-  
+
               Then compare the result of setjmp with 0, and if not equal
               to zero, then jump to exceptlabel.
-       
+
               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
               routine has been called, therefore on machines where the stack cannot
               be modified, all temps should be allocated on the heap instead of the
@@ -84,7 +84,7 @@ interface
               a : aword; exceptlabel : tasmlabel);
           procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
            a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
-   
+
 
 
 implementation
@@ -243,17 +243,17 @@ implementation
 
        cg.a_param_reg(list,OS_ADDR,accumulator,paramanager.getintparaloc(1));
        cg.a_call_name(list,'FPC_SETJMP');
-         
+
        cg.g_exception_reason_save(list, href);
        cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,accumulator,exceptlabel);
      end;
-     
-     
+
+
     procedure free_exception(list : taasmoutput;const jmpbuf, envbuf, href : treference;
      a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
      begin
          cg.a_call_name(list,'FPC_POPADDRSTACK');
-         
+
          if not onlyfree then
           begin
             cg.g_exception_reason_load(list, href);
@@ -295,7 +295,7 @@ implementation
                   begin
                     cg.a_label(list,truelabel);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
-                    getlabel(hl);
+                    current_library.getlabel(hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_label(list,falselabel);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
@@ -383,7 +383,7 @@ implementation
                begin
                  cg.a_label(list,truelabel);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
-                 getlabel(hl);
+                 current_library.getlabel(hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_label(list,falselabel);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
@@ -437,7 +437,7 @@ implementation
                   begin
                     cg.a_label(list,truelabel);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
-                    getlabel(hl);
+                    current_library.getlabel(hl);
                     cg.a_jmp_always(list,hl);
                     cg.a_label(list,falselabel);
                     cg.a_load_const_reg(list,OS_INT,0,hregister);
@@ -475,7 +475,7 @@ implementation
                begin
                  cg.a_label(list,truelabel);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
-                 getlabel(hl);
+                 current_library.getlabel(hl);
                  cg.a_jmp_always(list,hl);
                  cg.a_label(list,falselabel);
                  cg.a_load_const_reg(list,dst_size,0,hregister);
@@ -869,7 +869,7 @@ implementation
            (vo_is_thread_var in tvarsym(p).varoptions) then
          begin
            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));
            rg.saveregvars(list,all_registers);
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
@@ -894,7 +894,7 @@ implementation
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
            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);
          end;
       end;
@@ -915,7 +915,7 @@ implementation
            if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then
             reference_reset_base(href,procinfo^.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup)
            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);
          end;
       end;
@@ -1139,12 +1139,12 @@ implementation
         stackalloclist : taasmoutput;
       begin
         stackalloclist:=taasmoutput.Create;
-        
+
         { the actual stack allocation code, symbol entry point and
           gdb stabs information is generated AFTER the rest of this
           code, since temp. allocation might occur before - carl
-        }  
-        
+        }
+
         if (cs_profile in aktmoduleswitches) and
               not(po_assembler in aktprocdef.procoptions) and not(inlined) then
             cg.g_profilecode(list);
@@ -1265,7 +1265,7 @@ implementation
 
         if inlined then
          load_regvars(list,nil);
-         
+
         {************************* Stack allocation **************************}
         { and symbol entry point as well as debug information                 }
         { will be inserted in front of the rest of this list.                 }
@@ -1308,7 +1308,7 @@ implementation
              else
               stackalloclist.concat(Tai_symbol.Createname(hs,0));
            until false;
-        
+
         stackframe:=stackframe+tg.gettempsize;
 {$ifndef powerpc}
            { at least for the ppc this applies always, so this code isn't usable (FK) }
@@ -1413,7 +1413,7 @@ implementation
           begin
              { the exception helper routines modify all registers }
              aktprocdef.usedregisters:=all_registers;
-             getlabel(noreraiselabel);
+             current_library.getlabel(noreraiselabel);
              free_exception(list,
                   procinfo^.exception_jmp_ref,
                   procinfo^.exception_env_ref,
@@ -1427,7 +1427,7 @@ implementation
                        pd:=procinfo^._class.searchdestructor;
                        if assigned(pd) then
                          begin
-                            getlabel(nodestroycall);
+                            current_library.getlabel(nodestroycall);
                             reference_reset_base(href,procinfo^.framepointer,procinfo^.selfpointer_offset);
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             if is_class(procinfo^._class) then
@@ -1438,7 +1438,7 @@ implementation
                             else if is_object(procinfo^._class) then
                              begin
                                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));
                              end
                             else
@@ -1500,7 +1500,7 @@ implementation
                 { successful constructor deletes the zero flag }
                 { and returns self in eax                   }
                 { eax must be set to zero if the allocation failed !!! }
-                getlabel(okexitlabel);
+                current_library.getlabel(okexitlabel);
                 cg.a_jmp_always(list,okexitlabel);
                 cg.a_label(list,faillabel);
                 cg.g_call_fail_helper(list);
@@ -1529,7 +1529,7 @@ implementation
 {$ifdef GDB}
         if ((cs_debuginfo in aktmoduleswitches) and not inlined) then
           begin
-            getlabel(stabsendlabel);
+            current_library.getlabel(stabsendlabel);
             cg.a_label(list,stabsendlabel);
           end;
 {$endif GDB}
@@ -1598,9 +1598,13 @@ implementation
                     st:='*'
                   else
                     st:='';
+{$ifdef i386}
                   list.concat(Tai_stabs.Create(strpnew(
                    '"$t:r'+st+procinfo^._class.numberstring+'",'+
                    tostr(N_RSYM)+',0,0,'+tostr(GDB_i386index[SELF_POINTER_REG]))));
+{$else}
+{$warning Missing stabs for classes!}
+{$endif}
                 end;
 
             { define calling EBP as pseudo local var PM }
@@ -1701,7 +1705,16 @@ implementation
 end.
 {
   $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
       so temps. can be allocated before.
     * fix generic exception handling

+ 20 - 11
compiler/nobj.pas

@@ -273,7 +273,7 @@ implementation
     procedure tclassheader.writenames(p : pprocdeftree);
 
       begin
-         getdatalabel(p^.nl);
+         current_library.getdatalabel(p^.nl);
          if assigned(p^.l) then
            writenames(p^.l);
          dataSegment.concat(Tai_label.Create(p^.nl));
@@ -312,7 +312,7 @@ implementation
            writenames(root);
 
          { now start writing of the message string table }
-         getdatalabel(r);
+         current_library.getdatalabel(r);
          dataSegment.concat(Tai_label.Create(r));
          genstrmsgtab:=r;
          dataSegment.concat(Tai_const.Create_32bit(count));
@@ -348,7 +348,7 @@ implementation
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgint,nil);
 
          { now start writing of the message string table }
-         getdatalabel(r);
+         current_library.getdatalabel(r);
          dataSegment.concat(Tai_label.Create(r));
          genintmsgtab:=r;
          dataSegment.concat(Tai_const.Create_32bit(count));
@@ -424,7 +424,7 @@ implementation
 
          if count>0 then
            begin
-              getdatalabel(r);
+              current_library.getdatalabel(r);
               gendmt:=r;
               dataSegment.concat(Tai_label.Create(r));
               { entries for caching }
@@ -466,7 +466,7 @@ implementation
               if assigned(tprocsym(p).defs^.next) then
                 internalerror(1209992);
               hp:=tprocsym(p).defs^.def;
-              getdatalabel(l);
+              current_library.getdatalabel(l);
 
               Consts.concat(Tai_label.Create(l));
               Consts.concat(Tai_const.Create_8bit(length(p.name)));
@@ -487,7 +487,7 @@ implementation
          _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}do_count,nil);
          if count>0 then
            begin
-              getdatalabel(l);
+              current_library.getdatalabel(l);
               dataSegment.concat(Tai_label.Create(l));
               dataSegment.concat(Tai_const.Create_32bit(count));
               _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}genpubmethodtableentry,nil);
@@ -820,7 +820,7 @@ implementation
         if curintf.objecttype in [odt_interfacecom] then
           begin
             { label for GUID }
-            getdatalabel(tmplabel);
+            current_library.getdatalabel(tmplabel);
             rawdata.concat(Tai_label.Create(tmplabel));
             rawdata.concat(Tai_const.Create_32bit(curintf.iidguid.D1));
             rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D2));
@@ -839,7 +839,7 @@ implementation
         { IOffset field }
         dataSegment.concat(Tai_const.Create_32bit(implintf.ioffsets(contintfindex)^));
         { IIDStr }
-        getdatalabel(tmplabel);
+        current_library.getdatalabel(tmplabel);
         rawdata.concat(Tai_label.Create(tmplabel));
         rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
         if curintf.objecttype=odt_interfacecom then
@@ -1064,7 +1064,7 @@ implementation
           end;
         { 2. step calc required fieldcount and their offsets in the object memory map
              and write data }
-        getdatalabel(intftable);
+        current_library.getdatalabel(intftable);
         dataSegment.concat(Tai_label.Create(intftable));
         gintfwritedata;
         _class.implementedinterfaces.clearimplprocs; { release temporary information }
@@ -1177,7 +1177,7 @@ implementation
             methodnametable:=genpublishedmethodstable;
             fieldtablelabel:=_class.generate_field_table;
             { write class name }
-            getdatalabel(classnamelabel);
+            current_library.getdatalabel(classnamelabel);
             dataSegment.concat(Tai_label.Create(classnamelabel));
             dataSegment.concat(Tai_const.Create_8bit(length(_class.objrealname^)));
             dataSegment.concat(Tai_string.Create(_class.objrealname^));
@@ -1293,7 +1293,16 @@ initialization
 end.
 {
   $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
 
   Revision 1.22  2002/07/20 11:57:55  florian

+ 17 - 15
compiler/parser.pas

@@ -71,6 +71,7 @@ implementation
          aktprocsym:=nil;
          aktprocdef:=nil;
 
+         current_library:=nil;
          current_module:=nil;
          compiled_module:=nil;
          procinfo:=nil;
@@ -247,7 +248,6 @@ implementation
          oldaktprocdef    : tprocdef;
          oldoverloaded_operators : toverloaded_operators;
        { cg }
-         oldnextlabelnr : longint;
          oldparse_only  : boolean;
        { asmlists }
          oldimports,
@@ -262,7 +262,7 @@ implementation
          olddebuglist,
          oldwithdebuglist,
          oldconsts     : taasmoutput;
-         oldasmsymbollist : tdictionary;
+         oldcurrent_library : tasmlibrarydata;
        { resourcestrings }
          OldResourceStrings : tResourceStrings;
        { akt.. things }
@@ -317,7 +317,6 @@ implementation
          oldcurrent_scanner:=current_scanner;
          oldsourcecodepage:=aktsourcecodepage;
        { save cg }
-         oldnextlabelnr:=nextlabelnr;
          oldparse_only:=parse_only;
        { save assembler lists }
          olddatasegment:=datasegment;
@@ -332,7 +331,7 @@ implementation
          oldexports:=exportssection;
          oldresource:=resourcesection;
          oldresourcestringlist:=resourcestringlist;
-         oldasmsymbollist:=asmsymbollist;
+         oldcurrent_library:=current_library;
          OldResourceStrings:=ResourceStrings;
        { save akt... state }
        { handle the postponed case first }
@@ -467,10 +466,6 @@ implementation
          it's the default to release the trees }
          codegen_donemodule;
 
-{$ifdef newcg}
-         dispose(cg,done);
-{$endif newcg}
-
        { free ppu }
          if assigned(tppumodule(current_module).ppufile) then
           begin
@@ -487,9 +482,6 @@ implementation
 
          if (compile_level>1) then
            begin
-{$ifdef newcg}
-              cg:=oldcg;
-{$endif newcg}
 {$ifdef GDB}
               dbx_counter:=store_dbx;
 {$endif GDB}
@@ -502,9 +494,9 @@ implementation
               akttokenpos:=oldtokenpos;
               block_type:=old_block_type;
               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 }
-              nextlabelnr:=oldnextlabelnr;
               parse_only:=oldparse_only;
               { restore asmlists }
               exprasmlist:=oldexprasmlist;
@@ -519,8 +511,9 @@ implementation
               resourcesection:=oldresource;
               rttilist:=oldrttilist;
               resourcestringlist:=oldresourcestringlist;
-              asmsymbollist:=oldasmsymbollist;
+              { object data }
               ResourceStrings:=OldResourceStrings;
+              current_library:=oldcurrent_library;
               { restore symtable state }
               refsymtable:=oldrefsymtable;
               symtablestack:=oldsymtablestack;
@@ -618,7 +611,16 @@ implementation
 end.
 {
   $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
 
   Revision 1.35  2002/07/20 17:16:03  florian

+ 12 - 3
compiler/pdecl.pas

@@ -250,12 +250,12 @@ implementation
              begin
                 if (cs_create_smart in aktmoduleswitches) then
                   begin
-                    getdatalabel(hl);
+                    current_library.getdatalabel(hl);
                     { we still want a warning if unused }
                     hl.refs:=0;
                   end
                 else
-                  getlabel(hl);
+                  current_library.getlabel(hl);
                 if token=_ID then
                  symtablestack.insert(tlabelsym.create(orgpattern,hl))
                 else
@@ -613,7 +613,16 @@ implementation
 end.
 {
   $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
     + wrappers for the tcnvnode.first_* stuff introduced
 

+ 11 - 2
compiler/pdecsub.pas

@@ -1840,7 +1840,7 @@ const
                    if aprocdef.has_mangledname then
                     begin
                       { 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 }
                       hd.has_mangledname:=true;
                       hd.setmangledname(aprocdef.mangledname);
@@ -1957,7 +1957,16 @@ const
 end.
 {
   $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
 
   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
          begin
            { 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 }
            ltvTable.concat(tai_const.create_32bit(tvarsym(p).getsize));
          end;
@@ -1388,7 +1388,16 @@ implementation
 end.
 {
   $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
     * renamed asmmode enum.
     * 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                      }
          reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
          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);
          list.concat(taicpu.op_reg_ref(A_LWZ,R_TOC,href));
          procinfo^.flags:=procinfo^.flags or pi_do_call;
@@ -942,11 +942,11 @@ const
              { save floating-point registers }
              if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then
                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;
                end
              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 }
              list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,-(ord(R_F31)-ord(firstregfpu)+1)*8));
           end;
@@ -957,11 +957,11 @@ const
              {
              if cs_create_pic in aktmoduleswitches then
                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;
                end
              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);
              list.concat(taicpu.op_reg_ref(A_STMW,firstreggpr,href));
@@ -1036,7 +1036,7 @@ const
              { restore gprs }
              { 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);
              list.concat(taicpu.op_reg_ref(A_LMW,firstreggpr,href));
@@ -1048,11 +1048,11 @@ const
              { 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));
              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))
              else
                { 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));
              genret:=false;
           end;
@@ -1100,7 +1100,7 @@ const
         a_reg_dealloc(list,R_0);
         { save floating-point registers }
         { !!! 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 }
         { !!! has to be optimized: only save registers that are used }
         reference_reset_base(href,STACK_POINTER_REG,-220);
@@ -1294,7 +1294,7 @@ const
             { explicitely allocate R_0 since it can be used safely here }
             { (for holding date that's being copied)                    }
             a_reg_alloc(list,R_F0);
-            getlabel(lab);
+            current_library.getlabel(lab);
             a_label(list, lab);
             list.concat(taicpu.op_reg_reg_const(A_SUBIC_,countreg,countreg,1));
             list.concat(taicpu.op_reg_ref(A_LFDU,R_F0,src));
@@ -1366,7 +1366,7 @@ const
       begin
          if not(cs_check_overflow in aktlocalswitches) then
           exit;
-         getlabel(hl);
+         current_library.getlabel(hl);
          if not ((p.resulttype.def.deftype=pointerdef) or
                 ((p.resulttype.def.deftype=orddef) and
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
@@ -1405,7 +1405,7 @@ const
         reference_reset_base(href,STACK_POINTER_REG,8);
         list.concat(taicpu.op_reg_ref(A_LWZ,R_0,href));
         { ... 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;
 
 
@@ -1561,7 +1561,7 @@ const
         p: taicpu;
 
       begin
-        p := taicpu.op_sym(op,newasmsymbol(l.name));
+        p := taicpu.op_sym(op,current_library.newasmsymbol(l.name));
         if op <> A_B then
           create_cond_norm(c,crval,p.condition);
         p.is_jmp := true;
@@ -1674,7 +1674,16 @@ begin
 end.
 {
   $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
 
   Revision 1.37  2002/08/10 17:15:31  jonas

+ 16 - 7
compiler/powerpc/nppcadd.pas

@@ -293,9 +293,9 @@ interface
             if isjump then
               begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
             secondpass(left);
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
@@ -311,9 +311,9 @@ interface
             if isjump then
               begin
                  otl:=truelabel;
-                 getlabel(truelabel);
+                 current_library.getlabel(truelabel);
                  ofl:=falselabel;
-                 getlabel(falselabel);
+                 current_library.getlabel(falselabel);
               end;
             secondpass(right);
             maybe_restore(exprasmlist,left.location,pushedregs);
@@ -388,7 +388,7 @@ interface
                    andn :
                      begin
                         otl:=truelabel;
-                        getlabel(truelabel);
+                        current_library.getlabel(truelabel);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,truelabel);
@@ -397,7 +397,7 @@ interface
                    orn :
                      begin
                         ofl:=falselabel;
-                        getlabel(falselabel);
+                        current_library.getlabel(falselabel);
                         secondpass(left);
                         maketojumpbool(exprasmlist,left,lr_load_regvars);
                         cg.a_label(exprasmlist,falselabel);
@@ -1302,7 +1302,16 @@ begin
 end.
 {
   $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
 
   Revision 1.8  2002/08/11 06:14:40  florian

+ 12 - 2
compiler/ppu.pas

@@ -77,6 +77,8 @@ const
   ibendsymtablebrowser   = 14;
   ibbeginsymtablebrowser = 15;
   ibusedmacros           = 16;
+  {implementation/objectdata}
+  ibasmsymbols    = 100;
   {syms}
   ibtypesym       = 20;
   ibprocsym       = 21;
@@ -111,7 +113,6 @@ const
   ibansistringdef  = 55;
   ibwidestringdef  = 56;
   ibvariantdef     = 57;
-
 { unit flags }
   uf_init          = $1;
   uf_finalize      = $2;
@@ -981,7 +982,16 @@ end;
 end.
 {
   $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
 
   Revision 1.20  2002/05/18 13:34:13  peter

+ 16 - 7
compiler/pstatmnt.pas

@@ -63,7 +63,7 @@ implementation
   {$ifndef NoRa386Att}
        ,ra386att
   {$endif NoRa386Att}
-{$else}  
+{$else}
        ,rasm
 {$endif i386}
        ;
@@ -170,7 +170,7 @@ implementation
            hcaselabel^.greater:=nil;
            hcaselabel^.statement:=aktcaselabel;
            hcaselabel^.firstlabel:=first;
-           getlabel(hcaselabel^._at);
+           current_library.getlabel(hcaselabel^._at);
            hcaselabel^._low:=l;
            hcaselabel^._high:=h;
            insertlabel(root);
@@ -205,7 +205,7 @@ implementation
          root:=nil;
          instruc:=nil;
          repeat
-           getlabel(aktcaselabel);
+           current_library.getlabel(aktcaselabel);
            firstlabel:=true;
 
            { maybe an instruction has more case labels }
@@ -725,7 +725,7 @@ implementation
            asmmode_i386_intel:
              asmstat:=tasmnode(ra386int.assemble);
   {$endif NoRA386Int}
-{$else}  
+{$else}
            asmmode_direct:
              begin
                if not target_asm.allowdirect then
@@ -741,8 +741,8 @@ implementation
 
            asmmode_standard:
              asmstat:=tasmnode(rasm.assemble);
-{$endif}  
-             
+{$endif}
+
          else
            Message(parser_f_assembler_reader_not_supported);
          end;
@@ -1142,7 +1142,16 @@ implementation
 end.
 {
   $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
     * renamed asmmode enum.
     * assembler reader has now less ifdef's

+ 14 - 5
compiler/psub.pas

@@ -233,13 +233,13 @@ implementation
          oldquickexitlabel:=quickexitlabel;
          oldfaillabel:=faillabel;
          { get new labels }
-         getlabel(aktexitlabel);
-         getlabel(aktexit2label);
+         current_library.getlabel(aktexitlabel);
+         current_library.getlabel(aktexit2label);
          { exit for fail in constructors }
          if (aktprocdef.proctypeoption=potype_constructor) then
            begin
-             getlabel(faillabel);
-             getlabel(quickexitlabel);
+             current_library.getlabel(faillabel);
+             current_library.getlabel(quickexitlabel);
            end;
          { reset break and continue labels }
          block_type:=bt_general;
@@ -814,7 +814,16 @@ implementation
 end.
 {
   $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),
       set to zero currently
 

+ 28 - 19
compiler/ptconst.pas

@@ -80,10 +80,10 @@ implementation
          strval    : pchar;
          pw        : pcompilerwidestring;
          error     : boolean;
-	 
+
       type
          setbytes = array[0..31] of byte;
-	 Psetbytes = ^setbytes;
+         Psetbytes = ^setbytes;
 
       procedure check_range(def:torddef);
         begin
@@ -240,7 +240,7 @@ implementation
                       if not(tobjectdef(tclassrefdef(p.resulttype.def).pointertype.def).is_related(
                         tobjectdef(tclassrefdef(t.def).pointertype.def))) then
                         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)));
                    end;
                  niln:
@@ -282,7 +282,7 @@ implementation
                 if is_char(tpointerdef(t.def).pointertype.def) and
                    (p.nodetype<>addrn) then
                   begin
-                    getdatalabel(ll);
+                    current_library.getdatalabel(ll);
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     if p.nodetype=stringconstn then
                      varalign:=size_2_align(tstringconstnode(p).len)
@@ -313,7 +313,7 @@ implementation
                 if is_widechar(tpointerdef(t.def).pointertype.def) and
                    (p.nodetype<>addrn) then
                   begin
-                    getdatalabel(ll);
+                    current_library.getdatalabel(ll);
                     curconstSegment.concat(Tai_const_symbol.Create(ll));
                     Consts.concat(Tai_label.Create(ll));
                     if (p.nodetype in [stringconstn,ordconstn]) then
@@ -445,11 +445,11 @@ implementation
                         if source_info.endian = target_info.endian then
                           begin
                             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]));
-			    {$endif}
+                            {$endif}
                           end
                         else
                           begin
@@ -457,17 +457,17 @@ implementation
                             j:=0;
                             for l:=0 to ((p.resulttype.def.size-1) div 4) do
                               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+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]));
-			{$endif}
+                        {$endif}
                                 Inc(j,4);
                               end;
                           end;
@@ -563,7 +563,7 @@ implementation
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                         else
                           begin
-                            getdatalabel(ll);
+                            current_library.getdatalabel(ll);
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             { first write the maximum size }
                             Consts.concat(Tai_const.Create_32bit(strlength));
@@ -590,7 +590,7 @@ implementation
                           curconstSegment.concat(Tai_const.Create_32bit(0))
                         else
                           begin
-                            getdatalabel(ll);
+                            current_library.getdatalabel(ll);
                             curconstSegment.concat(Tai_const_symbol.Create(ll));
                             Consts.concat(Tai_const.Create_32bit(strlength));
                             Consts.concat(Tai_const.Create_32bit(strlength));
@@ -986,7 +986,16 @@ implementation
 end.
 {
   $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
     for ppc.
 

+ 16 - 7
compiler/rautils.pas

@@ -835,7 +835,7 @@ Begin
             end;
           globalsymtable,
           staticsymtable :
-            opr.ref.symbol:=newasmsymbol(tvarsym(sym).mangledname);
+            opr.ref.symbol:=current_library.newasmsymbol(tvarsym(sym).mangledname);
           parasymtable :
             begin
               { if we only want the offset we don't have to care
@@ -880,7 +880,7 @@ Begin
           localsymtable :
             begin
               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
                 begin
                   { if we only want the offset we don't have to care
@@ -941,7 +941,7 @@ Begin
       end;
     typedconstsym :
       begin
-        opr.ref.symbol:=newasmsymbol(ttypedconstsym(sym).mangledname);
+        opr.ref.symbol:=current_library.newasmsymbol(ttypedconstsym(sym).mangledname);
         case ttypedconstsym(sym).typedconsttype.def.deftype of
           orddef,
           enumdef,
@@ -989,7 +989,7 @@ Begin
           Message(asmr_w_calling_overload_func);
         l:=opr.ref.offset;
         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;
         hasvar:=true;
         SetupVar:=TRUE;
@@ -1010,7 +1010,7 @@ var
   p : tasmsymbol;
 begin
   SetupDirectVar:=false;
-  p:=getasmsymbol(hs);
+  p:=current_library.getasmsymbol(hs);
   if assigned(p) then
    begin
      opr.ref.symbol:=p;
@@ -1129,7 +1129,7 @@ function TLocalLabel.Gettasmlabel:tasmlabel;
 begin
   if not assigned(lab) then
    begin
-     getlabel(lab);
+     current_library.getlabel(lab);
      { this label is forced to be used so it's always written }
      inc(lab.refs);
    end;
@@ -1592,7 +1592,16 @@ end;
 end.
 {
   $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
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added

+ 30 - 10
compiler/symdef.pas

@@ -69,6 +69,7 @@ interface
           procedure write(ppufile:tcompilerppufile);virtual;abstract;
           procedure deref;override;
           procedure derefimpl;override;
+          procedure derefobjectdata;override;
           function  size:longint;override;
           function  alignment:longint;override;
           function  is_publishable : boolean;override;
@@ -512,6 +513,7 @@ interface
           procedure write(ppufile:tcompilerppufile);override;
           procedure deref;override;
           procedure derefimpl;override;
+          procedure derefobjectdata;override;
           function  getsymtable(t:tgetsymtable):tsymtable;override;
           function  haspara:boolean;
           function  mangledname : string;
@@ -922,6 +924,11 @@ implementation
       end;
 
 
+    procedure tstoreddef.derefobjectdata;
+      begin
+      end;
+
+
     function tstoreddef.size : longint;
       begin
          size:=savesize;
@@ -1096,7 +1103,7 @@ implementation
           begin
             if not assigned(localrttilab[rt]) then
              begin
-               getdatalabel(localrttilab[rt]);
+               current_library.getdatalabel(localrttilab[rt]);
                write_child_rtti_data(rt);
                if (cs_create_smart in aktmoduleswitches) then
                 rttiList.concat(Tai_cut.Create);
@@ -1516,7 +1523,7 @@ implementation
          if rangenr=0 then
            begin
               { generate two constant for bounds }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
               else
@@ -1736,7 +1743,7 @@ implementation
               else
                rangechecksize:=16;
               { generate two constant for bounds }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,rangechecksize))
               else
@@ -2615,7 +2622,7 @@ implementation
          if rangenr=0 then
            begin
               { generates the data for range checking }
-              getlabelnr(rangenr);
+              current_library.getlabelnr(rangenr);
               if (cs_create_smart in aktmoduleswitches) then
                 dataSegment.concat(Tai_symbol.Createname_global(getrangecheckstring,8))
               else
@@ -3792,6 +3799,11 @@ implementation
       end;
 
 
+    procedure tprocdef.derefobjectdata;
+      begin
+      end;
+
+
     function tprocdef.mangledname : string;
       var
         s  : string;
@@ -4364,7 +4376,7 @@ implementation
     begin
         { if we found already a destructor, then we exit }
         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;
 
    function tobjectdef.searchdestructor : tprocdef;
@@ -4444,14 +4456,13 @@ implementation
           para : TParaItem;
           arglength : byte;
           sp : char;
-          pdl : pprocdeflist;
       begin
         If tsym(p).typ = procsym then
          begin
            pd := tprocsym(p).first_procdef;
            { this will be used for full implementation of object stabs
            not yet done }
-	   ipd := Tprocsym(p).last_procdef;
+           ipd := Tprocsym(p).last_procdef;
            if (po_virtualmethod in pd.procoptions) then
              begin
                lindex := pd.extnumber;
@@ -4911,8 +4922,8 @@ implementation
 
       begin
          classtablelist:=TLinkedList.Create;
-         getdatalabel(fieldtable);
-         getdatalabel(classtable);
+         current_library.getdatalabel(fieldtable);
+         current_library.getdatalabel(classtable);
          count:=0;
          tablecount:=0;
          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields,nil);
@@ -5490,7 +5501,16 @@ implementation
 end.
 {
   $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
 
   Revision 1.85  2002/07/23 09:51:24  daniel

+ 33 - 1
compiler/symppu.pas

@@ -26,23 +26,28 @@ unit symppu;
 interface
 
     uses
+       cclasses,
        globtype,globals,
+       aasmbase,
        symbase,symtype,
        ppu;
 
     type
        tcompilerppufile=class(tppufile)
+       public
          procedure checkerror;
          procedure getguid(var g: tguid);
          procedure getposinfo(var p:tfileposinfo);
          function  getderef : pointer;
          function  getsymlist:tsymlist;
          procedure gettype(var t:ttype);
+         function  getasmsymbol:tasmsymbol;
          procedure putguid(const g: tguid);
          procedure putposinfo(const p:tfileposinfo);
          procedure putderef(p : tsymtableentry);
          procedure putsymlist(p:tsymlist);
          procedure puttype(const t:ttype);
+         procedure putasmsymbol(s:tasmsymbol);
        end;
 
 
@@ -177,6 +182,12 @@ implementation
       end;
 
 
+    function  tcompilerppufile.getasmsymbol:tasmsymbol;
+      begin
+        getasmsymbol:=tasmsymbol(pointer(getlongint));
+      end;
+
+
     procedure tcompilerppufile.putposinfo(const p:tfileposinfo);
       var
         oldcrc : boolean;
@@ -385,10 +396,31 @@ implementation
          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.
 {
   $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
 
   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 deref;override;
           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;
 {$ifdef GDB}
           function stabstring : pchar;override;
@@ -870,24 +870,24 @@ implementation
         pd^.next:=defs;
         defs:=pd;
       end;
-    
+
     procedure Tprocsym.concat_procdefs_to(s:Tprocsym);
-    
+
     var pd:Pprocdeflist;
-    
+
     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;
 
     function Tprocsym.first_procdef:Tprocdef;
 
     begin
-	first_procdef:=defs^.def;
+        first_procdef:=defs^.def;
     end;
 
     function Tprocsym.last_procdef:Tprocdef;
@@ -895,36 +895,36 @@ implementation
     var pd:Pprocdeflist;
 
     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;
 
     function Tprocsym.search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
-    
+
     var p:Pprocdeflist;
-    
+
     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;
-    
+
     function Tprocsym.search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
 
     var pd:Pprocdeflist;
-    
+
     begin
         {This function will return the pprocdef of pprocsym that
          is the best match for procvardef. When there are multiple
@@ -933,76 +933,76 @@ implementation
         search_procdef_byprocvardef:=nil;
         pd:=defs;
         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.}
         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;
 
     function Tprocsym.search_procdef_byretdef_by1paradef(retdef,firstpara:Tdef;
-		      matchtype:Tdefmatch):Tprocdef;
+                      matchtype:Tdefmatch):Tprocdef;
 
     var pd:Pprocdeflist;
-	convtyp:Tconverttype;
-	a,b:boolean;
+        convtyp:Tconverttype;
+        a,b:boolean;
 
     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;
 
     procedure tprocsym.write(ppufile:tcompilerppufile);
@@ -1659,17 +1659,17 @@ implementation
                    else
                      bssSegment.concat(Tai_datablock.Create(mangledname,l));
                    {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_fpuregable);}
                  end;
@@ -2592,7 +2592,7 @@ implementation
       begin
         { the label is always a global label }
         if not assigned(lab) then
-         lab:=newasmsymboltype(mangledname,AB_GLOBAL,AT_DATA);
+         lab:=current_library.newasmsymboltype(mangledname,AB_GLOBAL,AT_DATA);
         get_label:=lab;
       end;
 
@@ -2672,7 +2672,16 @@ implementation
 end.
 {
   $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
 
   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 deref;virtual;
           procedure derefimpl;virtual;
+          procedure derefobjectdata;virtual;
           procedure insert(sym : tsymentry);override;
           function  speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;override;
           procedure allsymbolsused;
@@ -535,6 +536,19 @@ implementation
       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);
       var
          hsym : tsym;
@@ -863,7 +877,7 @@ implementation
                           overloaded_operators[t]:=tprocsym(srsym)
                        else
                           { 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;
                     end
                   else
@@ -2058,7 +2072,16 @@ implementation
 end.
 {
   $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
     are worth comitting.
 

+ 11 - 1
compiler/symtype.pas

@@ -68,6 +68,7 @@ interface
          constructor create;
          procedure deref;virtual;abstract;
          procedure derefimpl;virtual;abstract;
+         procedure derefobjectdata;virtual;abstract;
          function  typename:string;
          function  gettypename:string;virtual;
          function  mangledparaname:string;
@@ -528,7 +529,16 @@ implementation
 end.
 {
   $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
     * reorganized aasm layer
 

+ 11 - 2
compiler/targets/t_beos.pas

@@ -172,7 +172,7 @@ begin
            { place jump in codesegment }
            codesegment.concat(Tai_align.Create_op(4,$90));
            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^));
 {$endif i386}
          end;
@@ -465,7 +465,16 @@ initialization
 end.
 {
   $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
 
   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 }
            codesegment.concat(Tai_align.Create_op(4,$90));
            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^));
 {$endif i386}
          end;
@@ -514,7 +514,16 @@ initialization
 end.
 {
   $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
 
   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 }
            codesegment.concat(Tai_align.Create_op(4,$90));
            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^));
 {$endif i386}
          end;
@@ -524,7 +524,16 @@ end.
 
 {
   $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
 
   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 }
            codesegment.concat(Tai_align.Create_op(4,$90));
            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^));
 {$endif i386}
          end;
@@ -484,7 +484,16 @@ initialization
 end.
 {
   $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
 
   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 }
            codesegment.concat(Tai_align.Create_op(4,$90));
            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^));
 {$endif i386}
          end;
@@ -486,7 +486,16 @@ initialization
 end.
 {
   $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
 
   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
            begin
            { 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 }
              importsSection.concat(Tai_cut.Create_begin);
              importsSection.concat(Tai_section.Create(sec_idata2));
@@ -284,7 +284,7 @@ const
                  { create indirect jump }
                  if not hp2.is_var then
                   begin
-                    getlabel(lcode);
+                    current_library.getlabel(lcode);
                     reference_reset_symbol(href,lcode,0);
                     { place jump in codesegment, insert a code section in the
                       imporTSection to reduce the amount of .s files (PFV) }
@@ -301,7 +301,7 @@ const
                  importsSection.concat(Tai_section.Create(sec_idata7));
                  importsSection.concat(Tai_const_symbol.Create_rva(lhead));
                  { fixup }
-                 getlabel(tasmlabel(hp2.lab));
+                 current_library.getlabel(tasmlabel(hp2.lab));
                  importsSection.concat(Tai_section.Create(sec_idata4));
                  importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab));
                  { add jump field to imporTSection }
@@ -317,7 +317,7 @@ const
                       begin
                         importname:='__imp_'+hp2.name^;
                         suffix:=0;
-                        while assigned(getasmsymbol(importname)) do
+                        while assigned(current_library.getasmsymbol(importname)) do
                          begin
                            inc(suffix);
                            importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
@@ -328,7 +328,7 @@ const
                       begin
                         importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                         suffix:=0;
-                        while assigned(getasmsymbol(importname)) do
+                        while assigned(current_library.getasmsymbol(importname)) do
                          begin
                            inc(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_align.Create_op(4,$90));
               { 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));
               { pointer to procedure names }
               importsSection.concat(Tai_const_symbol.Create_rva(l2));
@@ -415,7 +415,7 @@ const
               hp2:=timported_item(hp1.imported_items.first);
               while assigned(hp2) do
                 begin
-                   getlabel(tasmlabel(hp2.lab));
+                   current_library.getlabel(tasmlabel(hp2.lab));
                    if hp2.name^<>'' then
                      importsSection.concat(Tai_const_symbol.Create_rva(hp2.lab))
                    else
@@ -433,7 +433,7 @@ const
                 begin
                    if not hp2.is_var then
                     begin
-                      getlabel(l4);
+                      current_library.getlabel(l4);
                       { create indirect jump }
                       reference_reset_symbol(href,l4,0);
                       { place jump in codesegment }
@@ -450,7 +450,7 @@ const
                           begin
                             importname:='__imp_'+hp2.name^;
                             suffix:=0;
-                            while assigned(getasmsymbol(importname)) do
+                            while assigned(current_library.getasmsymbol(importname)) do
                              begin
                                inc(suffix);
                                importname:='__imp_'+hp2.name^+'_'+tostr(suffix);
@@ -461,7 +461,7 @@ const
                           begin
                             importname:='__imp_by_ordinal'+tostr(hp2.ordnr);
                             suffix:=0;
-                            while assigned(getasmsymbol(importname)) do
+                            while assigned(current_library.getasmsymbol(importname)) do
                              begin
                                inc(suffix);
                                importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix);
@@ -513,7 +513,7 @@ const
          if not(assigned(exportssection)) then
            exportssection:=TAAsmoutput.create;
          last_index:=0;
-         getdatalabel(edatalabel);
+         current_library.getdatalabel(edatalabel);
       end;
 
 
@@ -609,10 +609,10 @@ const
          ordinal_min:=$7FFFFFFF;
          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 }
          while assigned(hp) do
@@ -684,7 +684,7 @@ const
            begin
               if (hp.options and eo_name)<>0 then
                 begin
-                   getlabel(name_label);
+                   current_library.getlabel(name_label);
                    name_table_pointers.concat(Tai_const_symbol.Create_rva(name_label));
                    ordinal_table.concat(Tai_const.Create_16bit(hp.index-ordinal_base));
                    name_table.concat(Tai_align.Create_op(2,0));
@@ -1553,7 +1553,16 @@ initialization
 end.
 {
   $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
 
   Revision 1.35  2002/07/01 18:46:35  peter

+ 63 - 5
compiler/utils/ppudump.pp

@@ -298,6 +298,50 @@ begin
 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;
 var
   info : byte;
@@ -579,6 +623,7 @@ var
   procoptions     : tprocoptions;
   i,params : longint;
   first    : boolean;
+  paraloc  : array[0..9] of byte;
 begin
   write(space,'      Return type : ');
   readtype;
@@ -629,6 +674,7 @@ begin
        readsymref;
        write(space,'    Symbol  : ');
        readsymref;
+       ppufile.getdata(paraloc,sizeof(paraloc));
        dec(params);
      until params=0;
    end;
@@ -883,7 +929,6 @@ begin
              readcommonsym('Typed constant ');
              write  (space,' Constant Type: ');
              readtype;
-             writeln(space,'         Label: ',getstring);
              writeln(space,'   ReallyConst: ',(getbyte<>0));
            end;
 
@@ -1473,6 +1518,9 @@ begin
      repeat
        b:=readentry;
        case b of
+         ibasmsymbols :
+           ReadAsmSymbols;
+
          iberror :
            begin
              Writeln('Error in PPU');
@@ -1593,7 +1641,9 @@ begin
      Writeln('-------');
      with ppufile.header do
       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 operating system : ',Target2Str(target));
         Writeln('Unit flags              : ',PPUFlags2Str(flags));
@@ -1633,7 +1683,6 @@ begin
   else
    ppufile.skipuntilentry(ibendsyms);
 {read the implementation stuff}
-{ Not used at the moment (PFV)
   if (verbose and v_implementation)<>0 then
    begin
      Writeln;
@@ -1641,7 +1690,7 @@ begin
      Writeln('-----------------------');
      readimplementation;
    end
-  else}
+  else
    ppufile.skipuntilentry(ibendimplementation);
 {read the static browser units stuff}
   if (ppufile.header.flags and uf_local_browser)<>0 then
@@ -1774,7 +1823,16 @@ begin
 end.
 {
   $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
 
   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);
 
       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;
 
     procedure tcgx86.a_call_ref(list : taasmoutput;const ref : treference);
@@ -1268,8 +1268,8 @@ unit cgx86;
         { so we have to access every page first              }
         if target_info.system=system_i386_win32 then
           begin
-             getlabel(again);
-             getlabel(ok);
+             current_library.getlabel(again);
+             current_library.getlabel(ok);
              a_label(list,again);
              list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,R_EDI));
              a_jmp_cond(list,OC_B,ok);
@@ -1401,7 +1401,7 @@ unit cgx86;
            system_i386_wdosx,
            system_i386_linux:
              begin
-                getaddrlabel(pl);
+                current_library.getaddrlabel(pl);
                 list.concat(Tai_section.Create(sec_data));
                 list.concat(Tai_align.Create(4));
                 list.concat(Tai_label.Create(pl));
@@ -1448,7 +1448,7 @@ unit cgx86;
                  end
                else
                  begin
-                    getlabel(again);
+                    current_library.getlabel(again);
                     rg.getexplicitregisterint(list,R_EDI);
                     list.concat(Taicpu.op_const_reg(A_MOV,S_L,localsize div winstackpagesize,R_EDI));
                     a_label(list,again);
@@ -1531,7 +1531,7 @@ unit cgx86;
            { must the object be finalized ? }
            if procinfo^._class.needs_inittable then
             begin
-              getlabel(nofinal);
+              current_library.getlabel(nofinal);
               reference_reset_base(href,R_EBP,8);
               a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nofinal);
               reference_reset_base(href,R_ESI,0);
@@ -1630,7 +1630,7 @@ unit cgx86;
       begin
          if not(cs_check_overflow in aktlocalswitches) then
           exit;
-         getlabel(hl);
+         current_library.getlabel(hl);
          if not ((p.resulttype.def.deftype=pointerdef) or
                 ((p.resulttype.def.deftype=orddef) and
                  (torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
@@ -1651,7 +1651,16 @@ unit cgx86;
 end.
 {
   $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
 
   Revision 1.6  2002/08/09 19:18:27  carl