Sfoglia il codice sorgente

* first things to store the symbol/def number in the ppu

peter 26 anni fa
parent
commit
cc9df8d478

+ 6 - 3
compiler/aasm.pas

@@ -83,7 +83,7 @@ unit aasm;
        TAsmsymtype=(AS_EXTERNAL,AS_LOCAL,AS_GLOBAL);
 
        pasmsymbol = ^tasmsymbol;
-       tasmsymbol = object(tnamed_object)
+       tasmsymbol = object(tdictionaryobject)
          idx     : longint;
          section : tsection;
          address,
@@ -880,7 +880,7 @@ uses
       end;
 
 
-    procedure ResetAsmSym(p:Pnamed_object);{$ifndef FPC}far;{$endif}
+    procedure ResetAsmSym(p:Pdictionaryobject);{$ifndef FPC}far;{$endif}
       begin
         pasmsymbol(p)^.reset;
       end;
@@ -1013,7 +1013,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.37  1999-03-10 13:25:42  pierre
+  Revision 1.38  1999-04-14 09:14:44  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.37  1999/03/10 13:25:42  pierre
     section order changed to get closer output from coff writer
 
   Revision 1.36  1999/03/08 14:51:04  peter

+ 6 - 5
compiler/cg386add.pas

@@ -570,10 +570,8 @@ implementation
          firstcomplex(p);
 
          { handling boolean expressions extra: }
-         if ((p^.left^.resulttype^.deftype=orddef) and
-            (porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) or
-            ((p^.right^.resulttype^.deftype=orddef) and
-            (porddef(p^.right^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
+         if is_boolean(p^.left^.resulttype) and
+            is_boolean(p^.right^.resulttype) then
            begin
              if (porddef(p^.left^.resulttype)^.typ=bool8bit) or
                 (porddef(p^.right^.resulttype)^.typ=bool8bit) then
@@ -1902,7 +1900,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.47  1999-04-12 19:09:08  florian
+  Revision 1.48  1999-04-14 09:14:45  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.47  1999/04/12 19:09:08  florian
   * comparsions for small enumerations type are now generated
     correct
 

+ 5 - 2
compiler/cg386flw.pas

@@ -709,7 +709,7 @@ do_jmp:
 
          { what a hack ! }
          if assigned(p^.exceptsymtable) then
-           pvarsym(p^.exceptsymtable^.root)^.address:=ref.offset;
+           pvarsym(p^.exceptsymtable^.searchroot)^.address:=ref.offset;
 
          exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,
            R_EAX,newreference(ref))));
@@ -797,7 +797,10 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.30  1999-03-05 16:14:59  peter
+  Revision 1.31  1999-04-14 09:14:46  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.30  1999/03/05 16:14:59  peter
     * fixed exit() with word/byte return
 
   Revision 1.29  1999/02/25 21:02:26  peter

File diff suppressed because it is too large
+ 545 - 264
compiler/cobjects.pas


+ 8 - 3
compiler/files.pas

@@ -211,7 +211,7 @@ unit files;
           u : pmodule;
           constructor init(_u : pmodule);
        end;
-       
+
     var
        main_module    : pmodule;     { Main module of the program }
        current_module : pmodule;     { Current module which is compiled }
@@ -922,9 +922,11 @@ uses
 
     procedure tmodule.reset;
 
+{$ifdef Double_checksum}
       var
          pm : pdependent_unit;
-         
+{$endif}
+
       begin
         if assigned(scanner) then
           pscannerfile(scanner)^.invalid:=true;
@@ -1192,7 +1194,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.89  1999-04-07 15:39:29  pierre
+  Revision 1.90  1999-04-14 09:14:48  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.89  1999/04/07 15:39:29  pierre
     + double_checksum code added
 
   Revision 1.88  1999/03/25 16:55:29  peter

+ 27 - 41
compiler/pdecl.pas

@@ -1425,8 +1425,6 @@ unit pdecl;
                       parse_only:=true;
                       constructor_head;
 {$ifdef OLDOBJECTOPTIONS}
-                      parse_object_proc_directives(aktprocsym);
-{$else OLDOBJECTOPTIONS}
                       case idtoken of
                        _DYNAMIC,
                        _VIRTUAL : begin
@@ -1450,6 +1448,8 @@ unit pdecl;
                                     consume(SEMICOLON);
                                   end;
                       end;
+{$else OLDOBJECTOPTIONS}
+                      parse_object_proc_directives(aktprocsym);
 {$endif def OLDOBJECTOPTIONS}
                       parse_only:=oldparse_only;
                     end;
@@ -1463,8 +1463,6 @@ unit pdecl;
                       parse_only:=true;
                       destructor_head;
 {$ifdef OLDOBJECTOPTIONS}
-                      parse_object_proc_directives(aktprocsym);
-{$else OLDOBJECTOPTIONS}
                       case idtoken of
                        _DYNAMIC,
                        _VIRTUAL : begin
@@ -1480,6 +1478,8 @@ unit pdecl;
                                       pooverridingmethod or povirtualmethod;
                                   end;
                       end;
+{$else OLDOBJECTOPTIONS}
+                      parse_object_proc_directives(aktprocsym);
 {$endif def OLDOBJECTOPTIONS}
                       parse_only:=oldparse_only;
                     end;
@@ -1600,9 +1600,11 @@ unit pdecl;
               genvmt(aktclass);
            end;
 
+{$ifndef STORENUMBER}
          { number symbols and defs }
          symtablestack^.number_defs;
          symtablestack^.number_symbols;
+{$endif}
 
          { restore old state }
          symtablestack:=symtablestack^.next;
@@ -1638,9 +1640,11 @@ unit pdecl;
          consume(_END);
          typecanbeforward:=storetypeforwardsallowed;
 
+{$ifndef STORENUMBER}
          { number symbols and defs }
          symtablestack^.number_defs;
          symtablestack^.number_symbols;
+{$endif}
 
          symtablestack:=symtable^.next;
          record_dec:=new(precdef,init(symtable));
@@ -1828,46 +1832,25 @@ unit pdecl;
              if pt^.treetype=typen then
                begin
                  case pt^.resulttype^.deftype of
-               enumdef : begin
-                           lowval:=penumdef(pt^.resulttype)^.min;
-                           highval:=penumdef(pt^.resulttype)^.max;
-                           arraytype:=pt^.resulttype;
-                         end;
-                orddef : begin
-                           case porddef(pt^.resulttype)^.typ of
-                            s8bit,u8bit,
-                          s16bit,u16bit,
-                                 s32bit : begin
-                                            lowval:=porddef(pt^.resulttype)^.low;
-                                            highval:=porddef(pt^.resulttype)^.high;
-                                            arraytype:=pt^.resulttype;
-                                          end;
-
-                               bool8bit,
-                              bool16bit,
-                              bool32bit : begin
-                                            lowval:=0;
-                                            highval:=1;
-                                            arraytype:=pt^.resulttype;
-                                          end;
-                                  uchar : begin
-                                            lowval:=0;
-                                            highval:=255;
-                                            arraytype:=pt^.resulttype;
-                                          end;
-                           else
-                             Message(sym_e_error_in_type_def);
-                           end;
-                         end;
-                 else
-                   Message(sym_e_error_in_type_def);
-                 end
+                   enumdef :
+                     begin
+                       lowval:=penumdef(pt^.resulttype)^.min;
+                       highval:=penumdef(pt^.resulttype)^.max;
+                       arraytype:=pt^.resulttype;
+                     end;
+                   orddef :
+                     begin
+                       lowval:=porddef(pt^.resulttype)^.low;
+                       highval:=porddef(pt^.resulttype)^.high;
+                       arraytype:=pt^.resulttype;
+                     end;
+                   else
+                     Message(sym_e_error_in_type_def);
+                 end;
                end
-
              else
                begin
                   do_firstpass(pt);
-
                   if (pt^.treetype=rangen) then
                    begin
                      if (pt^.left^.treetype=ordconstn) and
@@ -2240,7 +2223,10 @@ unit pdecl;
 end.
 {
   $Log$
-  Revision 1.106  1999-04-07 15:31:15  pierre
+  Revision 1.107  1999-04-14 09:14:50  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.106  1999/04/07 15:31:15  pierre
     * all formaldefs are now a sinlge definition
       cformaldef (this was necessary for double_checksum)
     + small part of double_checksum code

+ 10 - 2
compiler/pmodules.pas

@@ -22,6 +22,8 @@
 }
 unit pmodules;
 
+{$define STORENUMBER}
+
 { define TEST_IMPL does not work well }
 { replaced by $define  Double_checksum}
 { other way to get correct type info, in test (PM) }
@@ -472,7 +474,7 @@ unit pmodules;
                   current_module^.compiled:=true;
                 end;
 {$else Double_Checksum}
-               ;               
+               ;
 {$endif Double_checksum}
               { the next unit }
               hp:=pmodule(hp^.next);
@@ -982,9 +984,12 @@ unit pmodules;
          { to reinsert it after loading the implementation units }
          symtablestack:=unitst^.next;
 
+{$ifndef STORENUMBER}
          { number the definitions, so a deref from other units works }
          refsymtable^.number_defs;
          refsymtable^.number_symbols;
+{$endif}
+
          { we don't want implementation units symbols in unitsymtable !! PM }
          refsymtable:=st;
 
@@ -1341,7 +1346,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.107  1999-04-08 10:53:54  michael
+  Revision 1.108  1999-04-14 09:14:52  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.107  1999/04/08 10:53:54  michael
   * Fixed forgotten ;
 
   Revision 1.106  1999/04/07 15:39:30  pierre

+ 7 - 4
compiler/pstatmnt.pas

@@ -382,7 +382,7 @@ unit pstatmnt;
              objectdef : begin
                            obj:=pobjectdef(p^.resulttype);
                            withsymtable:=new(pwithsymtable,init);
-                           withsymtable^.root:=obj^.publicsyms^.root;
+                           withsymtable^.searchroot:=obj^.publicsyms^.searchroot;
                            withsymtable^.defowner:=obj;
                            symtab:=withsymtable;
 {$ifndef NODIRECTWITH}
@@ -398,7 +398,7 @@ unit pstatmnt;
                             begin
                               symtab^.next:=new(pwithsymtable,init);
                               symtab:=symtab^.next;
-                              symtab^.root:=obj^.publicsyms^.root;
+                              symtab^.searchroot:=obj^.publicsyms^.searchroot;
 {$ifndef NODIRECTWITH}
                               if (p^.treetype=loadn) and
                                  (p^.symtable=aktprocsym^.definition^.localst) then
@@ -417,7 +417,7 @@ unit pstatmnt;
                            symtab:=precdef(p^.resulttype)^.symtable;
                            levelcount:=1;
                            withsymtable:=new(pwithsymtable,init);
-                           withsymtable^.root:=symtab^.root;
+                           withsymtable^.searchroot:=symtab^.searchroot;
                            withsymtable^.next:=symtablestack;
 {$ifndef NODIRECTWITH}
                               if (p^.treetype=loadn) and
@@ -1291,7 +1291,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.74  1999-04-09 12:22:06  pierre
+  Revision 1.75  1999-04-14 09:14:53  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.74  1999/04/09 12:22:06  pierre
    * bug found by Peter for DirectWith code fixed
 
   Revision 1.73  1999/04/06 11:21:57  peter

+ 10 - 1
compiler/ra386int.pas

@@ -3387,20 +3387,26 @@ Begin
 
       AS_DW :
         Begin
+          inexpression:=true;
           Consume(AS_DW);
           BuildConstant($ffff);
+          inexpression:=false;
         end;
 
       AS_DB :
         Begin
+          inexpression:=true;
           Consume(AS_DB);
           BuildConstant($ff);
+          inexpression:=false;
         end;
 
       AS_DD :
         Begin
+          inexpression:=true;
           Consume(AS_DD);
           BuildConstant($ffffffff);
+          inexpression:=false;
         end;
 
       AS_OPCODE :
@@ -3474,7 +3480,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.24  1999-03-26 00:05:41  peter
+  Revision 1.25  1999-04-14 09:14:56  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.24  1999/03/26 00:05:41  peter
     * released valintern
     + deffile is now removed when compiling is finished
     * ^( compiles now correct

+ 67 - 25
compiler/symdef.inc

@@ -67,11 +67,15 @@
 
     constructor tdef.init;
       begin
+{$ifdef STORENUMBER}
+         inherited init;
+{$else}
+         indexnb := 0;
+         next := nil;
+{$endif}
          deftype:=abstractdef;
          owner := nil;
-         next := nil;
          sym := nil;
-         indexnb := 0;
          savesize := 0;
          if registerdef then
            symtablestack^.registerdef(@self);
@@ -99,8 +103,6 @@
     constructor tdef.load;
       begin
          deftype:=abstractdef;
-         indexnb := 0;
-         sym := nil;
          next := nil;
          owner := nil;
          has_rtti:=false;
@@ -121,6 +123,14 @@
            end;
          lastglobaldef := @self;
          nextglobal := nil;
+      { load }
+{$ifdef STORENUMBER}
+         indexnr:=readlong;
+         sym:=ptypesym(readsymref);
+{$else}
+         indexnb := 0;
+         sym:=nil;
+{$endif}
       end;
 
 
@@ -160,9 +170,13 @@
          if assigned(owner) and
             (owner^.symtabletype in [recordsymtable,objectsymtable]) then
            begin
+{$ifdef STORENUMBER}
+              owner^.defindex^.delete(@self);
+{$else}
               { no other definition
                  has been inserted !! (PM) }
               owner^.rootdef:=next;
+{$endif}
               st:=owner;
               while (st^.symtabletype in [recordsymtable,objectsymtable]) do
                 st:=st^.next;
@@ -171,6 +185,15 @@
       end;
 
 
+    function tdef.typename:string;
+      begin
+        if assigned(sym) then
+         typename:=sym^.name
+        else
+         typename:='unknown';
+      end;
+
+
     function tdef.is_in_current : boolean;
       var
         p : psymtable;
@@ -200,6 +223,10 @@
 
     procedure tdef.write;
       begin
+{$ifdef STORENUMBER}
+        writelong(indexnr);
+        writesymref(sym);
+{$endif}
 {$ifdef GDB}
         if globalnb = 0 then
           begin
@@ -353,6 +380,12 @@
       end;
 
 
+    procedure tdef.symderef;
+      begin
+        resolvesym(psym(sym));
+      end;
+
+
     { rtti generation }
     procedure tdef.generate_rtti;
       begin
@@ -409,7 +442,7 @@
       end;
 
 
-    procedure tdef.writename;
+    procedure tdef.write_rtti_name;
       var
          str : string;
       begin
@@ -663,7 +696,7 @@
          has_jumps:=false;
          basedef:=nil;
          rangenr:=0;
-         first:=nil;
+         firstenum:=nil;
          correct_owner_symtable;
       end;
 
@@ -677,9 +710,9 @@
          calcsavesize;
          has_jumps:=false;
          rangenr:=0;
-         first:=basedef^.first;
-         while assigned(first) and (penumsym(first)^.value<>minval) do
-          first:=first^.next;
+         firstenum:=basedef^.firstenum;
+         while assigned(firstenum) and (penumsym(firstenum)^.value<>minval) do
+          firstenum:=firstenum^.nextenum;
          correct_owner_symtable;
       end;
 
@@ -693,7 +726,7 @@
          maxval:=readlong;
          savesize:=readlong;
          has_jumps:=false;
-         first:=Nil;
+         firstenum:=Nil;
       end;
 
 
@@ -793,7 +826,7 @@
         memsize := memsizeinc;
         getmem(st,memsize);
         strpcopy(st,'e');
-        p := first;
+        p := firstenum;
         while assigned(p) do
           begin
             s :=p^.name+':'+tostr(p^.value)+',';
@@ -809,7 +842,7 @@
                 memsize := memsize+memsizeinc;
                 strpcopy(strend(st),s);
               end;
-            p := p^.next;
+            p := p^.nextenum;
           end;
         strpcopy(strend(st),';');
         stabstring := strnew(st);
@@ -846,12 +879,12 @@
            rttilist^.concat(new(pai_const_symbol,init(basedef^.get_rtti_label)))
          else
            rttilist^.concat(new(pai_const,init_32bit(0)));
-         hp:=first;
+         hp:=firstenum;
          while assigned(hp) do
            begin
               rttilist^.concat(new(pai_const,init_8bit(length(hp^.name))));
               rttilist^.concat(new(pai_string,init(hp^.name)));
-              hp:=hp^.next;
+              hp:=hp^.nextenum;
            end;
          rttilist^.concat(new(pai_const,init_8bit(0)));
       end;
@@ -1700,7 +1733,7 @@
     procedure tarraydef.write_rtti_data;
       begin
          rttilist^.concat(new(pai_const,init_8bit(13)));
-         writename;
+         write_rtti_name;
          { size of elements }
          rttilist^.concat(new(pai_const,init_32bit(definition^.size)));
          { count of elements }
@@ -1782,13 +1815,17 @@
          oldrecsyms:=aktrecordsymtable;
          aktrecordsymtable:=symtable;
          { now dereference the definitions }
+{$ifdef STORENUMBER}
+         hp:=pdef(symtable^.defindex^.first);
+{$else}
          hp:=symtable^.rootdef;
+{$endif}
          while assigned(hp) do
            begin
               hp^.deref;
               { set owner }
               hp^.owner:=symtable;
-              hp:=hp^.next;
+              hp:=pdef(hp^.next);
            end;
          {$ifdef tp}
            symtable^.foreach(derefsym);
@@ -1877,7 +1914,7 @@
           symtable^.foreach(@addname);
         {$endif}
 {$else nonextfield}
-         cur:=symtable^.root;
+         cur:=symtable^.searchroot;
          while assigned(cur) do
            begin
               addname(cur);
@@ -1964,7 +2001,7 @@
     procedure trecdef.write_rtti_data;
       begin
          rttilist^.concat(new(pai_const,init_8bit(14)));
-         writename;
+         write_rtti_name;
          rttilist^.concat(new(pai_const,init_32bit(size)));
          count:=0;
          symtable^.foreach(count_fields);
@@ -1976,7 +2013,7 @@
     procedure trecdef.write_init_data;
       begin
          rttilist^.concat(new(pai_const,init_8bit(14)));
-         writename;
+         write_rtti_name;
          rttilist^.concat(new(pai_const,init_32bit(size)));
          count:=0;
          symtable^.foreach(count_inittable_fields);
@@ -2951,15 +2988,17 @@ Const local_symtable_index : longint = $8001;
          oldrecsyms:=aktrecordsymtable;
          aktrecordsymtable:=publicsyms;
          { nun die Definitionen dereferenzieren }
+{$ifdef STORENUMBER}
+         hp:=pdef(publicsyms^.symindex^.first);
+{$else}
          hp:=publicsyms^.rootdef;
+{$endif}
          while assigned(hp) do
            begin
               hp^.deref;
-
               { set owner }
               hp^.owner:=publicsyms;
-
-              hp:=hp^.next;
+              hp:=pdef(hp^.next);
            end;
 {$ifdef tp}
          publicsyms^.foreach(derefsym);
@@ -3150,7 +3189,7 @@ Const local_symtable_index : longint = $8001;
           publicsyms^.foreach(@addname);
         {$endif}
 {$else nonextfield}
-         cur:=publicsyms^.root;
+         cur:=publicsyms^.searchroot;
          while assigned(cur) do
            begin
               addname(cur);
@@ -3170,7 +3209,7 @@ Const local_symtable_index : longint = $8001;
           publicsyms^.foreach(@addprocname);
         {$endif tp }
 {$else nonextfield}
-         cur:=publicsyms^.root;
+         cur:=publicsyms^.searchroot;
          while assigned(cur) do
            begin
               addprocname(cur);
@@ -3433,7 +3472,10 @@ Const local_symtable_index : longint = $8001;
 
 {
   $Log$
-  Revision 1.100  1999-04-08 15:57:51  peter
+  Revision 1.101  1999-04-14 09:14:58  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.100  1999/04/08 15:57:51  peter
     + subrange checking for readln()
 
   Revision 1.99  1999/04/07 15:39:32  pierre

+ 14 - 5
compiler/symdefh.inc

@@ -31,11 +31,15 @@
                    classrefdef,farpointerdef);
 
        pdef = ^tdef;
+{$ifdef STORENUMBER}
+       tdef = object(tindexobject)
+{$else}
        tdef = object
-          deftype  : tdeftype;
           indexnb  : longint;
-          savesize : longint;
           next     : pdef;
+{$endif}
+          deftype  : tdeftype;
+          savesize : longint;
           owner    : psymtable;
           sym      : ptypesym;  { which type the definition was generated this def }
 
@@ -59,8 +63,8 @@
           { registers enumdef inside objects or
             record directly in the owner symtable !! }
           procedure correct_owner_symtable;
+          function  typename:string;
           procedure write;virtual;
-          procedure writename;
           function  size:longint;virtual;
 {$ifdef GDB}
           function  NumberString:string;
@@ -70,6 +74,7 @@
           procedure concatstabto(asmlist : paasmoutput);virtual;
 {$endif GDB}
           procedure deref;virtual;
+          procedure symderef;virtual;
 
           { init. tables }
           function  needs_inittable : boolean;virtual;
@@ -83,6 +88,7 @@
           procedure write_child_init_data;virtual;
 
           { rtti }
+          procedure write_rtti_name;
           function  get_rtti_label : string;virtual;
           procedure generate_rtti;virtual;
           procedure write_rtti_data;virtual;
@@ -462,7 +468,7 @@
           minval,
           maxval    : longint;
           has_jumps : boolean;
-          first     : penumsym;
+          firstenum : penumsym;
           basedef   : penumdef;
           constructor init;
           constructor init_subrange(_basedef:penumdef;_min,_max:longint);
@@ -506,7 +512,10 @@
 
 {
   $Log$
-  Revision 1.19  1999-04-08 15:57:52  peter
+  Revision 1.20  1999-04-14 09:15:00  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.19  1999/04/08 15:57:52  peter
     + subrange checking for readln()
 
   Revision 1.18  1999/03/02 18:24:21  peter

+ 13 - 2
compiler/symppu.inc

@@ -117,7 +117,11 @@
             current_ppu^.putword(p^.owner^.unitid)
            else
             current_ppu^.putword(p^.owner^.unitid);
+{$ifdef STORENUMBER}
+           current_ppu^.putword(p^.indexnr);
+{$else}
            current_ppu^.putword(p^.indexnb);
+{$endif}
          end;
       end;
 
@@ -136,7 +140,11 @@
             current_ppu^.putword(p^.owner^.unitid)
            else
             current_ppu^.putword(p^.owner^.unitid);
+{$ifdef STORENUMBER}
+           current_ppu^.putword(p^.indexnr);
+{$else}
            current_ppu^.putword(p^.indexnb);
+{$endif}
          end;
       end;
 
@@ -246,7 +254,7 @@
            end;
 {$endif def Test_Double_checksum}
 {$endif Double_checksum}
-         
+
          current_ppu^.change_endian:=source_os.endian<>target_os.endian;
        { write symbols and definitions }
          unittable^.writeasunit;
@@ -508,7 +516,10 @@
 
 {
   $Log$
-  Revision 1.35  1999-04-07 15:39:35  pierre
+  Revision 1.36  1999-04-14 09:15:01  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.35  1999/04/07 15:39:35  pierre
     + double_checksum code added
 
   Revision 1.34  1999/03/02 13:49:19  peter

+ 28 - 11
compiler/symsym.inc

@@ -26,6 +26,11 @@
 
     constructor tsym.init(const n : string);
       begin
+{$ifdef STORENUMBER}
+         inherited init;
+{$else}
+         indexnb:=0;
+{$endif}
          left:=nil;
          right:=nil;
 {$ifdef nextfield}
@@ -52,6 +57,10 @@
     constructor tsym.load;
 
       begin
+{$ifdef STORENUMBER}
+         inherited init;
+         indexnr:=readlong;
+{$endif}
          left:=nil;
          right:=nil;
          setname(readstring);
@@ -158,15 +167,20 @@
            strdispose(_name);
          if assigned(defref) then
            dispose(defref,done);
+{$ifndef STORENUMBER}
          if assigned(left) then
            dispose(left,done);
          if assigned(right) then
            dispose(right,done);
+{$endif}
       end;
 
 
     procedure tsym.write;
       begin
+{$ifdef STORENUMBER}
+         writelong(indexnr);
+{$endif}
          writestring(name);
          if object_options then
            writebyte(byte(properties));
@@ -1637,7 +1651,7 @@
          typ:=enumsym;
          definition:=penumdef(readdefref);
          value:=readlong;
-         next := Nil;
+         nextenum := Nil;
       end;
 
 
@@ -1652,25 +1666,25 @@
       var
          sym : penumsym;
       begin
-         sym := definition^.first;
+         sym := definition^.firstenum;
          if sym = nil then
           begin
-            definition^.first := @self;
-            next := nil;
+            definition^.firstenum := @self;
+            nextenum := nil;
             exit;
           end;
          { reorder the symbols in increasing value }
          if value < sym^.value then
           begin
-            next := sym;
-            definition^.first := @self;
+            nextenum := sym;
+            definition^.firstenum := @self;
           end
          else
           begin
-            while (sym^.value <= value) and assigned(sym^.next) do
-             sym := sym^.next;
-            next := sym^.next;
-            sym^.next := @self;
+            while (sym^.value <= value) and assigned(sym^.nextenum) do
+             sym := sym^.nextenum;
+            nextenum := sym^.nextenum;
+            sym^.nextenum := @self;
           end;
       end;
 
@@ -1870,7 +1884,10 @@
 
 {
   $Log$
-  Revision 1.77  1999-04-08 10:11:32  pierre
+  Revision 1.78  1999-04-14 09:15:02  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.77  1999/04/08 10:11:32  pierre
    + enable uninitilized warnings for static symbols
 
   Revision 1.76  1999/03/31 13:55:21  peter

+ 10 - 3
compiler/symsymh.inc

@@ -34,7 +34,12 @@
 
        { this object is the base for all symbol objects }
        psym = ^tsym;
+{$ifdef STORENUMBER}
+       tsym = object(tindexobject)
+{$else}
        tsym = object
+          indexnb    : longint;
+{$endif}
           typ        : tsymtyp;
           _name      : pchar;
           left,right : psym;
@@ -44,7 +49,6 @@
           speedvalue : longint;
           properties : symprop;
           owner      : psymtable;
-          indexnb    : longint;
           fileinfo   : tfileposinfo;
 {$ifdef GDB}
           isstabwritten : boolean;
@@ -306,7 +310,7 @@
        tenumsym = object(tsym)
           value : longint;
           definition : penumdef;
-          next : penumsym;
+          nextenum : penumsym;
           constructor init(const n : string;def : penumdef;v : longint);
           constructor load;
           procedure write;virtual;
@@ -334,7 +338,10 @@
 
 {
   $Log$
-  Revision 1.17  1999-03-31 13:55:23  peter
+  Revision 1.18  1999-04-14 09:15:03  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.17  1999/03/31 13:55:23  peter
     * assembler inlining working for ag386bin
 
   Revision 1.16  1999/03/24 23:17:29  peter

+ 7 - 4
compiler/tcinl.pas

@@ -89,10 +89,10 @@ implementation
                end;
              enumdef:
                begin
-                  enum:=Penumdef(Adef)^.first;
+                  enum:=Penumdef(Adef)^.firstenum;
                   if p^.inlinenumber=in_high_x then
-                    while enum^.next<>nil do
-                      enum:=enum^.next;
+                    while enum^.nextenum<>nil do
+                      enum:=enum^.nextenum;
                   hp:=genenumnode(enum);
                   disposetree(p);
                   p:=hp;
@@ -1064,7 +1064,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.23  1999-04-08 10:16:48  peter
+  Revision 1.24  1999-04-14 09:15:07  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.23  1999/04/08 10:16:48  peter
     * funcret_valid flag is set for inline functions
 
   Revision 1.22  1999/03/26 00:05:48  peter

+ 5 - 2
compiler/types.pas

@@ -770,7 +770,7 @@ implementation
               { pointers are equal.                                      }
               if (def1^.deftype = enumdef) and (def2^.deftype =enumdef) then
                 Begin
-                  if penumdef(def1)^.first = penumdef(def2)^.first then
+                  if penumdef(def1)^.firstenum = penumdef(def2)^.firstenum then
                      is_subequal := TRUE;
                 end;
             end;
@@ -781,7 +781,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.56  1999-03-24 23:17:42  peter
+  Revision 1.57  1999-04-14 09:15:08  peter
+    * first things to store the symbol/def number in the ppu
+
+  Revision 1.56  1999/03/24 23:17:42  peter
     * fixed bugs 212,222,225,227,229,231,233
 
   Revision 1.55  1999/03/09 11:45:42  pierre

Some files were not shown because too many files changed in this diff