浏览代码

* tvarsym splitted

peter 21 年之前
父节点
当前提交
6458bd0ce1
共有 50 个文件被更改,包括 1637 次插入1187 次删除
  1. 10 7
      compiler/browlog.pas
  2. 8 5
      compiler/defcmp.pas
  3. 18 13
      compiler/htypechk.pas
  4. 7 4
      compiler/i386/popt386.pas
  5. 15 9
      compiler/i386/ra386int.pas
  6. 6 3
      compiler/import.pas
  7. 32 30
      compiler/ncal.pas
  8. 6 3
      compiler/ncgbas.pas
  9. 8 5
      compiler/ncgcal.pas
  10. 10 7
      compiler/ncgflw.pas
  11. 25 20
      compiler/ncgld.pas
  12. 9 6
      compiler/ncgmem.pas
  13. 104 101
      compiler/ncgutil.pas
  14. 7 4
      compiler/nflw.pas
  15. 9 6
      compiler/ninl.pas
  16. 30 23
      compiler/nld.pas
  17. 9 6
      compiler/nmem.pas
  18. 7 4
      compiler/nobj.pas
  19. 10 7
      compiler/nutils.pas
  20. 6 9
      compiler/pdecl.pas
  21. 47 40
      compiler/pdecsub.pas
  22. 111 83
      compiler/pdecvar.pas
  23. 6 3
      compiler/pexports.pas
  24. 20 18
      compiler/pexpr.pas
  25. 9 6
      compiler/pmodules.pas
  26. 20 19
      compiler/ppu.pas
  27. 17 13
      compiler/pstatmnt.pas
  28. 20 17
      compiler/psub.pas
  29. 10 7
      compiler/psystem.pas
  30. 15 12
      compiler/ptconst.pas
  31. 13 10
      compiler/raatt.pas
  32. 59 79
      compiler/rautils.pas
  33. 9 4
      compiler/scanner.pas
  34. 14 8
      compiler/symconst.pas
  35. 51 40
      compiler/symdef.pas
  36. 487 283
      compiler/symsym.pas
  37. 52 44
      compiler/symtable.pas
  38. 17 45
      compiler/symtype.pas
  39. 10 7
      compiler/symutil.pas
  40. 5 2
      compiler/systems.pas
  41. 6 3
      compiler/systems/t_beos.pas
  42. 8 5
      compiler/systems/t_bsd.pas
  43. 6 3
      compiler/systems/t_linux.pas
  44. 6 3
      compiler/systems/t_nwl.pas
  45. 6 3
      compiler/systems/t_nwm.pas
  46. 6 3
      compiler/systems/t_sunos.pas
  47. 10 7
      compiler/systems/t_win32.pas
  48. 250 143
      compiler/utils/ppudump.pp
  49. 6 3
      compiler/x86/aasmcpu.pas
  50. 5 2
      compiler/x86/rax86att.pas

+ 10 - 7
compiler/browlog.pas

@@ -355,14 +355,14 @@ implementation
                             sym:=tstoredsym(symt.search(upper(ss)));
                        end;
                   end;
-                varsym :
+                globalvarsym,
+                localvarsym,
+                paravarsym,
+                fieldvarsym :
                   begin
-                     if tvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
+                     if tabstractvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
                        begin
-                          if tvarsym(sym).vartype.def.deftype=recorddef then
-                            symt:=trecorddef(tvarsym(sym).vartype.def).symtable
-                          else
-                            symt:=tobjectdef(tvarsym(sym).vartype.def).symtable;
+                          symt:=tabstractvarsym(sym).vartype.def.getsymtable(gs_record);
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -516,7 +516,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.19  2004-10-15 09:14:16  mazen
+  Revision 1.20  2004-11-08 22:09:58  peter
+    * tvarsym splitted
+
+  Revision 1.19  2004/10/15 09:14:16  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 8 - 5
compiler/defcmp.pas

@@ -28,9 +28,9 @@ interface
 
     uses
        cclasses,
-       globtype,globals,tokens,
+       globtype,globals,
        node,
-       symconst,symbase,symtype,symdef;
+       symconst,symtype,symdef;
 
      type
        { if acp is cp_all the var const or nothing are considered equal }
@@ -1179,8 +1179,8 @@ implementation
                 if currpara1.is_hidden<>currpara2.is_hidden then
                   exit;
                 eq:=te_equal;
-                if not(vo_is_self in tvarsym(currpara1.parasym).varoptions) and
-                   not(vo_is_self in tvarsym(currpara2.parasym).varoptions) then
+                if not(vo_is_self in tabstractvarsym(currpara1.parasym).varoptions) and
+                   not(vo_is_self in tabstractvarsym(currpara2.parasym).varoptions) then
                  begin
                    if (currpara1.paratyp<>currpara2.paratyp) then
                     exit;
@@ -1296,7 +1296,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.57  2004-11-01 10:31:48  peter
+  Revision 1.58  2004-11-08 22:09:58  peter
+    * tvarsym splitted
+
+  Revision 1.57  2004/11/01 10:31:48  peter
     * procvar arguments need to be at least equal
 
   Revision 1.56  2004/11/01 08:02:26  peter

+ 18 - 13
compiler/htypechk.pas

@@ -347,7 +347,7 @@ implementation
         result:=false;
         case pf.parast.symindex.count of
           1 : begin
-                ld:=tvarsym(pf.parast.symindex.first).vartype.def;
+                ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
                 { assignment is a special case }
                 if optoken=_ASSIGNMENT then
                   begin
@@ -370,8 +370,8 @@ implementation
                 for i:=1 to tok2nodes do
                   if tok2node[i].tok=optoken then
                     begin
-                      ld:=tvarsym(pf.parast.symindex.first).vartype.def;
-                      rd:=tvarsym(pf.parast.symindex.first.indexnext).vartype.def;
+                      ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
+                      rd:=tparavarsym(pf.parast.symindex.first.indexnext).vartype.def;
                       result:=
                         tok2node[i].op_overloading_supported and
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
@@ -635,8 +635,8 @@ implementation
             typeconvn :
               make_not_regable(ttypeconvnode(p).left);
             loadn :
-              if tloadnode(p).symtableentry.typ=varsym then
-                tvarsym(tloadnode(p).symtableentry).varregable:=vr_none;
+              if tloadnode(p).symtableentry.typ in [globalvarsym,localvarsym,paravarsym] then
+                tabstractvarsym(tloadnode(p).symtableentry).varregable:=vr_none;
          end;
       end;
 
@@ -733,7 +733,7 @@ implementation
 
     procedure set_varstate(p:tnode;newstate:tvarstate;must_be_valid:boolean);
       var
-        hsym : tvarsym;
+        hsym : tabstractvarsym;
       begin
         while assigned(p) do
          begin
@@ -765,9 +765,9 @@ implementation
                break;
              loadn :
                begin
-                 if (tloadnode(p).symtableentry.typ=varsym) then
+                 if (tloadnode(p).symtableentry.typ in [localvarsym,paravarsym,globalvarsym]) then
                   begin
-                    hsym:=tvarsym(tloadnode(p).symtableentry);
+                    hsym:=tabstractvarsym(tloadnode(p).symtableentry);
                     if must_be_valid and (hsym.varstate=vs_declared) then
                       begin
                         { Give warning/note for uninitialized locals }
@@ -1030,15 +1030,17 @@ implementation
              loadn :
                begin
                  case tloadnode(hp).symtableentry.typ of
-                   absolutesym,
-                   varsym :
+                   absolutevarsym,
+                   globalvarsym,
+                   localvarsym,
+                   paravarsym :
                      begin
                        { loop counter? }
                        if not(Valid_Const in opts) and
-                          (vo_is_loop_counter in tvarsym(tloadnode(hp).symtableentry).varoptions) then
+                          (vo_is_loop_counter in tabstractvarsym(tloadnode(hp).symtableentry).varoptions) then
                          CGMessage1(parser_e_illegal_assignment_to_count_var,tloadnode(hp).symtableentry.realname);
                        { derefed pointer }
-                       if (tvarsym(tloadnode(hp).symtableentry).varspez=vs_const) then
+                       if (tabstractvarsym(tloadnode(hp).symtableentry).varspez=vs_const) then
                         begin
                           { allow p^:= constructions with p is const parameter }
                           if gotderef or (Valid_Const in opts) then
@@ -1931,7 +1933,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.102  2004-11-01 16:58:57  peter
+  Revision 1.103  2004-11-08 22:09:58  peter
+    * tvarsym splitted
+
+  Revision 1.102  2004/11/01 16:58:57  peter
     * give IE instead of crash when no procsym is passed for calln
 
   Revision 1.101  2004/10/24 11:44:28  peter

+ 7 - 4
compiler/i386/popt386.pas

@@ -79,7 +79,7 @@ begin
           (taicpu(hp2).opcode = A_RET)) and
          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
          not(assigned(current_procinfo.procdef.funcretsym) and
-             (taicpu(p).oper[0]^.ref^.offset < tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
+             (taicpu(p).oper[0]^.ref^.offset < tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
          (taicpu(p).oper[0]^.ref^.index = NR_NO) then
         begin
           asml.remove(p);
@@ -980,7 +980,7 @@ begin
                                (taicpu(p).oper[1]^.typ = top_ref) and
                                (taicpu(p).oper[1]^.ref^.base = current_procinfo.FramePointer) and
                                not(assigned(current_procinfo.procdef.funcretsym) and
-                                   (taicpu(p).oper[1]^.ref^.offset < tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
+                                   (taicpu(p).oper[1]^.ref^.offset < tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
                                (taicpu(p).oper[1]^.ref^.index = NR_NO) and
                                (taicpu(p).oper[0]^.typ = top_reg) then
                               begin
@@ -1526,7 +1526,7 @@ begin
                          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
                          (taicpu(p).oper[0]^.ref^.index = NR_NO) and
                          not(assigned(current_procinfo.procdef.funcretsym) and
-                             (taicpu(p).oper[0]^.ref^.offset < tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
+                             (taicpu(p).oper[0]^.ref^.offset < tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset)) and
                          (hp1.typ = ait_instruction) and
                          (taicpu(hp1).opcode = A_MOV) and
                          (taicpu(hp1).opsize = S_B) and
@@ -1999,7 +1999,10 @@ end.
 
 {
   $Log$
-  Revision 1.64  2004-10-10 15:01:19  jonas
+  Revision 1.65  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.64  2004/10/10 15:01:19  jonas
     * several fixes to allocregbetween()
 
   Revision 1.63  2004/10/05 20:41:02  peter

+ 15 - 9
compiler/i386/ra386int.pas

@@ -846,8 +846,8 @@ Unit Ra386int;
                       if assigned(sym) then
                        begin
                          case sym.typ of
-                           varsym :
-                             l:=tvarsym(sym).getsize;
+                           fieldvarsym :
+                             l:=tfieldvarsym(sym).getsize;
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
@@ -914,12 +914,15 @@ Unit Ra386int;
                       if assigned(sym) then
                        begin
                          case sym.typ of
-                           varsym :
+                           globalvarsym :
                              begin
-                               if sym.owner.symtabletype in [localsymtable,parasymtable] then
-                                Message(asmr_e_no_local_or_para_allowed);
-                               hs:=tvarsym(sym).mangledname;
-                               def:=tvarsym(sym).vartype.def;
+                               hs:=tglobalvarsym(sym).mangledname;
+                               def:=tglobalvarsym(sym).vartype.def;
+                             end;
+                           localvarsym,
+                           paravarsym :
+                             begin
+                               Message(asmr_e_no_local_or_para_allowed);
                              end;
                            typedconstsym :
                              begin
@@ -1458,7 +1461,7 @@ Unit Ra386int;
                           will generate buggy code. Allow it only for explicit typecasting
                           and when the parameter is in a register (delphi compatible) }
                         if (not oper.hastype) and
-                           (tvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
+                           (oper.opr.localsym.owner.symtabletype=parasymtable) and
                            (current_procinfo.procdef.proccalloption<>pocall_register) then
                           Message(asmr_e_cannot_access_field_directly_for_parameters);
                         inc(oper.opr.localsymofs,toffset)
@@ -2014,7 +2017,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.78  2004-10-31 21:45:03  peter
+  Revision 1.79  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.78  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 6 - 3
compiler/import.pas

@@ -59,7 +59,7 @@ type
       destructor Destroy;override;
       procedure preparelib(const s:string);virtual;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);virtual;
-      procedure importvariable(vs:tvarsym;const name,module:string);virtual;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);virtual;
       procedure generatelib;virtual;
       procedure generatesmartlib;virtual;
    end;
@@ -186,7 +186,7 @@ begin
 end;
 
 
-procedure timportlib.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlib.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   NotSupported;
 end;
@@ -238,7 +238,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.24  2004-06-20 08:55:29  florian
+  Revision 1.25  2004-11-08 22:09:58  peter
+    * tvarsym splitted
+
+  Revision 1.24  2004/06/20 08:55:29  florian
     * logs truncated
 
 }

+ 32 - 30
compiler/ncal.pas

@@ -804,7 +804,7 @@ type
             while assigned(para) do
               begin
                 if para.paraitem.is_hidden and
-                   (vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) then
+                   (vo_is_funcret in tparavarsym(para.paraitem.parasym).varoptions) then
                  begin
                    para.left.free;
                    para.left := _funcretnode.getcopy;
@@ -1119,10 +1119,10 @@ type
 
     function tcallnode.gen_self_tree_methodpointer:tnode;
       var
-        hsym : tvarsym;
+        hsym : tfieldvarsym;
       begin
         { find self field in methodpointer record }
-        hsym:=tvarsym(trecorddef(methodpointertype.def).symtable.search('self'));
+        hsym:=tfieldvarsym(trecorddef(methodpointertype.def).symtable.search('self'));
         if not assigned(hsym) then
           internalerror(200305251);
         { Load tmehodpointer(right).self }
@@ -1300,7 +1300,7 @@ type
               { generate hidden tree }
               used_by_callnode:=false;
               hiddentree:=nil;
-              if (vo_is_funcret in tvarsym(currpara.parasym).varoptions) then
+              if (vo_is_funcret in tparavarsym(currpara.parasym).varoptions) then
                begin
                  { Generate funcretnode if not specified }
                  if assigned(funcretnode) then
@@ -1319,7 +1319,7 @@ type
                   end;
                end
               else
-               if vo_is_high_value in tvarsym(currpara.parasym).varoptions then
+               if vo_is_high_value in tparavarsym(currpara.parasym).varoptions then
                 begin
                   if not assigned(pt) then
                     internalerror(200304082);
@@ -1327,7 +1327,7 @@ type
                   hiddentree:=gen_high_tree(pt.left,tparaitem(currpara.previous).paratype.def);
                 end
               else
-               if vo_is_self in tvarsym(currpara.parasym).varoptions then
+               if vo_is_self in tparavarsym(currpara.parasym).varoptions then
                  begin
                    if assigned(right) then
                      hiddentree:=gen_self_tree_methodpointer
@@ -1335,12 +1335,12 @@ type
                      hiddentree:=gen_self_tree;
                  end
               else
-               if vo_is_vmt in tvarsym(currpara.parasym).varoptions then
+               if vo_is_vmt in tparavarsym(currpara.parasym).varoptions then
                  begin
                    hiddentree:=gen_vmt_tree;
                  end
               else
-               if vo_is_parentfp in tvarsym(currpara.parasym).varoptions then
+               if vo_is_parentfp in tparavarsym(currpara.parasym).varoptions then
                  begin
                    if not(assigned(procdefinition.owner.defowner)) then
                      internalerror(200309287);
@@ -1742,8 +1742,8 @@ type
 
                { The object is already used if it is called once }
                if (hpt.nodetype=loadn) and
-                  (tloadnode(hpt).symtableentry.typ=varsym) then
-                 tvarsym(tloadnode(hpt).symtableentry).varstate:=vs_used;
+                  (tloadnode(hpt).symtableentry.typ in [localvarsym,paravarsym,globalvarsym]) then
+                 tabstractvarsym(tloadnode(hpt).symtableentry).varstate:=vs_used;
              end;
 
             { if we are calling the constructor check for abstract
@@ -1898,8 +1898,7 @@ type
             else
               begin
                 { local? }
-                if (tloadnode(n).symtableentry.typ <> varsym) or
-                   (tloadnode(n).symtableentry.owner <> tprocdef(procdefinition).localst) then
+                if (tloadnode(n).symtableentry.typ <> localvarsym) then
                   exit;
                 if (tloadnode(n).symtableentry.indexnr > high(inlinelocals)) or
                    not assigned(inlinelocals[tloadnode(n).symtableentry.indexnr]) then
@@ -1927,12 +1926,12 @@ type
         tempinfo: ptempnodes absolute ptempnodes(arg);
         tempnode: ttempcreatenode;
       begin
-        if (tsymentry(p).typ <> varsym) then
+        if (tsymentry(p).typ <> localvarsym) then
           exit;
         if (p.indexnr > high(inlinelocals)) then
           setlength(inlinelocals,p.indexnr+10);
 {$ifndef VER1_0}
-        if (vo_is_funcret in tvarsym(p).varoptions) and
+        if (vo_is_funcret in tabstractvarsym(p).varoptions) and
            assigned(funcretnode) then
           begin
             if node_complexity(funcretnode) > 1 then
@@ -1943,26 +1942,26 @@ type
                 { a global variable that gets changed inside the function                }
                 internalerror(2004072101);
               end;
-            inlinelocals[tvarsym(p).indexnr] := funcretnode.getcopy
+            inlinelocals[tabstractvarsym(p).indexnr] := funcretnode.getcopy
           end
         else
 {$endif ndef VER1_0}
           begin
             if (cs_regvars in aktglobalswitches) and
-               (tvarsym(p).varregable<>vr_none) and
-               (not tvarsym(p).vartype.def.needs_inittable) then
-              tempnode := ctempcreatenode.create_reg(tvarsym(p).vartype,tvarsym(p).vartype.def.size,tt_persistent)
+               (tabstractvarsym(p).varregable<>vr_none) and
+               (not tabstractvarsym(p).vartype.def.needs_inittable) then
+              tempnode := ctempcreatenode.create_reg(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent)
             else
-              tempnode := ctempcreatenode.create(tvarsym(p).vartype,tvarsym(p).vartype.def.size,tt_persistent);
+              tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent);
             addstatement(tempinfo^.createstatement,tempnode);
-            if assigned(tvarsym(p).defaultconstsym) then
+            if assigned(tlocalvarsym(p).defaultconstsym) then
               begin
                 { warning: duplicate from psub.pas:initializevars() -> must refactor }
                 addstatement(tempinfo^.createstatement,cassignmentnode.create(
                                   ctemprefnode.create(tempnode),
-                                  cloadnode.create(tvarsym(p).defaultconstsym,tvarsym(p).defaultconstsym.owner)));
+                                  cloadnode.create(tlocalvarsym(p).defaultconstsym,tlocalvarsym(p).defaultconstsym.owner)));
               end;
-            if (vo_is_funcret in tvarsym(p).varoptions) then
+            if (vo_is_funcret in tlocalvarsym(p).varoptions) then
               begin
                 funcretnode := ctemprefnode.create(tempnode);
                 addstatement(tempinfo^.deletestatement,ctempdeletenode.create_normal_temp(tempnode));
@@ -1988,14 +1987,14 @@ type
         para := tcallparanode(left);
         while assigned(para) do
           begin
-            if (para.paraitem.parasym.typ = varsym) and
+            if (para.paraitem.parasym.typ = paravarsym) and
                { para.left will already be the same as funcretnode in the following case, so don't change }
-               (not(vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) or
+               (not(vo_is_funcret in tparavarsym(para.paraitem.parasym).varoptions) or
                 (not assigned(funcretnode))) then
               begin
                 { create temps for value parameters, function result and also for    }
                 { const parameters which are passed by value instead of by reference }
-                if (vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) or
+                if (vo_is_funcret in tparavarsym(para.paraitem.parasym).varoptions) or
                    (para.paraitem.paratyp = vs_value) or
                    ((para.paraitem.paratyp = vs_const) and
                     (not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption) or
@@ -2003,8 +2002,8 @@ type
                      (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
                   begin
                     if (cs_regvars in aktglobalswitches) and
-                       (tvarsym(para.paraitem.parasym).varregable<>vr_none) and
-                       (not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
+                       (tparavarsym(para.paraitem.parasym).varregable<>vr_none) and
+                       (not tparavarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
                       tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
                     else
                       tempnode := ctempcreatenode.create(para.left.resulttype,para.left.resulttype.def.size,tt_persistent);
@@ -2012,7 +2011,7 @@ type
                     { assign the value of the parameter to the temp, except in case of the function result }
                     { (in that case, para.left is a block containing the creation of a new temp, while we  }
                     {  only need a temprefnode, so delete the old stuff)                                   }
-                    if not(vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) then
+                    if not(vo_is_funcret in tparavarsym(para.paraitem.parasym).varoptions) then
                       begin
                         addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                           para.left));
@@ -2031,7 +2030,7 @@ type
                 else if node_complexity(para.left) > 1 then
                   begin
                     if (cs_regvars in aktglobalswitches) and
-                       not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable then
+                       not tparavarsym(para.paraitem.parasym).vartype.def.needs_inittable then
                       tempnode := ctempcreatenode.create_reg(voidpointertype,voidpointertype.def.size,tt_persistent)
                     else
                       tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
@@ -2414,7 +2413,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.257  2004-11-02 12:55:16  peter
+  Revision 1.258  2004-11-08 22:09:58  peter
+    * tvarsym splitted
+
+  Revision 1.257  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 6 - 3
compiler/ncgbas.pas

@@ -134,7 +134,7 @@ interface
 
       procedure ResolveRef(var op:toper);
         var
-          sym : tvarsym;
+          sym : tlocalvarsym;
 {$ifdef x86}
           scale : byte;
 {$endif x86}
@@ -150,7 +150,7 @@ interface
               scale:=op.localoper^.localscale;
 {$endif x86}
               getoffset:=op.localoper^.localgetoffset;
-              sym:=tvarsym(pointer(op.localoper^.localsym));
+              sym:=tlocalvarsym(pointer(op.localoper^.localsym));
               dispose(op.localoper);
               case sym.localloc.loc of
                 LOC_REFERENCE :
@@ -491,7 +491,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.69  2004-10-31 21:45:03  peter
+  Revision 1.70  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.69  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 8 - 5
compiler/ncgcal.pas

@@ -386,7 +386,7 @@ implementation
                begin
                  { don't push a node that already generated a pointer type
                    by address for implicit hidden parameters }
-                 if (vo_is_funcret in tvarsym(paraitem.parasym).varoptions) or
+                 if (vo_is_funcret in tparavarsym(paraitem.parasym).varoptions) or
                     (not(left.resulttype.def.deftype in [pointerdef,classrefdef]) and
                      paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
                          aktcallnode.procdefinition.proccalloption)) then
@@ -398,7 +398,7 @@ implementation
              else if (paraitem.paratype.def.deftype=formaldef) then
                begin
                   { allow passing of a constant to a const formaldef }
-                  if (tvarsym(paraitem.parasym).varspez=vs_const) and
+                  if (tparavarsym(paraitem.parasym).varspez=vs_const) and
                      (left.location.loc=LOC_CONSTANT) then
                     location_force_mem(exprasmlist,left.location);
 
@@ -461,7 +461,7 @@ implementation
              { update return location in callnode when this is the function
                result }
              if assigned(paraitem.parasym) and
-                (vo_is_funcret in tvarsym(paraitem.parasym).varoptions) then
+                (vo_is_funcret in tparavarsym(paraitem.parasym).varoptions) then
                location_copy(aktcallnode.location,left.location);
            end;
 
@@ -663,7 +663,7 @@ implementation
                begin
                  { don't release the funcret temp }
                  if not(assigned(ppn.paraitem.parasym)) or
-                    not(vo_is_funcret in tvarsym(ppn.paraitem.parasym).varoptions) then
+                    not(vo_is_funcret in tparavarsym(ppn.paraitem.parasym).varoptions) then
                    location_freetemp(exprasmlist,ppn.left.location);
                  { process also all nodes of an array of const }
                  if ppn.left.nodetype=arrayconstructorn then
@@ -1253,7 +1253,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.183  2004-11-01 17:41:28  florian
+  Revision 1.184  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.183  2004/11/01 17:41:28  florian
     * fixed arm compilation with cgutils
     * ...
 

+ 10 - 7
compiler/ncgflw.pas

@@ -1158,11 +1158,11 @@ implementation
          { what a hack ! }
          if assigned(exceptsymtable) then
            begin
-             tvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_REFERENCE;
-             tvarsym(exceptsymtable.symindex.first).localloc.size:=OS_ADDR;
+             tlocalvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_REFERENCE;
+             tlocalvarsym(exceptsymtable.symindex.first).localloc.size:=OS_ADDR;
              tg.GetLocal(exprasmlist,sizeof(aint),voidpointertype.def,
-                tvarsym(exceptsymtable.symindex.first).localloc.reference);
-             cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,tvarsym(exceptsymtable.symindex.first).localloc.reference);
+                tlocalvarsym(exceptsymtable.symindex.first).localloc.reference);
+             cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference);
            end
          else
            begin
@@ -1221,8 +1221,8 @@ implementation
          { clear some stuff }
          if assigned(exceptsymtable) then
            begin
-             tg.UngetLocal(exprasmlist,tvarsym(exceptsymtable.symindex.first).localloc.reference);
-             tvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_INVALID;
+             tg.UngetLocal(exprasmlist,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference);
+             tlocalvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_INVALID;
            end
          else
            tg.Ungettemp(exprasmlist,exceptref);
@@ -1443,7 +1443,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.101  2004-10-24 11:44:28  peter
+  Revision 1.102  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.101  2004/10/24 11:44:28  peter
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
 

+ 25 - 20
compiler/ncgld.pas

@@ -72,7 +72,7 @@ implementation
     procedure tcgloadnode.generate_picvaraccess;
       begin
         location.reference.base:=current_procinfo.got;
-        location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA);
+        location.reference.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA);
       end;
 
 
@@ -90,20 +90,20 @@ implementation
          newsize:=def_cgsize(resulttype.def);
          location_reset(location,LOC_REFERENCE,newsize);
          case symtableentry.typ of
-            absolutesym :
+            absolutevarsym :
                begin
                   { this is only for toasm and toaddr }
-                  case tabsolutesym(symtableentry).abstyp of
+                  case tabsolutevarsym(symtableentry).abstyp of
                     toaddr :
                       begin
 {$ifdef i386}
-                        if tabsolutesym(symtableentry).absseg then
+                        if tabsolutevarsym(symtableentry).absseg then
                           location.reference.segment:=NR_FS;
 {$endif i386}
-                        location.reference.offset:=tabsolutesym(symtableentry).fieldoffset;
+                        location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                       end;
                     toasm :
-                      location.reference.symbol:=objectlibrary.newasmsymbol(tabsolutesym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
+                      location.reference.symbol:=objectlibrary.newasmsymbol(tabsolutevarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
                     else
                       internalerror(200310283);
                   end;
@@ -119,12 +119,14 @@ implementation
                  else
                    internalerror(22798);
               end;
-            varsym :
+            globalvarsym,
+            localvarsym,
+            paravarsym :
                begin
                   symtabletype:=symtable.symtabletype;
                   hregister:=NR_NO;
                   { DLL variable }
-                  if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
+                  if (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then
                     begin
                       if target_info.system=system_powerpc_darwin then
                         begin
@@ -135,13 +137,13 @@ implementation
                       else
                         begin
                           hregister:=cg.getaddressregister(exprasmlist);
-                          location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
+                          location.reference.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
                           cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister);
                           reference_reset_base(location.reference,hregister,0);
                         end;
                     end
                   { Thread variable }
-                  else if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
+                  else if (vo_is_thread_var in tabstractvarsym(symtableentry).varoptions) then
                     begin
                        {
                          Thread var loading is optimized to first check if
@@ -163,7 +165,7 @@ implementation
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister);
                        cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,norelocatelab);
                        { don't save the allocated register else the result will be destroyed later }
-                       reference_reset_symbol(href,objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0);
+                       reference_reset_symbol(href,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0);
                        paramanager.allocparaloc(exprasmlist,paraloc1);
                        cg.a_param_ref(exprasmlist,OS_ADDR,href,paraloc1);
                        paramanager.freeparaloc(exprasmlist,paraloc1);
@@ -181,7 +183,7 @@ implementation
                          layout of a threadvar is (4 bytes pointer):
                            0 - Threadvar index
                            4 - Threadvar value in single threading }
-                       reference_reset_symbol(href,objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),sizeof(aint));
+                       reference_reset_symbol(href,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),sizeof(aint));
                        cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
                        cg.a_label(exprasmlist,endrelocatelab);
                        location.reference.base:=hregister;
@@ -194,10 +196,10 @@ implementation
                       secondpass(left);
                       if left.location.loc<>LOC_REGISTER then
                         internalerror(200309286);
-                      if tvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
+                      if tabstractnormalvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
                         internalerror(200409241);
                       hregister:=left.location.register;
-                      reference_reset_base(location.reference,hregister,tvarsym(symtableentry).localloc.reference.offset);
+                      reference_reset_base(location.reference,hregister,tabstractnormalvarsym(symtableentry).localloc.reference.offset);
                     end
                   { Normal (or external) variable }
                   else
@@ -229,7 +231,7 @@ implementation
                               stt_exceptsymtable,
                               localsymtable,
                               parasymtable :
-                                location:=tvarsym(symtableentry).localloc;
+                                location:=tabstractnormalvarsym(symtableentry).localloc;
                               globalsymtable,
                               staticsymtable :
                                 begin
@@ -241,10 +243,10 @@ implementation
                                     end
                                   else
                                     begin
-                                      if tvarsym(symtableentry).localloc.loc=LOC_INVALID then
-                                        reference_reset_symbol(location.reference,objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0)
+                                      if tabstractnormalvarsym(symtableentry).localloc.loc=LOC_INVALID then
+                                        reference_reset_symbol(location.reference,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0)
                                       else
-                                        location:=tvarsym(symtableentry).localloc;
+                                        location:=tglobalvarsym(symtableentry).localloc;
                                     end;
                                 end;
                               else
@@ -272,7 +274,7 @@ implementation
                     end;
 
                   { make const a LOC_CREFERENCE }
-                  if (tvarsym(symtableentry).varspez=vs_const) and
+                  if (tabstractvarsym(symtableentry).varspez=vs_const) and
                      (location.loc=LOC_REFERENCE) then
                     location.loc:=LOC_CREFERENCE;
                end;
@@ -955,7 +957,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.130  2004-11-01 15:32:12  peter
+  Revision 1.131  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.130  2004/11/01 15:32:12  peter
     * support @labelsym
 
   Revision 1.129  2004/10/31 21:45:03  peter

+ 9 - 6
compiler/ncgmem.pas

@@ -163,7 +163,7 @@ implementation
     procedure tcgloadparentfpnode.pass_2;
       var
         currpi : tprocinfo;
-        hsym   : tvarsym;
+        hsym   : tparavarsym;
         href   : treference;
       begin
         if (current_procinfo.procdef.parast.symtablelevel=parentpd.parast.symtablelevel) then
@@ -177,7 +177,7 @@ implementation
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location.register:=cg.getaddressregister(exprasmlist);
             { load framepointer of current proc }
-            hsym:=tvarsym(currpi.procdef.parast.search('parentfp'));
+            hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
             if not assigned(hsym) then
               internalerror(200309281);
             cg.a_load_loc_reg(exprasmlist,OS_ADDR,hsym.localloc,location.register);
@@ -187,7 +187,7 @@ implementation
                 currpi:=currpi.parent;
                 if not assigned(currpi) then
                   internalerror(200311201);
-                hsym:=tvarsym(currpi.procdef.parast.search('parentfp'));
+                hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
                 if not assigned(hsym) then
                   internalerror(200309282);
                 if hsym.localloc.loc<>LOC_REFERENCE then
@@ -223,7 +223,7 @@ implementation
             (left.nodetype=loadn) and
             (tloadnode(left).resulttype.def.deftype=procvardef) and
             assigned(tloadnode(left).symtableentry) and
-            (tloadnode(left).symtableentry.typ=varsym) then
+            (tloadnode(left).symtableentry.typ in [globalvarsym,localvarsym,paravarsym]) then
            cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register)
          else
            cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
@@ -506,7 +506,7 @@ implementation
             if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
              begin
                { Get high value }
-               hightree:=load_high_value_node(tvarsym(tloadnode(left).symtableentry));
+               hightree:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry));
                { it must be available }
                if not assigned(hightree) then
                  internalerror(200212201);
@@ -878,7 +878,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.101  2004-11-01 23:30:11  peter
+  Revision 1.102  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.101  2004/11/01 23:30:11  peter
     * support > 32bit accesses for x86_64
     * rewrote array size checking to support 64bit
 

+ 104 - 101
compiler/ncgutil.pas

@@ -101,7 +101,7 @@ interface
     procedure free_exception(list:TAAsmoutput;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean);
 
     procedure insertconstdata(sym : ttypedconstsym);
-    procedure insertbssdata(sym : tvarsym);
+    procedure insertbssdata(sym : tglobalvarsym);
 
     procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable);
     procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable);
@@ -721,52 +721,52 @@ implementation
         href : treference;
         hreg : tregister;
         list : TAAsmoutput;
-        hsym : tvarsym;
+        hsym : tparavarsym;
         l    : longint;
         localcopyloc : tlocation;
       begin
         list:=taasmoutput(arg);
-        if (tsym(p).typ=varsym) and
-           (tvarsym(p).varspez=vs_value) and
-           (paramanager.push_addr_param(tvarsym(p).varspez,tvarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then
+        if (tsym(p).typ=paravarsym) and
+           (tparavarsym(p).varspez=vs_value) and
+           (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then
          begin
-           location_get_data_ref(list,tvarsym(p).localloc,href,true);
-           if is_open_array(tvarsym(p).vartype.def) or
-              is_array_of_const(tvarsym(p).vartype.def) then
+           location_get_data_ref(list,tparavarsym(p).localloc,href,true);
+           if is_open_array(tparavarsym(p).vartype.def) or
+              is_array_of_const(tparavarsym(p).vartype.def) then
             begin
               { cdecl functions don't have a high pointer so it is not possible to generate
                 a local copy }
               if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
                 begin
-                  hsym:=tvarsym(tsym(p).owner.search('high'+p.name));
+                  hsym:=tparavarsym(tsym(p).owner.search('high'+p.name));
                   if not assigned(hsym) then
                     internalerror(200306061);
                   hreg:=cg.getaddressregister(list);
-                  cg.g_copyvaluepara_openarray(list,href,hsym.localloc,tarraydef(tvarsym(p).vartype.def).elesize,hreg);
-                  cg.a_load_reg_loc(list,OS_ADDR,hreg,tvarsym(p).localloc);
+                  cg.g_copyvaluepara_openarray(list,href,hsym.localloc,tarraydef(tparavarsym(p).vartype.def).elesize,hreg);
+                  cg.a_load_reg_loc(list,OS_ADDR,hreg,tparavarsym(p).localloc);
                 end;
             end
            else
             begin
               { Allocate space for the local copy }
-              l:=tvarsym(p).getsize;
+              l:=tparavarsym(p).getsize;
               localcopyloc.loc:=LOC_REFERENCE;
               localcopyloc.size:=int_cgsize(l);
-              tg.GetLocal(list,l,tvarsym(p).vartype.def,localcopyloc.reference);
+              tg.GetLocal(list,l,tparavarsym(p).vartype.def,localcopyloc.reference);
               { Copy data }
-              if is_shortstring(tvarsym(p).vartype.def) then
+              if is_shortstring(tparavarsym(p).vartype.def) then
                 begin
                   { this code is only executed before the code for the body and the entry/exit code is generated
                     so we're allowed to include pi_do_call here; after pass1 is run, this isn't allowed anymore
                   }
                   include(current_procinfo.flags,pi_do_call);
-                  cg.g_copyshortstring(list,href,localcopyloc.reference,tstringdef(tvarsym(p).vartype.def).len)
+                  cg.g_copyshortstring(list,href,localcopyloc.reference,tstringdef(tparavarsym(p).vartype.def).len)
                 end
               else
-                cg.g_concatcopy(list,href,localcopyloc.reference,tvarsym(p).vartype.def.size);
+                cg.g_concatcopy(list,href,localcopyloc.reference,tparavarsym(p).vartype.def.size);
               { update localloc of varsym }
-              tg.Ungetlocal(list,tvarsym(p).localloc.reference);
-              tvarsym(p).localloc:=localcopyloc;
+              tg.Ungetlocal(list,tparavarsym(p).localloc.reference);
+              tparavarsym(p).localloc:=localcopyloc;
             end;
          end;
       end;
@@ -775,11 +775,12 @@ implementation
     { initializes the regvars from staticsymtable with 0 }
     procedure initialize_regvars(p : tnamedindexitem;arg:pointer);
       begin
-        if (tsym(p).typ=varsym) then
+        if (tsym(p).typ=globalvarsym) then
          begin
-           case tvarsym(p).localloc.loc of
+           case tglobalvarsym(p).localloc.loc of
              LOC_CREGISTER :
-               cg.a_load_const_reg(taasmoutput(arg),reg_cgsize(tvarsym(p).localloc.register),0,tvarsym(p).localloc.register);
+               cg.a_load_const_reg(taasmoutput(arg),reg_cgsize(tglobalvarsym(p).localloc.register),0,
+                   tglobalvarsym(p).localloc.register);
              LOC_REFERENCE : ;
              else
                internalerror(200410124);
@@ -794,10 +795,10 @@ implementation
         oldexprasmlist : TAAsmoutput;
         hp : tnode;
       begin
-        if (tsym(p).typ=varsym) and
-           (tvarsym(p).refs>0) and
-           not(is_class(tvarsym(p).vartype.def)) and
-           tvarsym(p).vartype.def.needs_inittable then
+        if (tsym(p).typ in [globalvarsym,localvarsym]) and
+           (tabstractvarsym(p).refs>0) and
+           not(is_class(tabstractvarsym(p).vartype.def)) and
+           tabstractvarsym(p).vartype.def.needs_inittable then
          begin
            oldexprasmlist:=exprasmlist;
            exprasmlist:=taasmoutput(arg);
@@ -829,16 +830,12 @@ implementation
     { generates the code for finalisation of local variables }
     procedure finalize_local_vars(p : tnamedindexitem;arg:pointer);
       begin
-        case tsym(p).typ of
-          varsym :
-            begin
-              if (tvarsym(p).refs>0) and
-                 not(vo_is_funcret in tvarsym(p).varoptions) and
-                 not(is_class(tvarsym(p).vartype.def)) and
-                 tvarsym(p).vartype.def.needs_inittable then
-                finalize_sym(taasmoutput(arg),tsym(p));
-            end;
-        end;
+        if (tsym(p).typ=localvarsym) and
+           (tlocalvarsym(p).refs>0) and
+           not(vo_is_funcret in tlocalvarsym(p).varoptions) and
+           not(is_class(tlocalvarsym(p).vartype.def)) and
+           tlocalvarsym(p).vartype.def.needs_inittable then
+          finalize_sym(taasmoutput(arg),tsym(p));
       end;
 
 
@@ -878,12 +875,12 @@ implementation
         pd : tprocdef;
       begin
         case tsym(p).typ of
-          varsym :
+          globalvarsym :
             begin
-              if (tvarsym(p).refs>0) and
-                 not(vo_is_funcret in tvarsym(p).varoptions) and
-                 not(is_class(tvarsym(p).vartype.def)) and
-                 tvarsym(p).vartype.def.needs_inittable then
+              if (tglobalvarsym(p).refs>0) and
+                 not(vo_is_funcret in tglobalvarsym(p).varoptions) and
+                 not(is_class(tglobalvarsym(p).vartype.def)) and
+                 tglobalvarsym(p).vartype.def.needs_inittable then
                 finalize_sym(taasmoutput(arg),tsym(p));
             end;
           typedconstsym :
@@ -916,22 +913,22 @@ implementation
         list : TAAsmoutput;
       begin
         list:=taasmoutput(arg);
-        if (tsym(p).typ=varsym) and
-           not is_class_or_interface(tvarsym(p).vartype.def) and
-           tvarsym(p).vartype.def.needs_inittable then
+        if (tsym(p).typ=paravarsym) and
+           not is_class_or_interface(tparavarsym(p).vartype.def) and
+           tparavarsym(p).vartype.def.needs_inittable then
          begin
-           case tvarsym(p).varspez of
+           case tparavarsym(p).varspez of
              vs_value :
                begin
-                 location_get_data_ref(list,tvarsym(p).localloc,href,is_open_array(tvarsym(p).vartype.def));
-                 cg.g_incrrefcount(list,tvarsym(p).vartype.def,href);
+                 location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vartype.def));
+                 cg.g_incrrefcount(list,tparavarsym(p).vartype.def,href);
                end;
              vs_out :
                begin
                  tmpreg:=cg.getaddressregister(list);
-                 cg.a_load_loc_reg(list,OS_ADDR,tvarsym(p).localloc,tmpreg);
+                 cg.a_load_loc_reg(list,OS_ADDR,tparavarsym(p).localloc,tmpreg);
                  reference_reset_base(href,tmpreg,0);
-                 cg.g_initialize(list,tvarsym(p).vartype.def,href);
+                 cg.g_initialize(list,tparavarsym(p).vartype.def,href);
                end;
            end;
          end;
@@ -945,29 +942,30 @@ implementation
         href : treference;
         l : tlocation;
       begin
+        if not(tsym(p).typ=paravarsym) then
+          exit;
         list:=taasmoutput(arg);
-        if (tsym(p).typ=varsym) and
-           not is_class_or_interface(tvarsym(p).vartype.def) and
-           tvarsym(p).vartype.def.needs_inittable then
+        if not is_class_or_interface(tparavarsym(p).vartype.def) and
+           tparavarsym(p).vartype.def.needs_inittable then
          begin
-           location_get_data_ref(list,tvarsym(p).localloc,href,is_open_array(tvarsym(p).vartype.def));
-           if (tvarsym(p).varspez=vs_value) then
+           location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vartype.def));
+           if (tparavarsym(p).varspez=vs_value) then
             begin
               include(current_procinfo.flags,pi_needs_implicit_finally);
-              location_get_data_ref(list,tvarsym(p).localloc,href,is_open_array(tvarsym(p).vartype.def));
-              cg.g_decrrefcount(list,tvarsym(p).vartype.def,href);
+              location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vartype.def));
+              cg.g_decrrefcount(list,tparavarsym(p).vartype.def,href);
             end;
          end
-        else if (tsym(p).typ=varsym) and
-          (tvarsym(p).varspez=vs_value) and
-          (is_open_array(tvarsym(p).vartype.def) or
-           is_array_of_const(tvarsym(p).vartype.def)) then
-          begin
-            { cdecl functions don't have a high pointer so it is not possible to generate
-              a local copy }
-            if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
-              cg.g_releasevaluepara_openarray(list,tvarsym(p).localloc);
-          end;
+        else
+         if (tparavarsym(p).varspez=vs_value) and
+            (is_open_array(tparavarsym(p).vartype.def) or
+             is_array_of_const(tparavarsym(p).vartype.def)) then
+           begin
+             { cdecl functions don't have a high pointer so it is not possible to generate
+               a local copy }
+             if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
+               cg.g_releasevaluepara_openarray(list,tparavarsym(p).localloc);
+           end;
       end;
 
 
@@ -1016,7 +1014,7 @@ implementation
 {$ifndef cpu64bit}
         href   : treference;
 {$endif cpu64bit}
-        ressym : tvarsym;
+        ressym : tabstractnormalvarsym;
         resloc,
         restmploc : tlocation;
         hreg   : tregister;
@@ -1027,7 +1025,7 @@ implementation
            (
             (po_assembler in current_procinfo.procdef.procoptions) and
             (not(assigned(current_procinfo.procdef.funcretsym)) or
-             (tvarsym(current_procinfo.procdef.funcretsym).refs=0))
+             (tabstractvarsym(current_procinfo.procdef.funcretsym).refs=0))
            ) then
            exit;
 
@@ -1037,9 +1035,9 @@ implementation
 
         { constructors return self }
         if (current_procinfo.procdef.proctypeoption=potype_constructor) then
-          ressym:=tvarsym(current_procinfo.procdef.parast.search('self'))
+          ressym:=tabstractnormalvarsym(current_procinfo.procdef.parast.search('self'))
         else
-          ressym:=tvarsym(current_procinfo.procdef.funcretsym);
+          ressym:=tabstractnormalvarsym(current_procinfo.procdef.funcretsym);
         if (ressym.refs>0) then
           begin
 {$ifdef OLDREGVARS}
@@ -1304,10 +1302,10 @@ implementation
             paraloc:=hp.paraloc[calleeside].location;
             if not assigned(paraloc) then
               internalerror(200408203);
-            case tvarsym(hp.parasym).localloc.loc of
+            case tabstractnormalvarsym(hp.parasym).localloc.loc of
               LOC_REFERENCE :
                 begin
-                  href:=tvarsym(hp.parasym).localloc.reference;
+                  href:=tparavarsym(hp.parasym).localloc.reference;
                   while assigned(paraloc) do
                     begin
                       unget_para(paraloc^);
@@ -1319,28 +1317,28 @@ implementation
               LOC_CREGISTER :
                 begin
 {$ifndef cpu64bit}
-                  if tvarsym(hp.parasym).localloc.size in [OS_64,OS_S64] then
+                  if tparavarsym(hp.parasym).localloc.size in [OS_64,OS_S64] then
                     begin
                       { First 32bits }
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reghi)
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reghi)
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reglo);
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reglo);
                       { Second 32bits }
                       if not assigned(paraloc^.next) then
                         internalerror(200410104);
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reglo)
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reglo)
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reghi);
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reghi);
                     end
                   else
 {$endif cpu64bit}
                     begin
                       unget_para(paraloc^);
-                      gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register);
+                      gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register);
                       if assigned(paraloc^.next) then
                         internalerror(200410105);
                     end;
@@ -1363,7 +1361,7 @@ implementation
                   tg.UnGetTemp(list,tempref);
 {$else sparc}
                   unget_para(paraloc^);
-                  gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register);
+                  gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register);
                   if assigned(paraloc^.next) then
                     internalerror(200410109);
 {$endif sparc}
@@ -1371,7 +1369,7 @@ implementation
               LOC_CMMREGISTER :
                 begin
                   unget_para(paraloc^);
-                  gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register);
+                  gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register);
                   if assigned(paraloc^.next) then
                     internalerror(200410108);
                 end;
@@ -1619,30 +1617,30 @@ implementation
                tostr(N_LSYM)+',0,0,'+tostr(current_procinfo.parent_framepointer_offset)))); }
 
             if assigned(current_procinfo.procdef.funcretsym) and
-               (tvarsym(current_procinfo.procdef.funcretsym).refs>0) then
+               (tabstractnormalvarsym(current_procinfo.procdef.funcretsym).refs>0) then
               begin
-                if tvarsym(current_procinfo.procdef.funcretsym).localloc.loc=LOC_REFERENCE then
+                if tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.loc=LOC_REFERENCE then
                   begin
 {$warning Need to add gdb support for ret in param register calling}
                     if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
                       begin
                         list.concat(Tai_stabs.Create(strpnew(
                            '"'+current_procinfo.procdef.procsym.name+':X*'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
-                           tostr(N_tsym)+',0,0,'+tostr(tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
+                           tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
                         if (m_result in aktmodeswitches) then
                           list.concat(Tai_stabs.Create(strpnew(
                              '"RESULT:X*'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
-                             tostr(N_tsym)+',0,0,'+tostr(tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))))
+                             tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))))
                       end
                     else
                       begin
                         list.concat(Tai_stabs.Create(strpnew(
                            '"'+current_procinfo.procdef.procsym.name+':X'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
-                           tostr(N_tsym)+',0,0,'+tostr(tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
+                           tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
                         if (m_result in aktmodeswitches) then
                           list.concat(Tai_stabs.Create(strpnew(
                              '"RESULT:X'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
-                             tostr(N_tsym)+',0,0,'+tostr(tvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
+                             tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.reference.offset))));
                        end;
                   end;
               end;
@@ -1812,7 +1810,7 @@ implementation
       end;
 
 
-    procedure insertbssdata(sym : tvarsym);
+    procedure insertbssdata(sym : tglobalvarsym);
       var
         l,varalign : longint;
         storefilepos : tfileposinfo;
@@ -1852,16 +1850,16 @@ implementation
         sym:=tsym(st.symindex.first);
         while assigned(sym) do
           begin
-            if (sym.typ=varsym) then
+            if (sym.typ in [globalvarsym,localvarsym,paravarsym]) then
               begin
-                with tvarsym(sym) do
+                with tabstractnormalvarsym(sym) do
                   begin
                     { Parameters passed to assembler procedures need to be kept
                       in the original location }
-                    if (st.symtabletype=parasymtable) and
+                    if (sym.typ=paravarsym) and
                        (po_assembler in current_procinfo.procdef.procoptions) then
                       begin
-                        paraitem.paraloc[calleeside].get_location(localloc);
+                        tparavarsym(sym).paraitem.paraloc[calleeside].get_location(localloc);
                       end
                     else
                       begin
@@ -1916,10 +1914,10 @@ implementation
                               parasymtable :
                                 begin
                                   { Reuse the parameter location for values to are at a single location on the stack }
-                                  if (paraitem.paraloc[calleeside].is_simple_reference) then
+                                  if (tparavarsym(sym).paraitem.paraloc[calleeside].is_simple_reference) then
                                     begin
-                                      reference_reset_base(localloc.reference,paraitem.paraloc[calleeside].location^.reference.index,
-                                          paraitem.paraloc[calleeside].location^.reference.offset);
+                                      reference_reset_base(localloc.reference,tparavarsym(sym).paraitem.paraloc[calleeside].location^.reference.index,
+                                          tparavarsym(sym).paraitem.paraloc[calleeside].location^.reference.offset);
                                     end
                                   else
                                     begin
@@ -1981,9 +1979,9 @@ implementation
         sym:=tsym(st.symindex.first);
         while assigned(sym) do
           begin
-            if (sym.typ=varsym) then
+            if (sym.typ in [globalvarsym,localvarsym,paravarsym]) then
               begin
-                with tvarsym(sym) do
+                with tabstractnormalvarsym(sym) do
                   begin
                     { Note: We need to keep the data available in memory
                       for the sub procedures that can access local data
@@ -2019,9 +2017,9 @@ implementation
         sym:=tsym(pd.parast.symindex.first);
         while assigned(sym) do
           begin
-            if sym.typ=varsym then
+            if sym.typ=paravarsym then
               begin
-                with tvarsym(sym) do
+                with tparavarsym(sym) do
                   begin
                     { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
                     localloc.loc:=LOC_REFERENCE;
@@ -2086,7 +2084,7 @@ implementation
            (po_assembler in pd.procoptions) then
           exit;
         { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
-        with tvarsym(pd.funcretsym) do
+        with tlocalvarsym(pd.funcretsym) do
           begin
             localloc.loc:=LOC_REFERENCE;
             localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline));
@@ -2182,8 +2180,10 @@ implementation
         case p.typ of
           typesym :
             def:=tstoreddef(ttypesym(p).restype.def);
-          varsym :
-            def:=tstoreddef(tvarsym(p).vartype.def);
+          globalvarsym,
+          localvarsym,
+          paravarsym :
+            def:=tstoreddef(tabstractvarsym(p).vartype.def);
           else
             internalerror(200108263);
         end;
@@ -2212,7 +2212,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.237  2004-11-08 20:23:29  florian
+  Revision 1.238  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.237  2004/11/08 20:23:29  florian
     * fixed open arrays when using register variables
 
   Revision 1.236  2004/11/04 17:12:24  peter

+ 7 - 4
compiler/nflw.pas

@@ -677,7 +677,7 @@ implementation
           exclude(loopflags,lnf_dont_mind_loopvar_on_exit);
           writeln('Loopvar does matter on exit');
         end;
-      Tvarsym(symbol).unregister_notification(loopvar_notid);
+      Tabstractvarsym(symbol).unregister_notification(loopvar_notid);
     end;
 
     function tfornode.det_resulttype:tnode;
@@ -729,7 +729,7 @@ implementation
 
     function tfornode.pass_1 : tnode;
       var
-         old_t_times : longint; 
+         old_t_times : longint;
      begin
          result:=nil;
          expectloc:=LOC_VOID;
@@ -746,7 +746,7 @@ implementation
             if codegenerror then
              exit;
           end;
-           
+
          registersint:=t1.registersint;
          registersfpu:=t1.registersfpu;
 {$ifdef SUPPORT_MMX}
@@ -1424,7 +1424,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.101  2004-10-15 09:14:17  mazen
+  Revision 1.102  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.101  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 9 - 6
compiler/ninl.pas

@@ -305,7 +305,7 @@ implementation
         temp          : ttempcreatenode;
         procprefix,
         name          : string[31];
-        srsym         : tvarsym;
+        srsym         : tglobalvarsym;
         tempowner     : tsymtable;
         readfunctype  : ttype;
         is_typed,
@@ -1448,7 +1448,7 @@ implementation
                   set_varstate(left,vs_used,false);
                   if paramanager.push_high_param(vs_value,left.resulttype.def,current_procinfo.procdef.proccalloption) then
                    begin
-                     hightree:=load_high_value_node(tvarsym(tloadnode(left).symtableentry));
+                     hightree:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry));
                      if assigned(hightree) then
                       begin
                         hp:=caddnode.create(addn,hightree,
@@ -1616,7 +1616,7 @@ implementation
                         if is_open_array(left.resulttype.def) or
                            is_array_of_const(left.resulttype.def) then
                          begin
-                           hightree:=load_high_value_node(tvarsym(tloadnode(left).symtableentry));
+                           hightree:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry));
                            if assigned(hightree) then
                             begin
                               hp:=caddnode.create(addn,hightree,
@@ -1853,7 +1853,7 @@ implementation
                            if is_open_array(left.resulttype.def) or
                               is_array_of_const(left.resulttype.def) then
                             begin
-                              result:=load_high_value_node(tvarsym(tloadnode(left).symtableentry));
+                              result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry));
                             end
                            else
                             if is_dynamic_array(left.resulttype.def) then
@@ -1882,7 +1882,7 @@ implementation
                         else
                          begin
                            if is_open_string(left.resulttype.def) then
-                            result:=load_high_value_node(tvarsym(tloadnode(left).symtableentry))
+                            result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry))
                            else
                             result:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8inttype,true);
                          end;
@@ -2442,7 +2442,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.149  2004-11-02 12:55:16  peter
+  Revision 1.150  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.149  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 30 - 23
compiler/nld.pas

@@ -230,10 +230,10 @@ implementation
     function tloadnode.is_addr_param_load:boolean;
       begin
         result:=(symtable.symtabletype=parasymtable) and
-                (symtableentry.typ=varsym) and
-                not(vo_has_local_copy in tvarsym(symtableentry).varoptions) and
+                (symtableentry.typ=paravarsym) and
+                not(vo_has_local_copy in tparavarsym(symtableentry).varoptions) and
                 not(nf_load_self_pointer in flags) and
-                paramanager.push_addr_param(tvarsym(symtableentry).varspez,tvarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption);
+                paramanager.push_addr_param(tparavarsym(symtableentry).varspez,tparavarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption);
       end;
 
 
@@ -241,8 +241,8 @@ implementation
       begin
          result:=nil;
          case symtableentry.typ of
-           absolutesym :
-             resulttype:=tabsolutesym(symtableentry).vartype;
+           absolutevarsym :
+             resulttype:=tabsolutevarsym(symtableentry).vartype;
            constsym:
              begin
                if tconstsym(symtableentry).consttyp=constresourcestring then
@@ -263,9 +263,11 @@ implementation
                else
                  internalerror(22799);
              end;
-           varsym :
+           globalvarsym,
+           paravarsym,
+           localvarsym :
              begin
-               inc(tvarsym(symtableentry).refs);
+               inc(tabstractvarsym(symtableentry).refs);
                { Nested variable? The we need to load the framepointer of
                  the parent procedure }
                if assigned(current_procinfo) then
@@ -292,7 +294,7 @@ implementation
                  end;
                { fix self type which is declared as voidpointer in the
                  definition }
-               if vo_is_self in tvarsym(symtableentry).varoptions then
+               if vo_is_self in tabstractvarsym(symtableentry).varoptions then
                  begin
                    resulttype.setdef(tprocdef(symtableentry.owner.defowner)._class);
                    if (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) or
@@ -302,13 +304,13 @@ implementation
                            (nf_load_self_pointer in flags) then
                      resulttype.setdef(tpointerdef.create(resulttype));
                  end
-               else if vo_is_vmt in tvarsym(symtableentry).varoptions then
+               else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then
                  begin
                    resulttype.setdef(tprocdef(symtableentry.owner.defowner)._class);
                    resulttype.setdef(tclassrefdef.create(resulttype));
                  end
                else
-                 resulttype:=tvarsym(symtableentry).vartype;
+                 resulttype:=tabstractvarsym(symtableentry).vartype;
              end;
            typedconstsym :
              resulttype:=ttypedconstsym(symtableentry).typedconsttype;
@@ -353,7 +355,7 @@ implementation
          registersmmx:=0;
 {$endif SUPPORT_MMX}
          case symtableentry.typ of
-            absolutesym :
+            absolutevarsym :
               ;
             constsym:
               begin
@@ -363,14 +365,16 @@ implementation
                       expectloc:=LOC_CREFERENCE;
                    end;
               end;
-            varsym :
+            globalvarsym,
+            localvarsym,
+            paravarsym :
               begin
                 if assigned(left) then
                   firstpass(left);
                 if not is_addr_param_load and
-                   tvarsym(symtableentry).is_regvar then
+                   tabstractvarsym(symtableentry).is_regvar then
                   begin
-                    case tvarsym(symtableentry).varregable of
+                    case tabstractvarsym(symtableentry).varregable of
                       vr_intreg :
                         expectloc:=LOC_CREGISTER;
                       vr_fpureg :
@@ -380,25 +384,25 @@ implementation
                     end
                   end
                 else
-                  if (tvarsym(symtableentry).varspez=vs_const) then
+                  if (tabstractvarsym(symtableentry).varspez=vs_const) then
                     expectloc:=LOC_CREFERENCE;
                 { we need a register for call by reference parameters }
-                if paramanager.push_addr_param(tvarsym(symtableentry).varspez,tvarsym(symtableentry).vartype.def,pocall_default) then
+                if paramanager.push_addr_param(tabstractvarsym(symtableentry).varspez,tabstractvarsym(symtableentry).vartype.def,pocall_default) then
                   registersint:=1;
-                if ([vo_is_thread_var,vo_is_dll_var]*tvarsym(symtableentry).varoptions)<>[] then
+                if ([vo_is_thread_var,vo_is_dll_var]*tabstractvarsym(symtableentry).varoptions)<>[] then
                   registersint:=1;
-                if (target_info.system=system_powerpc_darwin) and (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
+                if (target_info.system=system_powerpc_darwin) and (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then
                   include(current_procinfo.flags,pi_needs_got);
                 { call to get address of threadvar }
-                if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
+                if (vo_is_thread_var in tabstractvarsym(symtableentry).varoptions) then
                   include(current_procinfo.flags,pi_do_call);
                 if nf_write in flags then
-                  Tvarsym(symtableentry).trigger_notifications(vn_onwrite)
+                  Tabstractvarsym(symtableentry).trigger_notifications(vn_onwrite)
                 else
-                  Tvarsym(symtableentry).trigger_notifications(vn_onread);
+                  Tabstractvarsym(symtableentry).trigger_notifications(vn_onread);
                 { count variable references }
                 if cg.t_times>1 then
-                  inc(tvarsym(symtableentry).refs,cg.t_times-1);
+                  inc(tabstractvarsym(symtableentry).refs,cg.t_times-1);
               end;
             typedconstsym :
                 ;
@@ -1168,7 +1172,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.138  2004-11-02 12:55:16  peter
+  Revision 1.139  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.138  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 9 - 6
compiler/nmem.pas

@@ -77,7 +77,7 @@ interface
        tderefnodeclass = class of tderefnode;
 
        tsubscriptnode = class(tunarynode)
-          vs : tvarsym;
+          vs : tfieldvarsym;
           vsderef : tderef;
           constructor create(varsym : tsym;l : tnode);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
@@ -433,8 +433,8 @@ implementation
 {$ifdef i386}
             if assigned(hp) and
                (hp.nodetype=loadn) and
-               ((tloadnode(hp).symtableentry.typ=absolutesym) and
-                tabsolutesym(tloadnode(hp).symtableentry).absseg) then
+               ((tloadnode(hp).symtableentry.typ=absolutevarsym) and
+                tabsolutevarsym(tloadnode(hp).symtableentry).absseg) then
              begin
                if not(nf_typedaddr in flags) then
                  resulttype:=voidfarpointertype
@@ -558,7 +558,7 @@ implementation
       begin
          inherited create(subscriptn,l);
          { vs should be changed to tsym! }
-         vs:=tvarsym(varsym);
+         vs:=tfieldvarsym(varsym);
       end;
 
     constructor tsubscriptnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
@@ -585,7 +585,7 @@ implementation
     procedure tsubscriptnode.derefimpl;
       begin
         inherited derefimpl;
-        vs:=tvarsym(vsderef.resolve);
+        vs:=tfieldvarsym(vsderef.resolve);
       end;
 
 
@@ -982,7 +982,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.87  2004-11-02 12:55:16  peter
+  Revision 1.88  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.87  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 7 - 4
compiler/nobj.pas

@@ -1375,10 +1375,10 @@ implementation
         end;
       hsym:=tsym(procdef.parast.search('self'));
       if not(assigned(hsym) and
-             (hsym.typ=varsym) and
-             assigned(tvarsym(hsym).paraitem)) then
+             (hsym.typ=paravarsym) and
+             assigned(tparavarsym(hsym).paraitem)) then
         internalerror(200305251);
-      paraloc:=tvarsym(hsym).paraitem.paraloc[callerside].location^;
+      paraloc:=tparavarsym(hsym).paraitem.paraloc[callerside].location^;
       case paraloc.loc of
         LOC_REGISTER:
           cg.a_op_const_reg(exprasmlist,OP_SUB,paraloc.size,ioffset,paraloc.register);
@@ -1400,7 +1400,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.79  2004-10-24 13:35:39  peter
+  Revision 1.80  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.79  2004/10/24 13:35:39  peter
     * fixed writing of methodtable
 
   Revision 1.78  2004/10/15 09:14:17  mazen

+ 10 - 7
compiler/nutils.pas

@@ -54,7 +54,7 @@ interface
 
     procedure load_procvar_from_calln(var p1:tnode);
     function maybe_call_procvar(var p1:tnode;tponly:boolean):boolean;
-    function load_high_value_node(vs:tvarsym):tnode;
+    function load_high_value_node(vs:tparavarsym):tnode;
     function load_self_node:tnode;
     function load_result_node:tnode;
     function load_self_pointer_node:tnode;
@@ -236,7 +236,7 @@ implementation
       end;
 
 
-    function load_high_value_node(vs:tvarsym):tnode;
+    function load_high_value_node(vs:tparavarsym):tnode;
       var
         srsym : tsym;
         srsymtable : tsymtable;
@@ -326,8 +326,8 @@ implementation
     function is_self_node(p:tnode):boolean;
       begin
         is_self_node:=(p.nodetype=loadn) and
-                      (tloadnode(p).symtableentry.typ=varsym) and
-                      (vo_is_self in tvarsym(tloadnode(p).symtableentry).varoptions);
+                      (tloadnode(p).symtableentry.typ=paravarsym) and
+                      (vo_is_self in tparavarsym(tloadnode(p).symtableentry).varoptions);
       end;
 
 
@@ -456,8 +456,8 @@ implementation
               loadn:
                 begin
 		  { threadvars need a helper call }
-                  if (tloadnode(p).symtableentry.typ=varsym) and
-		     (vo_is_thread_var in tvarsym(tloadnode(p).symtableentry).varoptions) then
+                  if (tloadnode(p).symtableentry.typ=globalvarsym) and
+		     (vo_is_thread_var in tglobalvarsym(tloadnode(p).symtableentry).varoptions) then
                     inc(result,5)
                   else
                     inc(result);
@@ -519,7 +519,10 @@ end.
 
 {
   $Log$
-  Revision 1.20  2004-11-02 12:55:16  peter
+  Revision 1.21  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.20  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 6 - 9
compiler/pdecl.pas

@@ -60,9 +60,6 @@ implementation
        nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
        { codegen }
        ncgutil,
-{$ifdef GDB}
-       gdb,
-{$endif GDB}
        { parser }
        scanner,
        pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
@@ -279,11 +276,8 @@ implementation
          case tsym(p).typ of
            typesym :
              pd:=ttypesym(p).restype.def;
-           varsym :
-             if (tsym(p).owner.symtabletype in [objectsymtable,recordsymtable]) then
-               pd:=tvarsym(p).vartype.def
-             else
-               exit;
+           fieldvarsym :
+             pd:=tfieldvarsym(p).vartype.def
            else
              exit;
          end;
@@ -659,7 +653,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.89  2004-10-15 09:14:17  mazen
+  Revision 1.90  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.89  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 47 - 40
compiler/pdecsub.pas

@@ -93,7 +93,7 @@ implementation
     procedure insert_funcret_para(pd:tabstractprocdef);
       var
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
       begin
         if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
            not is_void(pd.rettype.def) and
@@ -104,7 +104,7 @@ implementation
             akttokenpos:=tprocdef(pd).fileinfo;
 
            { Generate result variable accessing function result }
-           vs:=tvarsym.create('$result',vs_var,pd.rettype);
+           vs:=tparavarsym.create('$result',vs_var,pd.rettype);
            include(vs.varoptions,vo_is_funcret);
            pd.parast.insert(vs);
            { For left to right add it at the end to be delphi compatible }
@@ -124,7 +124,7 @@ implementation
     procedure insert_parentfp_para(pd:tabstractprocdef);
       var
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
       begin
         if pd.parast.symtablelevel>normal_function_level then
           begin
@@ -135,7 +135,7 @@ implementation
             { Generate result variable accessing function result, it
               can't be put in a register since it must be accessable
               from the framepointer }
-            vs:=tvarsym.create('$parentfp',vs_var,voidpointertype);
+            vs:=tparavarsym.create('$parentfp',vs_var,voidpointertype);
             include(vs.varoptions,vo_is_parentfp);
             vs.varregable:=vr_none;
             pd.parast.insert(vs);
@@ -149,7 +149,7 @@ implementation
     procedure insert_self_and_vmt_para(pd:tabstractprocdef);
       var
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
         tt       : ttype;
         vsp      : tvarspez;
       begin
@@ -158,7 +158,7 @@ implementation
           begin
             { Generate self variable }
             tt:=voidpointertype;
-            vs:=tvarsym.create('$self',vs_value,tt);
+            vs:=tparavarsym.create('$self',vs_value,tt);
             include(vs.varoptions,vo_is_self);
             { Insert as hidden parameter }
             pd.parast.insert(vs);
@@ -179,7 +179,7 @@ implementation
                    { can't use classrefdef as type because inheriting
                      will then always file because of a type mismatch }
                    tt:=voidpointertype;
-                   vs:=tvarsym.create('$vmt',vs_value,tt);
+                   vs:=tparavarsym.create('$vmt',vs_value,tt);
                    include(vs.varoptions,vo_is_vmt);
                    { Insert as hidden parameter }
                    pd.parast.insert(vs);
@@ -202,7 +202,7 @@ implementation
                       vsp:=vs_var;
                     tt.setdef(tprocdef(pd)._class);
                   end;
-                vs:=tvarsym.create('$self',vsp,tt);
+                vs:=tparavarsym.create('$self',vsp,tt);
                 include(vs.varoptions,vo_is_self);
                 { Insert as hidden parameter }
                 pd.parast.insert(vs);
@@ -217,7 +217,8 @@ implementation
     procedure insert_funcret_local(pd:tprocdef);
       var
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tlocalvarsym;
+        aliasvs  : tabsolutevarsym;
         sl       : tsymlist;
       begin
         { The result from constructors and destructors can't be accessed directly }
@@ -235,7 +236,7 @@ implementation
              when it is returning in a register }
            if not paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
             begin
-              vs:=tvarsym.create('$result',vs_value,pd.rettype);
+              vs:=tlocalvarsym.create('$result',vs_value,pd.rettype);
               include(vs.varoptions,vo_is_funcret);
               pd.localst.insert(vs);
               pd.funcretsym:=vs;
@@ -248,19 +249,19 @@ implementation
             pd.resultname:=pd.procsym.name;
            sl:=tsymlist.create;
            sl.addsym(sl_load,pd.funcretsym);
-           vs:=tabsolutesym.create_ref(pd.resultname,pd.rettype,sl);
-           include(vs.varoptions,vo_is_funcret);
-           pd.localst.insert(vs);
+           aliasvs:=tabsolutevarsym.create_ref(pd.resultname,pd.rettype,sl);
+           include(aliasvs.varoptions,vo_is_funcret);
+           pd.localst.insert(aliasvs);
 
            { insert result also if support is on }
            if (m_result in aktmodeswitches) then
             begin
               sl:=tsymlist.create;
               sl.addsym(sl_load,pd.funcretsym);
-              vs:=tabsolutesym.create_ref('RESULT',pd.rettype,sl);
-              include(vs.varoptions,vo_is_funcret);
-              include(vs.varoptions,vo_is_result);
-              pd.localst.insert(vs);
+              aliasvs:=tabsolutevarsym.create_ref('RESULT',pd.rettype,sl);
+              include(aliasvs.varoptions,vo_is_funcret);
+              include(aliasvs.varoptions,vo_is_result);
+              pd.localst.insert(aliasvs);
             end;
 
            akttokenpos:=storepos;
@@ -271,7 +272,7 @@ implementation
     procedure insert_hidden_para(pd:tabstractprocdef);
       var
         currpara : tparaitem;
-        hvs : tvarsym;
+        hvs : tparavarsym;
       begin
         { walk from right to left, so we can insert the
           high parameters after the current parameter }
@@ -283,9 +284,9 @@ implementation
             begin
               if assigned(currpara.parasym) then
                begin
-                 hvs:=tvarsym.create('$high'+tvarsym(currpara.parasym).name,vs_const,sinttype);
+                 hvs:=tparavarsym.create('$high'+tparavarsym(currpara.parasym).name,vs_const,sinttype);
                  include(hvs.varoptions,vo_is_high_value);
-                 tvarsym(currpara.parasym).owner.insert(hvs);
+                 tparavarsym(currpara.parasym).owner.insert(hvs);
                end
               else
                hvs:=nil;
@@ -311,9 +312,9 @@ implementation
 
     procedure check_c_para(p:tnamedindexitem;arg:pointer);
       begin
-        if (tsym(p).typ<>varsym) then
+        if (tsym(p).typ<>paravarsym) then
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
          begin
            case vartype.def.deftype of
              arraydef :
@@ -326,8 +327,8 @@ implementation
                   end;
                  if is_array_of_const(vartype.def) and
                     assigned(indexnext) and
-                    (tsym(indexnext).typ=varsym) and
-                    not(vo_is_high_value in tvarsym(indexnext).varoptions) then
+                    (tsym(indexnext).typ=paravarsym) and
+                    not(vo_is_high_value in tparavarsym(indexnext).varoptions) then
                    Message(parser_e_C_array_of_const_must_be_last);
                end;
             end;
@@ -337,9 +338,9 @@ implementation
 
     procedure set_addr_param_regable(p:tnamedindexitem;arg:pointer);
       begin
-        if (tsym(p).typ<>varsym) then
+        if (tsym(p).typ<>paravarsym) then
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
          begin
            if not vartype.def.needs_inittable and
               paramanager.push_addr_param(varspez,vartype.def,tprocdef(arg).proccalloption) then
@@ -356,7 +357,7 @@ implementation
         sc      : tsinglelist;
         tt      : ttype;
         arrayelementtype : ttype;
-        vs      : tvarsym;
+        vs      : tparavarsym;
         srsym   : tsym;
         hs1 : string;
         varspez : Tvarspez;
@@ -409,7 +410,7 @@ implementation
           { read identifiers and insert with error type }
           sc.reset;
           repeat
-            vs:=tvarsym.create(orgpattern,varspez,generrortype);
+            vs:=tparavarsym.create(orgpattern,varspez,generrortype);
             currparast.insert(vs);
             if assigned(vs.owner) then
              sc.insert(vs)
@@ -493,7 +494,7 @@ implementation
                  begin
                    if try_to_consume(_EQUAL) then
                     begin
-                      vs:=tvarsym(sc.first);
+                      vs:=tparavarsym(sc.first);
                       if assigned(vs.listnext) then
                         Message(parser_e_default_value_only_one_para);
                       { prefix 'def' to the parameter name }
@@ -528,7 +529,7 @@ implementation
              (varspez<>vs_var) then
             CGMessage(cg_e_file_must_call_by_reference);
 
-          vs:=tvarsym(sc.first);
+          vs:=tparavarsym(sc.first);
           while assigned(vs) do
            begin
              { update varsym }
@@ -551,7 +552,7 @@ implementation
                    if explicit_paraloc then
                      Message(parser_e_paraloc_all_paras);
                end;
-             vs:=tvarsym(vs.listnext);
+             vs:=tparavarsym(vs.listnext);
            end;
         until not try_to_consume(_SEMICOLON);
 
@@ -931,7 +932,7 @@ implementation
                         Message(parser_e_comparative_operator_return_boolean);
                      if (optoken=_ASSIGNMENT) and
                         equal_defs(pd.rettype.def,
-                           tvarsym(pd.parast.symindex.first).vartype.def) then
+                           tparavarsym(pd.parast.symindex.first).vartype.def) then
                        message(parser_e_no_such_assignment)
                      else if not isoperatoracceptable(pd,optoken) then
                        Message(parser_e_overload_impossible);
@@ -1887,10 +1888,10 @@ const
         currpara:=tparaitem(pd.para.first);
         while assigned(currpara) do
          begin
-           if not(assigned(currpara.parasym) and (currpara.parasym.typ=varsym)) then
+           if not(assigned(currpara.parasym) and (currpara.parasym.typ=paravarsym)) then
              internalerror(200304232);
            { connect parasym to paraitem }
-           tvarsym(currpara.parasym).paraitem:=currpara;
+           tparavarsym(currpara.parasym).paraitem:=currpara;
            { We need a local copy for a value parameter when only the
              address is pushed. Open arrays and Array of Const are
              an exception because they are allocated at runtime and the
@@ -1899,7 +1900,7 @@ const
               paramanager.push_addr_param(currpara.paratyp,currpara.paratype.def,pd.proccalloption) and
               not(is_open_array(currpara.paratype.def) or
                   is_array_of_const(currpara.paratype.def)) then
-             include(tvarsym(currpara.parasym).varoptions,vo_has_local_copy);
+             include(tparavarsym(currpara.parasym).varoptions,vo_has_local_copy);
            currpara:=tparaitem(currpara.next);
          end;
       end;
@@ -1961,8 +1962,11 @@ const
         pdflags:=[pd_procvar];
         pd:=nil;
         case sym.typ of
-          varsym :
-            pd:=tabstractprocdef(tvarsym(sym).vartype.def);
+          fieldvarsym,
+          globalvarsym,
+          localvarsym,
+          paravarsym :
+            pd:=tabstractprocdef(tabstractvarsym(sym).vartype.def);
           typedconstsym :
             pd:=tabstractprocdef(ttypedconstsym(sym).typedconsttype.def);
           typesym :
@@ -2132,9 +2136,9 @@ const
                       fd:=tsym(pd.parast.symindex.first);
                       repeat
                         { skip default parameter constsyms }
-                        while assigned(ad) and (ad.typ<>varsym) do
+                        while assigned(ad) and (ad.typ<>paravarsym) do
                          ad:=tsym(ad.indexnext);
-                        while assigned(fd) and (fd.typ<>varsym) do
+                        while assigned(fd) and (fd.typ<>paravarsym) do
                          fd:=tsym(fd.indexnext);
                         { stop when one of the two lists is at the end }
                         if not assigned(ad) or not assigned(fd) then
@@ -2259,7 +2263,10 @@ const
 end.
 {
   $Log$
-  Revision 1.199  2004-11-05 21:16:55  peter
+  Revision 1.200  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.199  2004/11/05 21:16:55  peter
     * rename duplicate symbols and insert with unique name in the
       symtable
 

+ 111 - 83
compiler/pdecvar.pas

@@ -82,10 +82,10 @@ implementation
                if assigned(sym) then
                 begin
                   case sym.typ of
-                    varsym :
+                    fieldvarsym :
                       begin
                         pl.addsym(sl_load,sym);
-                        def:=tvarsym(sym).vartype.def;
+                        def:=tfieldvarsym(sym).vartype.def;
                       end;
                     procsym :
                       begin
@@ -119,8 +119,8 @@ implementation
                               begin
                                 pl.addsym(sl_subscript,sym);
                                 case sym.typ of
-                                  varsym :
-                                    def:=tvarsym(sym).vartype.def;
+                                  fieldvarsym :
+                                    def:=tfieldvarsym(sym).vartype.def;
                                   else
                                     begin
                                       Message1(sym_e_illegal_field,pattern);
@@ -209,8 +209,8 @@ implementation
          propname : stringid;
          sc : tsinglelist;
          oldregisterdef : boolean;
-         readvs,
-         hvs      : tvarsym;
+         hreadparavs,
+         hparavs      : tparavarsym;
          readprocdef,
          writeprocdef : tprocvardef;
          oldsymtablestack : tsymtable;
@@ -275,9 +275,9 @@ implementation
                   varspez:=vs_value;
                 sc.reset;
                 repeat
-                  readvs:=tvarsym.create(orgpattern,varspez,generrortype);
-                  readprocdef.parast.insert(readvs);
-                  sc.insert(readvs);
+                  hreadparavs:=tparavarsym.create(orgpattern,varspez,generrortype);
+                  readprocdef.parast.insert(hreadparavs);
+                  sc.insert(hreadparavs);
                   consume(_ID);
                 until not try_to_consume(_COMMA);
                 if try_to_consume(_COLON) then
@@ -301,15 +301,15 @@ implementation
                   end
                 else
                   tt:=cformaltype;
-                readvs:=tvarsym(sc.first);
-                while assigned(readvs) do
+                hreadparavs:=tparavarsym(sc.first);
+                while assigned(hreadparavs) do
                  begin
-                   readprocdef.concatpara(nil,tt,readvs,nil,false);
+                   readprocdef.concatpara(nil,tt,hreadparavs,nil,false);
                    { also update the writeprocdef }
-                   hvs:=tvarsym.create(readvs.realname,vs_value,generrortype);
-                   writeprocdef.parast.insert(hvs);
-                   writeprocdef.concatpara(nil,tt,hvs,nil,false);
-                   readvs:=tvarsym(readvs.listnext);
+                   hparavs:=tparavarsym.create(hreadparavs.realname,vs_value,generrortype);
+                   writeprocdef.parast.insert(hparavs);
+                   writeprocdef.concatpara(nil,tt,hparavs,nil,false);
+                   hreadparavs:=tparavarsym(hreadparavs.listnext);
                  end;
               until not try_to_consume(_SEMICOLON);
               sc.free;
@@ -354,12 +354,12 @@ implementation
                    p.indextype.setdef(pt.resulttype.def);
                    include(p.propoptions,ppo_indexed);
                    { concat a longint to the para templates }
-                   hvs:=tvarsym.create('$index',vs_value,p.indextype);
-                   readprocdef.parast.insert(hvs);
-                   readprocdef.concatpara(nil,p.indextype,hvs,nil,false);
-                   hvs:=tvarsym.create('$index',vs_value,p.indextype);
-                   writeprocdef.parast.insert(hvs);
-                   writeprocdef.concatpara(nil,p.indextype,hvs,nil,false);
+                   hparavs:=tparavarsym.create('$index',vs_value,p.indextype);
+                   readprocdef.parast.insert(hparavs);
+                   readprocdef.concatpara(nil,p.indextype,hparavs,nil,false);
+                   hparavs:=tparavarsym.create('$index',vs_value,p.indextype);
+                   writeprocdef.parast.insert(hparavs);
+                   writeprocdef.concatpara(nil,p.indextype,hparavs,nil,false);
                    pt.free;
                 end;
            end
@@ -403,7 +403,7 @@ implementation
                      if not assigned(p.readaccess.procdef) then
                        Message(parser_e_ill_property_access_sym);
                    end;
-                 varsym :
+                 fieldvarsym :
                    begin
                      if not assigned(def) then
                        internalerror(200310071);
@@ -437,9 +437,9 @@ implementation
                      { write is a procedure with an extra value parameter
                        of the of the property }
                      writeprocdef.rettype:=voidtype;
-                     hvs:=tvarsym.create('$value',vs_value,p.proptype);
-                     writeprocdef.parast.insert(hvs);
-                     writeprocdef.concatpara(nil,p.proptype,hvs,nil,false);
+                     hparavs:=tparavarsym.create('$value',vs_value,p.proptype);
+                     writeprocdef.parast.insert(hparavs);
+                     writeprocdef.concatpara(nil,p.proptype,hparavs,nil,false);
                      { Insert hidden parameters }
                      handle_calling_convention(writeprocdef);
                      calc_parast(writeprocdef);
@@ -448,7 +448,7 @@ implementation
                      if not assigned(p.writeaccess.procdef) then
                        Message(parser_e_ill_property_access_sym);
                    end;
-                 varsym :
+                 fieldvarsym :
                    begin
                      if not assigned(def) then
                        internalerror(200310072);
@@ -495,7 +495,7 @@ implementation
                                    if not assigned(p.storedaccess.procdef) then
                                      message(parser_e_ill_property_storage_sym);
                                 end;
-                              varsym :
+                              fieldvarsym :
                                 begin
                                   if not assigned(def) then
                                     internalerror(200310073);
@@ -595,9 +595,10 @@ implementation
       procedure insert_syms(sc : tsinglelist;tt : ttype;is_threadvar : boolean; addsymopts : tsymoptions);
       { inserts the symbols of sc in st with def as definition or sym as ttypesym, sc is disposed }
         var
-          vs,vs2 : tvarsym;
+          vs : tabstractvarsym;
+          hstaticvs : tglobalvarsym;
         begin
-           vs:=tvarsym(sc.first);
+           vs:=tabstractvarsym(sc.first);
            while assigned(vs) do
              begin
                 vs.vartype:=tt;
@@ -611,9 +612,9 @@ implementation
                 if (symtablestack.symtabletype=objectsymtable) and
                    (sp_static in current_object_option) then
                   begin
-                     vs2:=tvarsym.create('$'+lower(symtablestack.name^)+'_'+vs.name,vs_value,tt);
-                     symtablestack.defowner.owner.insert(vs2);
-                     insertbssdata(vs2);
+                     hstaticvs:=tglobalvarsym.create('$'+lower(symtablestack.name^)+'_'+vs.name,vs_value,tt);
+                     symtablestack.defowner.owner.insert(hstaticvs);
+                     insertbssdata(hstaticvs);
                   end
                 else
                   begin
@@ -621,23 +622,23 @@ implementation
                     case symtablestack.symtabletype of
                       globalsymtable,
                       staticsymtable :
-                        insertbssdata(vs);
+                        insertbssdata(tglobalvarsym(vs));
                       recordsymtable,
                       objectsymtable :
-                        tabstractrecordsymtable(symtablestack).insertfield(vs,false);
+                        tabstractrecordsymtable(symtablestack).insertfield(tfieldvarsym(vs),false);
                     end;
                   end;
-                vs:=tvarsym(vs.listnext);
+                vs:=tabstractvarsym(vs.listnext);
              end;
         end;
 
 
       procedure read_default_value(sc : tsinglelist;tt : ttype;is_threadvar : boolean);
         var
-          vs : tvarsym;
+          vs : tabstractnormalvarsym;
           tcsym : ttypedconstsym;
         begin
-          vs:=tvarsym(sc.first);
+          vs:=tabstractnormalvarsym(sc.first);
           if assigned(vs.listnext) then
              Message(parser_e_initialized_only_one_var);
           if is_threadvar then
@@ -668,7 +669,7 @@ implementation
          old_block_type : tblock_type;
          symdone : boolean;
          { to handle absolute }
-         abssym : tabsolutesym;
+         abssym : tabsolutevarsym;
          { c var }
          newtype : ttypesym;
          is_dll,
@@ -685,14 +686,15 @@ implementation
          maxalignment,startvarrecalign,
          maxpadalign, startpadalign: shortint;
          hp,pt : tnode;
-         vs,vs2    : tvarsym;
+         fieldvs   : tfieldvarsym;
+         vs,vs2    : tabstractvarsym;
          srsym : tsym;
          oldsymtablestack,
          srsymtable : tsymtable;
          unionsymtable : trecordsymtable;
          offset : longint;
          uniondef : trecorddef;
-         unionsym : tvarsym;
+         unionsym : tfieldvarsym;
          uniontype : ttype;
          dummysymoptions : tsymoptions;
          semicolonatend: boolean;
@@ -722,7 +724,18 @@ implementation
              sorg:=orgpattern;
              sc.reset;
              repeat
-               vs:=tvarsym.create(orgpattern,vs_value,generrortype);
+               case symtablestack.symtabletype of
+                 localsymtable :
+                   vs:=tlocalvarsym.create(orgpattern,vs_value,generrortype);
+                 staticsymtable,
+                 globalsymtable :
+                   vs:=tglobalvarsym.create(orgpattern,vs_value,generrortype);
+                 recordsymtable,
+                 objectsymtable :
+                   vs:=tfieldvarsym.create(orgpattern,vs_value,generrortype);
+                 else
+                   internalerror(200411064);
+               end;
                symtablestack.insert(vs);
                if assigned(vs.owner) then
                 sc.insert(vs)
@@ -805,13 +818,18 @@ implementation
 
              if is_gpc_name then
                begin
-                  vs:=tvarsym(sc.first);
+                  vs:=tabstractvarsym(sc.first);
                   if assigned(vs.listnext) then
                     Message(parser_e_absolute_only_one_var);
                   vs.vartype:=tt;
-                  include(vs.varoptions,vo_is_C_var);
-                  vs.set_mangledname(target_info.Cprefix+sorg);
-                  include(vs.varoptions,vo_is_external);
+                  if vs.typ=globalvarsym then
+                    begin
+                      tglobalvarsym(vs).set_mangledname(target_info.Cprefix+sorg);
+                      include(vs.varoptions,vo_is_C_var);
+                      include(vs.varoptions,vo_is_external);
+                    end
+                  else
+                    Message(parser_e_not_external_and_export);
                   symdone:=true;
                end;
 
@@ -822,7 +840,7 @@ implementation
                 consume(_ABSOLUTE);
                 abssym:=nil;
                 { only allowed for one var }
-                vs:=tvarsym(sc.first);
+                vs:=tabstractvarsym(sc.first);
                 if assigned(vs.listnext) then
                   Message(parser_e_absolute_only_one_var);
                 { parse the rest }
@@ -831,7 +849,7 @@ implementation
                 if (pt.nodetype=stringconstn) or
                    (is_constcharnode(pt)) then
                  begin
-                   abssym:=tabsolutesym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,tt);
                    abssym.fileinfo:=vs.fileinfo;
                    if pt.nodetype=stringconstn then
                      hs:=strpas(tstringconstnode(pt).value_str)
@@ -851,10 +869,10 @@ implementation
                          (m_objfpc in aktmodeswitches) or
                          (m_delphi in aktmodeswitches)) then
                  begin
-                   abssym:=tabsolutesym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,tt);
                    abssym.fileinfo:=vs.fileinfo;
                    abssym.abstyp:=toaddr;
-                   abssym.fieldoffset:=tordconstnode(pt).value;
+                   abssym.addroffset:=tordconstnode(pt).value;
 {$ifdef i386}
                    abssym.absseg:=false;
                    if (target_info.system in [system_i386_go32v2,system_i386_watcom]) and
@@ -864,7 +882,7 @@ implementation
                       pt:=expr;
                       if is_constintnode(pt) then
                         begin
-                          abssym.fieldoffset:=abssym.fieldoffset shl 4+tordconstnode(pt).value;
+                          abssym.addroffset:=abssym.addroffset shl 4+tordconstnode(pt).value;
                           abssym.absseg:=true;
                         end
                       else
@@ -884,9 +902,10 @@ implementation
                     if (hp.nodetype=loadn) then
                      begin
                        { we should check the result type of loadn }
-                       if not (tloadnode(hp).symtableentry.typ in [varsym,typedconstsym]) then
+                       if not (tloadnode(hp).symtableentry.typ in [fieldvarsym,globalvarsym,localvarsym,
+                                                                   paravarsym,typedconstsym]) then
                          Message(parser_e_absolute_only_to_var_or_const);
-                       abssym:=tabsolutesym.create(vs.realname,tt);
+                       abssym:=tabsolutevarsym.create(vs.realname,tt);
                        abssym.fileinfo:=vs.fileinfo;
                        abssym.abstyp:=tovar;
                        abssym.ref:=node_to_symlist(pt);
@@ -997,7 +1016,7 @@ implementation
                    ) then
                  begin
                    { only allowed for one var }
-                   vs:=tvarsym(sc.first);
+                   vs:=tabstractvarsym(sc.first);
                    if assigned(vs.listnext) then
                      Message(parser_e_absolute_only_one_var);
                    { set type of the var }
@@ -1044,8 +1063,7 @@ implementation
                    if idtoken in [_EXPORT,_PUBLIC] then
                     begin
                       consume(_ID);
-                      if extern_var or
-                         (symtablestack.symtabletype in [parasymtable,localsymtable]) then
+                      if extern_var then
                        Message(parser_e_not_external_and_export)
                       else
                        begin
@@ -1078,35 +1096,42 @@ implementation
                    if (is_dll) and
                       (target_info.system = system_powerpc_darwin) then
                      C_Name := target_info.Cprefix+C_Name;
-                   vs.set_mangledname(C_Name);
 
                    if export_var then
                     begin
                       inc(vs.refs);
                       include(vs.varoptions,vo_is_exported);
                     end;
+
                    if extern_var then
                     include(vs.varoptions,vo_is_external);
-                   { insert in the datasegment when it is not external }
-                   if (not extern_var) then
-                     insertbssdata(vs);
-                   { now we can insert it in the import lib if its a dll, or
-                     add it to the externals }
-                   if extern_var then
-                    begin
-                      if is_dll then
-                       begin
-                         if not(current_module.uses_imports) then
-                          begin
-                            current_module.uses_imports:=true;
-                            importlib.preparelib(current_module.modulename^);
-                          end;
-                         importlib.importvariable(vs,C_name,dll_name);
-                       end
-                      else
-                       if target_info.DllScanSupported then
-                        current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
-                    end;
+
+                   if vs.typ=globalvarsym then
+                     begin
+                       tglobalvarsym(vs).set_mangledname(C_Name);
+                       { insert in the datasegment when it is not external }
+                       if (not extern_var) then
+                         insertbssdata(tglobalvarsym(vs));
+                       { now we can insert it in the import lib if its a dll, or
+                         add it to the externals }
+                       if extern_var then
+                        begin
+                          if is_dll then
+                           begin
+                             if not(current_module.uses_imports) then
+                              begin
+                                current_module.uses_imports:=true;
+                                importlib.preparelib(current_module.modulename^);
+                              end;
+                             importlib.importvariable(tglobalvarsym(vs),C_name,dll_name);
+                           end
+                          else
+                           if target_info.DllScanSupported then
+                            current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
+                        end;
+                     end
+                   else
+                     Message(parser_e_not_external_and_export);
                    symdone:=true;
                  end;
               end;
@@ -1133,12 +1158,12 @@ implementation
                      Message(parser_e_cant_publish_that);
                      exclude(current_object_option,sp_published);
                      { recover by changing access type to public }
-                     vs2:=tvarsym(sc.first);
+                     vs2:=tabstractvarsym(sc.first);
                      while assigned (vs2) do
                        begin
                          exclude(vs2.symoptions,sp_published);
                          include(vs2.symoptions,sp_public);
-                         vs2:=tvarsym(vs2.listnext);
+                         vs2:=tabstractvarsym(vs2.listnext);
                        end;
                    end
                   else
@@ -1184,8 +1209,8 @@ implementation
                   symtablestack:=symtablestack.next;
                   read_type(casetype,'',true);
                   symtablestack:=oldsymtablestack;
-                  vs:=tvarsym.create(sorg,vs_value,casetype);
-                  tabstractrecordsymtable(symtablestack).insertfield(vs,true);
+                  fieldvs:=tfieldvarsym.create(sorg,vs_value,casetype);
+                  tabstractrecordsymtable(symtablestack).insertfield(fieldvs,true);
                 end;
               if not(is_ordinal(casetype.def))
 {$ifndef cpu64bit}
@@ -1243,7 +1268,7 @@ implementation
               unionsymtable.fieldalignment:=maxalignment;
               uniontype.def:=uniondef;
               uniontype.sym:=nil;
-              UnionSym:=tvarsym.create('$case',vs_value,uniontype);
+              UnionSym:=tfieldvarsym.create('$case',vs_value,uniontype);
               symtablestack:=symtablestack.next;
               unionsymtable.addalignmentpadding;
 {$ifdef powerpc}
@@ -1284,7 +1309,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.81  2004-10-15 09:14:17  mazen
+  Revision 1.82  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.81  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 6 - 3
compiler/pexports.pas

@@ -90,8 +90,8 @@ implementation
                 hp.sym:=srsym;
                 InternalProcName:='';
                 case srsym.typ of
-                  varsym :
-                    InternalProcName:=tvarsym(srsym).mangledname;
+                  globalvarsym :
+                    InternalProcName:=tglobalvarsym(srsym).mangledname;
                   typedconstsym :
                     InternalProcName:=ttypedconstsym(srsym).mangledname;
                   procsym :
@@ -182,7 +182,10 @@ end.
 
 {
   $Log$
-  Revision 1.29  2004-10-15 09:14:17  mazen
+  Revision 1.30  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.29  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 20 - 18
compiler/pexpr.pas

@@ -815,7 +815,6 @@ implementation
       var
          membercall,
          prevafterassn : boolean;
-         vs : tvarsym;
          para,p2 : tnode;
          currpara : tparaitem;
          aprocdef : tprocdef;
@@ -883,10 +882,7 @@ implementation
                 while assigned(currpara) do
                  begin
                    if not currpara.is_hidden then
-                    begin
-                      vs:=tvarsym(currpara.parasym);
-                      para:=ccallparanode.create(cloadnode.create(vs,vs.owner),para);
-                    end;
+                     para:=ccallparanode.create(cloadnode.create(currpara.parasym,currpara.parasym.owner),para);
                    currpara:=tparaitem(currpara.next);
                  end;
               end
@@ -1008,7 +1004,7 @@ implementation
                          include(p1.flags,nf_isproperty);
                          getprocvardef:=nil;
                        end;
-                     varsym :
+                     fieldvarsym :
                        begin
                          { generate access code }
                          symlist_to_node(p1,st,tpropertysym(sym).writeaccess);
@@ -1037,7 +1033,7 @@ implementation
               if not tpropertysym(sym).readaccess.empty then
                 begin
                    case tpropertysym(sym).readaccess.firstsym^.sym.typ of
-                     varsym :
+                     fieldvarsym :
                        begin
                           { generate access code }
                           symlist_to_node(p1,st,tpropertysym(sym).readaccess);
@@ -1121,7 +1117,7 @@ implementation
                          not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) then
                         Message(parser_e_only_class_methods_via_class_ref);
                    end;
-                 varsym:
+                 fieldvarsym:
                    begin
                       if (sp_static in sym.symoptions) then
                         begin
@@ -1179,13 +1175,13 @@ implementation
            consume_sym(srsym,srsymtable);
 
            { Access to funcret or need to call the function? }
-           if (srsym.typ in [absolutesym,varsym]) and
-              (vo_is_funcret in tvarsym(srsym).varoptions) and
+           if (srsym.typ in [absolutevarsym,localvarsym,paravarsym]) and
+              (vo_is_funcret in tabstractvarsym(srsym).varoptions) and
               (
                (token=_LKLAMMER) or
                (not(m_fpc in aktmodeswitches) and
                 (afterassignment or in_args) and
-                not(vo_is_result in tvarsym(srsym).varoptions))
+                not(vo_is_result in tabstractvarsym(srsym).varoptions))
               ) then
             begin
               storesymtablestack:=symtablestack;
@@ -1200,20 +1196,23 @@ implementation
 
             begin
               case srsym.typ of
-                absolutesym :
+                absolutevarsym :
                   begin
-                    if (tabsolutesym(srsym).abstyp=tovar) then
+                    if (tabsolutevarsym(srsym).abstyp=tovar) then
                       begin
                         p1:=nil;
-                        symlist_to_node(p1,nil,tabsolutesym(srsym).ref);
-                        p1:=ctypeconvnode.create(p1,tabsolutesym(srsym).vartype);
+                        symlist_to_node(p1,nil,tabsolutevarsym(srsym).ref);
+                        p1:=ctypeconvnode.create(p1,tabsolutevarsym(srsym).vartype);
                         include(p1.flags,nf_absolute);
                       end
                     else
                       p1:=cloadnode.create(srsym,srsymtable);
                   end;
 
-                varsym :
+                globalvarsym,
+                localvarsym,
+                paravarsym,
+                fieldvarsym :
                   begin
                     if (sp_static in srsym.symoptions) then
                      begin
@@ -1684,7 +1683,7 @@ implementation
                               hsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
                               check_hints(hsym);
                               if assigned(hsym) and
-                                 (hsym.typ=varsym) then
+                                 (hsym.typ=fieldvarsym) then
                                 p1:=csubscriptnode.create(hsym,p1)
                               else
                                 begin
@@ -2503,7 +2502,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.170  2004-11-04 17:57:58  peter
+  Revision 1.171  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.170  2004/11/04 17:57:58  peter
   added checking for token=_ID after _POINT is parsed
 
   Revision 1.169  2004/11/01 15:32:12  peter

+ 9 - 6
compiler/pmodules.pas

@@ -233,13 +233,13 @@ implementation
         ltvTable : taasmoutput;
       begin
         ltvTable:=taasmoutput(arg);
-        if (tsym(p).typ=varsym) and
-           (vo_is_thread_var in tvarsym(p).varoptions) then
+        if (tsym(p).typ=globalvarsym) and
+           (vo_is_thread_var in tglobalvarsym(p).varoptions) then
          begin
            { address of threadvar }
-           ltvTable.concat(tai_const.Createname(tvarsym(p).mangledname,AT_DATA,0));
+           ltvTable.concat(tai_const.Createname(tglobalvarsym(p).mangledname,AT_DATA,0));
            { size of threadvar }
-           ltvTable.concat(tai_const.create_32bit(tvarsym(p).getsize));
+           ltvTable.concat(tai_const.create_32bit(tglobalvarsym(p).getsize));
          end;
       end;
 
@@ -257,7 +257,7 @@ implementation
           begin
             s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
             { add begin and end of the list }
-            ltvTable.insert(tai_symbol.Createname_global(s,AT_DATA,0));            
+            ltvTable.insert(tai_symbol.Createname_global(s,AT_DATA,0));
             ltvTable.insert(Tai_align.Create(const_align(32)));
             ltvTable.concat(tai_const.create_sym(nil));  { end of list marker }
             ltvTable.concat(tai_symbol_end.createname(s));
@@ -1520,7 +1520,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.172  2004-11-05 20:04:49  florian
+  Revision 1.173  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.172  2004/11/05 20:04:49  florian
     * THREADVARLIST is now aligned
 
   Revision 1.171  2004/11/04 23:59:13  peter

+ 20 - 19
compiler/ppu.pas

@@ -44,11 +44,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-{$ifdef ansistring_bits}
-  CurrentPPUVersion=44;
-{$else}
-  CurrentPPUVersion=44;
-{$endif}
+  CurrentPPUVersion=45;
 
 { buffer sizes }
   maxentrysize = 1024;
@@ -86,19 +82,21 @@ const
   ibusedmacros           = 16;
   ibderefdata            = 17;
   {syms}
-  ibtypesym       = 20;
-  ibprocsym       = 21;
-  ibvarsym        = 22;
-  ibconstsym      = 23;
-  ibenumsym       = 24;
-  ibtypedconstsym = 25;
-  ibabsolutesym   = 26;
-  ibpropertysym   = 27;
-  ibvarsym_C      = 28;
-  ibunitsym       = 29;  { needed for browser }
-  iblabelsym      = 30;
-  ibsyssym        = 31;
-  ibrttisym       = 32;
+  ibtypesym        = 20;
+  ibprocsym        = 21;
+  ibglobalvarsym   = 22;
+  ibconstsym       = 23;
+  ibenumsym        = 24;
+  ibtypedconstsym  = 25;
+  ibabsolutevarsym = 26;
+  ibpropertysym    = 27;
+  ibfieldvarsym    = 28;
+  ibunitsym        = 29;  { needed for browser }
+  iblabelsym       = 30;
+  ibsyssym         = 31;
+  ibrttisym        = 32;
+  iblocalvarsym    = 33;
+  ibparavarsym     = 34;
   {definitions}
   iborddef         = 40;
   ibpointerdef     = 41;
@@ -1056,7 +1054,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.57  2004-09-21 17:25:12  peter
+  Revision 1.58  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.57  2004/09/21 17:25:12  peter
     * paraloc branch merged
 
   Revision 1.56.4.1  2004/09/12 14:01:23  peter

+ 17 - 13
compiler/pstatmnt.pas

@@ -342,7 +342,7 @@ implementation
       var
          p_e,tovalue,p_a : tnode;
          backward : boolean;
-         loopvarsym : tvarsym;
+         loopvarsym : tabstractvarsym;
          hp : tnode;
       begin
          { parse loop header }
@@ -395,7 +395,9 @@ implementation
                 (hp.nodetype=loadn) then
                begin
                  case tloadnode(hp).symtableentry.typ of
-                   varsym :
+                   globalvarsym,
+                   localvarsym,
+                   paravarsym :
                      begin
                        { we need a simple loadn and the load must be in a global symtable or
                          in the same level as the para of the current proc }
@@ -404,18 +406,17 @@ implementation
                            (tloadnode(hp).symtable.symtablelevel=current_procinfo.procdef.parast.symtablelevel)
                           ) and
                           not(
-                              (tloadnode(hp).symtableentry.typ=varsym) and
-                              ((tvarsym(tloadnode(hp).symtableentry).varspez in [vs_var,vs_out]) or
-                               (vo_is_thread_var in tvarsym(tloadnode(hp).symtableentry).varoptions))
+                              ((tabstractvarsym(tloadnode(hp).symtableentry).varspez in [vs_var,vs_out]) or
+                               (vo_is_thread_var in tabstractvarsym(tloadnode(hp).symtableentry).varoptions))
                              ) then
                          begin
-                           tvarsym(tloadnode(hp).symtableentry).varstate:=vs_used;
+                           tabstractvarsym(tloadnode(hp).symtableentry).varstate:=vs_used;
 
                            { Assigning for-loop variable is only allowed in tp7 }
                            if not(m_tp7 in aktmodeswitches) then
                              begin
                                if not assigned(loopvarsym) then
-                                 loopvarsym:=tvarsym(tloadnode(hp).symtableentry);
+                                 loopvarsym:=tabstractvarsym(tloadnode(hp).symtableentry);
                                include(loopvarsym.varoptions,vo_is_loop_counter);
                              end;
                          end
@@ -679,7 +680,7 @@ implementation
          p_try_block,p_finally_block,first,last,
          p_default,p_specific,hp : tnode;
          ot : ttype;
-         sym : tvarsym;
+         sym : tlocalvarsym;
          old_block_type : tblock_type;
          exceptsymtable : tsymtable;
          objname,objrealname : stringid;
@@ -755,11 +756,11 @@ implementation
                                   is_class(ttypesym(srsym).restype.def) then
                                  begin
                                     ot:=ttypesym(srsym).restype;
-                                    sym:=tvarsym.create(objrealname,vs_value,ot);
+                                    sym:=tlocalvarsym.create(objrealname,vs_value,ot);
                                  end
                                else
                                  begin
-                                    sym:=tvarsym.create(objrealname,vs_value,generrortype);
+                                    sym:=tlocalvarsym.create(objrealname,vs_value,generrortype);
                                     if (srsym.typ=typesym) then
                                       Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
                                     else
@@ -1178,7 +1179,7 @@ implementation
              if (locals=0) and
                 (current_procinfo.procdef.owner.symtabletype<>objectsymtable) and
                 (not assigned(current_procinfo.procdef.funcretsym) or
-                 (tvarsym(current_procinfo.procdef.funcretsym).refcount<=1)) and
+                 (tabstractvarsym(current_procinfo.procdef.funcretsym).refcount<=1)) and
                 not(paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
                begin
                  { Only need to set the framepointer, the locals will
@@ -1194,7 +1195,7 @@ implementation
         }
         if assigned(current_procinfo.procdef.funcretsym) and
            (not paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
-          tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
+          tabstractvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
 
         { because the END is already read we need to get the
           last_endtoken_filepos here (PFV) }
@@ -1206,7 +1207,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.143  2004-10-15 10:35:23  mazen
+  Revision 1.144  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.143  2004/10/15 10:35:23  mazen
   * remove non needed parathesys as  in 1.140
 
   Revision 1.141  2004/09/27 15:15:52  peter

+ 20 - 17
compiler/psub.pas

@@ -117,9 +117,9 @@ implementation
       var
         b : tblocknode;
       begin
-        if tsym(p).typ<>varsym then
+        if not (tsym(p).typ in [localvarsym,globalvarsym]) then
          exit;
-        with tvarsym(p) do
+        with tabstractnormalvarsym(p) do
          begin
            if assigned(defaultconstsym) then
             begin
@@ -136,21 +136,21 @@ implementation
 
     procedure check_finalize_paras(p : tnamedindexitem;arg:pointer);
       begin
-        if (tsym(p).typ=varsym) and
-           (tvarsym(p).varspez=vs_value) and
-           not is_class(tvarsym(p).vartype.def) and
-           tvarsym(p).vartype.def.needs_inittable then
+        if (tsym(p).typ=paravarsym) and
+           (tparavarsym(p).varspez=vs_value) and
+           not is_class(tparavarsym(p).vartype.def) and
+           tparavarsym(p).vartype.def.needs_inittable then
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
 
 
     procedure check_finalize_locals(p : tnamedindexitem;arg:pointer);
       begin
-        if (tsym(p).typ=varsym) and
-           (tvarsym(p).refs>0) and
-           not(vo_is_funcret in tvarsym(p).varoptions) and
-           not(is_class(tvarsym(p).vartype.def)) and
-           tvarsym(p).vartype.def.needs_inittable then
+        if (tsym(p).typ=localvarsym) and
+           (tlocalvarsym(p).refs>0) and
+           not(vo_is_funcret in tlocalvarsym(p).varoptions) and
+           not(is_class(tlocalvarsym(p).vartype.def)) and
+           tlocalvarsym(p).vartype.def.needs_inittable then
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
 
@@ -595,9 +595,9 @@ implementation
 
     procedure clearrefs(p : tnamedindexitem;arg:pointer);
       begin
-         if (tsym(p).typ=varsym) then
-           if tvarsym(p).refs>1 then
-             tvarsym(p).refs:=1;
+         if (tsym(p).typ in [localvarsym,paravarsym,globalvarsym]) then
+           if tabstractvarsym(p).refs>1 then
+             tabstractvarsym(p).refs:=1;
       end;
 
 
@@ -1088,9 +1088,9 @@ implementation
 
     procedure check_init_paras(p:tnamedindexitem;arg:pointer);
       begin
-        if tsym(p).typ<>varsym then
+        if tsym(p).typ<>paravarsym then
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
           if (not is_class(vartype.def) and
              vartype.def.needs_inittable and
              (varspez in [vs_value,vs_out])) then
@@ -1403,7 +1403,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.213  2004-11-02 12:55:17  peter
+  Revision 1.214  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.213  2004/11/02 12:55:17  peter
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
 

+ 10 - 7
compiler/psystem.pas

@@ -215,12 +215,12 @@ implementation
         hrecst:=trecordsymtable.create(aktpackrecords);
         vmttype.setdef(trecorddef.create(hrecst));
         pvmttype.setdef(tpointerdef.create(vmttype));
-        hrecst.insertfield(tvarsym.create('$parent',vs_value,pvmttype),true);
-        hrecst.insertfield(tvarsym.create('$length',vs_value,s32inttype),true);
-        hrecst.insertfield(tvarsym.create('$mlength',vs_value,s32inttype),true);
+        hrecst.insertfield(tfieldvarsym.create('$parent',vs_value,pvmttype),true);
+        hrecst.insertfield(tfieldvarsym.create('$length',vs_value,s32inttype),true);
+        hrecst.insertfield(tfieldvarsym.create('$mlength',vs_value,s32inttype),true);
         vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
         tarraydef(vmtarraytype.def).setelementtype(voidpointertype);
-        hrecst.insertfield(tvarsym.create('$__pfn',vs_value,vmtarraytype),true);
+        hrecst.insertfield(tfieldvarsym.create('$__pfn',vs_value,vmtarraytype),true);
         addtype('$__vtbl_ptr_type',vmttype);
         addtype('$pvmt',pvmttype);
         vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
@@ -228,8 +228,8 @@ implementation
         addtype('$vtblarray',vmtarraytype);
         { Add a type for methodpointers }
         hrecst:=trecordsymtable.create(1);
-        hrecst.insertfield(tvarsym.create('$proc',vs_value,voidpointertype),true);
-        hrecst.insertfield(tvarsym.create('$self',vs_value,voidpointertype),true);
+        hrecst.insertfield(tfieldvarsym.create('$proc',vs_value,voidpointertype),true);
+        hrecst.insertfield(tfieldvarsym.create('$self',vs_value,voidpointertype),true);
         methodpointertype.setdef(trecorddef.create(hrecst));
         addtype('$methodpointer',methodpointertype);
       { Add functions that require compiler magic }
@@ -534,7 +534,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.72  2004-10-15 09:14:17  mazen
+  Revision 1.73  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.72  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 15 - 12
compiler/ptconst.pas

@@ -440,8 +440,8 @@ implementation
                               else
                                 curconstSegment.concat(Tai_const.Createname(tprocsym(srsym).first_procdef.mangledname,AT_FUNCTION,offset));
                             end;
-                          varsym :
-                            curconstSegment.concat(Tai_const.Createname(tvarsym(srsym).mangledname,AT_DATA,offset));
+                          globalvarsym :
+                            curconstSegment.concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,AT_DATA,offset));
                           typedconstsym :
                             curconstSegment.concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset));
                           labelsym :
@@ -898,7 +898,7 @@ implementation
                             { Also allow jumping from one variant part to another, }
                             { as long as the offsets match                         }
                             if (assigned(srsym) and
-                                (tvarsym(recsym).fieldoffset = tvarsym(srsym).fieldoffset)) or
+                                (tfieldvarsym(recsym).fieldoffset = tfieldvarsym(srsym).fieldoffset)) or
                                { srsym is not assigned after parsing w2 in the      }
                                { typed const in the next example:                   }
                                {   type tr = record case byte of                    }
@@ -906,10 +906,10 @@ implementation
                                {          2: (w1,w2: word);                         }
                                {        end;                                        }
                                {   const r: tr = (w1:1;w2:1;l2:5);                  }
-                               (tvarsym(recsym).fieldoffset = aktpos) then
+                               (tfieldvarsym(recsym).fieldoffset = aktpos) then
                               srsym := recsym
                             { going backwards isn't allowed in any mode }
-                            else if (tvarsym(recsym).fieldoffset<aktpos) then
+                            else if (tfieldvarsym(recsym).fieldoffset<aktpos) then
                               begin
                                 Message(parser_e_invalid_record_const);
                                 error := true;
@@ -933,15 +933,15 @@ implementation
                           begin
 
                             { if needed fill (alignment) }
-                            if tvarsym(srsym).fieldoffset>aktpos then
-                               for i:=1 to tvarsym(srsym).fieldoffset-aktpos do
+                            if tfieldvarsym(srsym).fieldoffset>aktpos then
+                               for i:=1 to tfieldvarsym(srsym).fieldoffset-aktpos do
                                  curconstSegment.concat(Tai_const.Create_8bit(0));
 
                              { new position }
-                             aktpos:=tvarsym(srsym).fieldoffset+tvarsym(srsym).vartype.def.size;
+                             aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vartype.def.size;
 
                              { read the data }
-                             readtypedconst(tvarsym(srsym).vartype,nil,writable);
+                             readtypedconst(tfieldvarsym(srsym).vartype,nil,writable);
 
                              { keep previous field for checking whether whole }
                              { record was initialized (JM)                    }
@@ -960,7 +960,7 @@ implementation
                     { don't complain if there only come other variant parts }
                     { after the last initialized field                      }
                     ((recsym=nil) or
-                     (tvarsym(srsym).fieldoffset > tvarsym(recsym).fieldoffset)) then
+                     (tfieldvarsym(srsym).fieldoffset > tfieldvarsym(recsym).fieldoffset)) then
                    Message1(parser_w_skipped_fields_after,sorg);
 
                  for i:=1 to t.def.size-aktpos do
@@ -1020,7 +1020,7 @@ implementation
                              consume_all_until(_SEMICOLON);
                           end
                         else
-                          with Tvarsym(srsym) do
+                          with tfieldvarsym(srsym) do
                             begin
                                { check position }
                                if fieldoffset<aktpos then
@@ -1089,7 +1089,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.94  2004-11-01 23:30:11  peter
+  Revision 1.95  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.94  2004/11/01 23:30:11  peter
     * support > 32bit accesses for x86_64
     * rewrote array size checking to support 64bit
 

+ 13 - 10
compiler/raatt.pas

@@ -1334,8 +1334,10 @@ unit raatt;
                       if assigned(sym) then
                        begin
                          case sym.typ of
-                           varsym :
-                             l:=tvarsym(sym).getsize;
+                           globalvarsym,
+                           localvarsym,
+                           paravarsym :
+                             l:=tabstractvarsym(sym).getsize;
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
@@ -1378,13 +1380,11 @@ unit raatt;
                       if assigned(sym) then
                        begin
                          case sym.typ of
-                           varsym :
-                             with Tvarsym(sym) do
-                               begin
-                                 if owner.symtabletype in [localsymtable,parasymtable] then
-                                  Message(asmr_e_no_local_or_para_allowed);
-                                 hs:=mangledname;
-                               end;
+                           globalvarsym :
+                             hs:=tglobalvarsym(sym).mangledname;
+                           localvarsym,
+                           paravarsym :
+                             Message(asmr_e_no_local_or_para_allowed);
                            typedconstsym :
                              hs:=ttypedconstsym(sym).mangledname;
                            procsym :
@@ -1500,7 +1500,10 @@ end.
 
 {
   $Log$
-  Revision 1.12  2004-06-20 08:55:30  florian
+  Revision 1.13  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.12  2004/06/20 08:55:30  florian
     * logs truncated
 
   Revision 1.11  2004/06/16 20:07:09  florian

+ 59 - 79
compiler/rautils.pas

@@ -74,7 +74,7 @@ type
       OPR_CONSTANT  : (val:aint);
       OPR_SYMBOL    : (symbol:tasmsymbol;symofs:aint);
       OPR_REFERENCE : (ref:treference);
-      OPR_LOCAL     : (localsym:tvarsym;localsymofs:aint;localindexreg:tregister;localscale:byte;localgetoffset:boolean);
+      OPR_LOCAL     : (localsym:tabstractnormalvarsym;localsymofs:aint;localindexreg:tregister;localscale:byte;localgetoffset:boolean);
       OPR_REGISTER  : (reg:tregister);
 {$ifdef m68k}
       OPR_REGLIST   : (regset : tcpuregisterset);
@@ -772,7 +772,7 @@ end;
 
 Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
 
-  function symtable_has_varsyms(st:tsymtable):boolean;
+  function symtable_has_localvarsyms(st:tsymtable):boolean;
   var
     sym : tsym;
   begin
@@ -780,7 +780,7 @@ Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
     sym:=tsym(st.symindex.first);
     while assigned(sym) do
       begin
-        if sym.typ=varsym then
+        if sym.typ=localvarsym then
           begin
             result:=true;
             exit;
@@ -825,12 +825,12 @@ Begin
   asmsearchsym(s,sym,srsymtable);
   if sym = nil then
    exit;
-  if sym.typ=absolutesym then
+  if sym.typ=absolutevarsym then
     begin
-      if (tabsolutesym(sym).abstyp=tovar) then
+      if (tabsolutevarsym(sym).abstyp=tovar) then
         begin
           { Only support simple loads }
-          plist:=tabsolutesym(sym).ref.firstsym;
+          plist:=tabsolutevarsym(sym).ref.firstsym;
           if assigned(plist) and
              (plist^.sltype=sl_load) then
             sym:=plist^.sym
@@ -847,80 +847,73 @@ Begin
         end;
     end;
   case sym.typ of
-    varsym :
+    fieldvarsym :
+      begin
+        setconst(tfieldvarsym(sym).fieldoffset);
+        hasvar:=true;
+        SetupVar:=true;
+      end;
+    globalvarsym,
+    localvarsym,
+    paravarsym :
       begin
         { we always assume in asm statements that     }
         { that the variable is valid.                 }
-        tvarsym(sym).varstate:=vs_used;
-        inc(tvarsym(sym).refs);
+        tabstractvarsym(sym).varstate:=vs_used;
+        inc(tabstractvarsym(sym).refs);
         { variable can't be placed in a register }
-        tvarsym(sym).varregable:=vr_none;
-        case tvarsym(sym).owner.symtabletype of
-          objectsymtable :
-            begin
-              setconst(tvarsym(sym).fieldoffset);
-              hasvar:=true;
-              SetupVar:=true;
-              Exit;
-            end;
+        tabstractvarsym(sym).varregable:=vr_none;
+        case sym.owner.symtabletype of
           globalsymtable,
           staticsymtable :
             begin
               initref;
-              opr.ref.symbol:=objectlibrary.newasmsymbol(tvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA);
+              opr.ref.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA);
             end;
           parasymtable,
           localsymtable :
             begin
-              if (vo_is_external in tvarsym(sym).varoptions) then
+              if opr.typ=OPR_REFERENCE then
                 begin
-                  initref;
-                  opr.ref.symbol:=objectlibrary.newasmsymbol(tvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA)
+                  indexreg:=opr.ref.base;
+                  if opr.ref.index<>NR_NO then
+                    begin
+                      if indexreg=NR_NO then
+                        indexreg:=opr.ref.index
+                      else
+                        Message(asmr_e_multiple_index);
+                    end;
                 end
               else
-                begin
-                  if opr.typ=OPR_REFERENCE then
-                    begin
-                      indexreg:=opr.ref.base;
-                      if opr.ref.index<>NR_NO then
-                        begin
-                          if indexreg=NR_NO then
-                            indexreg:=opr.ref.index
-                          else
-                            Message(asmr_e_multiple_index);
-                        end;
-                    end
-                  else
-                    indexreg:=NR_NO;
-                  opr.typ:=OPR_LOCAL;
-                  if assigned(current_procinfo.parent) and
-                     (current_procinfo.procdef.proccalloption<>pocall_inline) and
-                     (tvarsym(sym).owner<>current_procinfo.procdef.localst) and
-                     (tvarsym(sym).owner<>current_procinfo.procdef.parast) and
-                     (current_procinfo.procdef.localst.symtablelevel>normal_function_level) and
-                     symtable_has_varsyms(current_procinfo.procdef.localst) then
-                    message1(asmr_e_local_para_unreachable,s);
-                  opr.localsym:=tvarsym(sym);
-                  opr.localsymofs:=0;
-                  opr.localindexreg:=indexreg;
-                  opr.localscale:=0;
-                  opr.localgetoffset:=GetOffset;
-                end;
-              if paramanager.push_addr_param(tvarsym(sym).varspez,tvarsym(sym).vartype.def,current_procinfo.procdef.proccalloption) then
+                indexreg:=NR_NO;
+              opr.typ:=OPR_LOCAL;
+              if assigned(current_procinfo.parent) and
+                 (current_procinfo.procdef.proccalloption<>pocall_inline) and
+                 (sym.owner<>current_procinfo.procdef.localst) and
+                 (sym.owner<>current_procinfo.procdef.parast) and
+                 (current_procinfo.procdef.localst.symtablelevel>normal_function_level) and
+                 symtable_has_localvarsyms(current_procinfo.procdef.localst) then
+                message1(asmr_e_local_para_unreachable,s);
+              opr.localsym:=tabstractnormalvarsym(sym);
+              opr.localsymofs:=0;
+              opr.localindexreg:=indexreg;
+              opr.localscale:=0;
+              opr.localgetoffset:=GetOffset;
+              if paramanager.push_addr_param(tabstractvarsym(sym).varspez,tabstractvarsym(sym).vartype.def,current_procinfo.procdef.proccalloption) then
                 SetSize(sizeof(aint),false);
             end;
         end;
-        case tvarsym(sym).vartype.def.deftype of
+        case tabstractvarsym(sym).vartype.def.deftype of
           orddef,
           enumdef,
           pointerdef,
           floatdef :
-            SetSize(tvarsym(sym).getsize,false);
+            SetSize(tabstractvarsym(sym).getsize,false);
           arraydef :
             begin
               { for arrays try to get the element size, take care of
                 multiple indexes }
-              harrdef:=tarraydef(tvarsym(sym).vartype.def);
+              harrdef:=tarraydef(tabstractvarsym(sym).vartype.def);
               while assigned(harrdef.elementtype.def) and
                     (harrdef.elementtype.def.deftype=arraydef) do
                harrdef:=tarraydef(harrdef.elementtype.def);
@@ -1364,30 +1357,14 @@ Begin
      { we can start with a var,type,typedconst }
      if assigned(sym) then
        case sym.typ of
-         varsym :
-           with Tvarsym(sym).vartype do
-             case def.deftype of
-               recorddef :
-                 st:=trecorddef(def).symtable;
-               objectdef :
-                 st:=tobjectdef(def).symtable;
-             end;
+         globalvarsym,
+         localvarsym,
+         paravarsym :
+           st:=Tabstractvarsym(sym).vartype.def.getsymtable(gs_record);
          typesym :
-           with Ttypesym(sym).restype do
-             case def.deftype of
-               recorddef :
-                 st:=trecorddef(def).symtable;
-               objectdef :
-                 st:=tobjectdef(def).symtable;
-             end;
+           st:=Ttypesym(sym).restype.def.getsymtable(gs_record);
          typedconstsym :
-           with Ttypedconstsym(sym).typedconsttype do
-             case def.deftype of
-               recorddef :
-                 st:=trecorddef(def).symtable;
-               objectdef :
-                 st:=tobjectdef(def).symtable;
-             end;
+           st:=Ttypedconstsym(sym).typedconsttype.def.getsymtable(gs_record);
        end
      else
        s:='';
@@ -1412,8 +1389,8 @@ Begin
       end;
      st:=nil;
      case sym.typ of
-       varsym :
-         with Tvarsym(sym) do
+       fieldvarsym :
+         with Tfieldvarsym(sym) do
            begin
              inc(Offset,fieldoffset);
              size:=getsize;
@@ -1659,7 +1636,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.93  2004-10-31 21:45:03  peter
+  Revision 1.94  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.93  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 9 - 4
compiler/scanner.pas

@@ -31,7 +31,7 @@ interface
        globtype,globals,version,tokens,
        verbose,comphook,
        finput,
-       widestr,cpuinfo;
+       widestr;
 
     const
        max_include_nesting=32;
@@ -532,8 +532,10 @@ implementation
                       begin
                         l:=0;
                         case srsym.typ of
-                          varsym :
-                            l:=tvarsym(srsym).getsize;
+                          globalvarsym,
+                          localvarsym,
+                          paravarsym :
+                            l:=tabstractvarsym(srsym).getsize;
                           typedconstsym :
                             l:=ttypedconstsym(srsym).getsize;
                           typesym:
@@ -3290,7 +3292,10 @@ exit_label:
 end.
 {
   $Log$
-  Revision 1.95  2004-10-31 21:45:03  peter
+  Revision 1.96  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.95  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 14 - 8
compiler/symconst.pas

@@ -290,7 +290,8 @@ type
     vo_is_vmt,
     vo_is_result,  { special result variable }
     vo_is_parentfp,
-    vo_is_loop_counter { used to detect assignments to loop counter }
+    vo_is_loop_counter, { used to detect assignments to loop counter }
+    vo_is_hidden
   );
   tvaroptions=set of tvaroption;
 
@@ -317,9 +318,10 @@ type
               classrefdef,forwarddef,variantdef);
 
   { possible types for symtable entries }
-  tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,
-             constsym,enumsym,typedconstsym,errorsym,syssym,
-             labelsym,absolutesym,propertysym,macrosym,rttisym);
+  tsymtyp = (abstractsym,globalvarsym,localvarsym,paravarsym,fieldvarsym,
+             typesym,procsym,unitsym,constsym,enumsym,typedconstsym,
+             errorsym,syssym,labelsym,absolutevarsym,propertysym,
+             macrosym,rttisym);
 
   { State of the variable, if it's declared, assigned or used }
   tvarstate=(vs_none,
@@ -383,9 +385,10 @@ const
    pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
 
      SymTypeName : array[tsymtyp] of string[12] = (
-       'abstractsym','variable','type','proc','unit',
-       'const','enum','typed const','errorsym','system sym',
-       'label','absolute','property','macrosym','rttisym'
+       'abstractsym','globalvar','localvar','paravar','fieldvar',
+       'type','proc','unit','const','enum','typed const',
+       'errorsym','system sym','label','absolutevar','property',
+       'macrosym','rttisym'
      );
 
      DefTypeName : array[tdeftype] of string[12] = (
@@ -409,7 +412,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.91  2004-11-01 10:33:01  peter
+  Revision 1.92  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.91  2004/11/01 10:33:01  peter
     * symlist typeconv for absolute fixed
 
   Revision 1.90  2004/10/24 20:01:08  peter

+ 51 - 40
compiler/symdef.pas

@@ -179,6 +179,7 @@ interface
 
        terrordef = class(tstoreddef)
           constructor create;
+          procedure ppuwrite(ppufile:tcompilerppufile);override;
           function  gettypename:string;override;
           function  getmangledparaname : string;override;
           { debug }
@@ -1685,7 +1686,7 @@ implementation
 
     procedure tenumdef.calcsavesize;
       begin
-        if (aktpackenum=8) or (min<low(longint)) or (max>high(cardinal)) then
+        if (aktpackenum=8) or (min<low(longint)) or (int64(max)>high(cardinal)) then
          savesize:=8
         else
          if (aktpackenum=4) or (min<low(smallint)) or (max>high(word)) then
@@ -3067,7 +3068,7 @@ implementation
       begin
         state:=arg;
         { static variables from objects are like global objects }
-        if (Tsym(p).typ=varsym) and not (sp_static in Tsym(p).symoptions) then
+        if (Tsym(p).typ=fieldvarsym) and not (sp_static in Tsym(p).symoptions) then
           begin
             if (sp_protected in tsym(p).symoptions) then
               spec:='/1'
@@ -3075,13 +3076,13 @@ implementation
               spec:='/0'
             else
               spec:='';
-            varsize:=tvarsym(p).vartype.def.size;
+            varsize:=tfieldvarsym(p).vartype.def.size;
             { open arrays made overflows !! }
             if varsize>$fffffff then
               varsize:=$fffffff;
             newrec:=stabstr_evaluate('$1:$2,$3,$4;',[p.name,
-                                     spec+tstoreddef(tvarsym(p).vartype.def).numberstring,
-                                     tostr(tvarsym(p).fieldoffset*8),tostr(varsize*8)]);
+                                     spec+tstoreddef(tfieldvarsym(p).vartype.def).numberstring,
+                                     tostr(tfieldvarsym(p).fieldoffset*8),tostr(varsize*8)]);
             if state^.stabsize+strlen(newrec)>=state^.staballoc-256 then
               begin
                 inc(state^.staballoc,memsizeinc);
@@ -3091,15 +3092,15 @@ implementation
             inc(state^.stabsize,strlen(newrec));
             strdispose(newrec);
             {This should be used for case !!}
-            inc(state^.recoffset,Tvarsym(p).vartype.def.size);
+            inc(state^.recoffset,Tfieldvarsym(p).vartype.def.size);
           end;
       end;
 
 
     procedure tabstractrecorddef.field_concatstabto(p:Tnamedindexitem;arg:pointer);
       begin
-        if (Tsym(p).typ=varsym) and not (sp_static in Tsym(p).symoptions) then
-          tstoreddef(tvarsym(p).vartype.def).concatstabto(taasmoutput(arg));
+        if (Tsym(p).typ=fieldvarsym) and not (sp_static in Tsym(p).symoptions) then
+          tstoreddef(tfieldvarsym(p).vartype.def).concatstabto(taasmoutput(arg));
       end;
 
 
@@ -3109,8 +3110,8 @@ implementation
     procedure tabstractrecorddef.count_field_rtti(sym : tnamedindexitem;arg:pointer);
       begin
          if (FRTTIType=fullrtti) or
-            ((tsym(sym).typ=varsym) and
-             tvarsym(sym).vartype.def.needs_inittable) then
+            ((tsym(sym).typ=fieldvarsym) and
+             tfieldvarsym(sym).vartype.def.needs_inittable) then
            inc(Count);
       end;
 
@@ -3118,20 +3119,20 @@ implementation
     procedure tabstractrecorddef.generate_field_rtti(sym:tnamedindexitem;arg:pointer);
       begin
          if (FRTTIType=fullrtti) or
-            ((tsym(sym).typ=varsym) and
-             tvarsym(sym).vartype.def.needs_inittable) then
-           tstoreddef(tvarsym(sym).vartype.def).get_rtti_label(FRTTIType);
+            ((tsym(sym).typ=fieldvarsym) and
+             tfieldvarsym(sym).vartype.def.needs_inittable) then
+           tstoreddef(tfieldvarsym(sym).vartype.def).get_rtti_label(FRTTIType);
       end;
 
 
     procedure tabstractrecorddef.write_field_rtti(sym : tnamedindexitem;arg:pointer);
       begin
          if (FRTTIType=fullrtti) or
-            ((tsym(sym).typ=varsym) and
-             tvarsym(sym).vartype.def.needs_inittable) then
+            ((tsym(sym).typ=fieldvarsym) and
+             tfieldvarsym(sym).vartype.def.needs_inittable) then
           begin
-            rttiList.concat(Tai_const.Create_sym(tstoreddef(tvarsym(sym).vartype.def).get_rtti_label(FRTTIType)));
-            rttiList.concat(Tai_const.Create_32bit(tvarsym(sym).fieldoffset));
+            rttiList.concat(Tai_const.Create_sym(tstoreddef(tfieldvarsym(sym).vartype.def).get_rtti_label(FRTTIType)));
+            rttiList.concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset));
           end;
       end;
 
@@ -3369,7 +3370,7 @@ implementation
         hp : TParaItem;
       begin
         hp:=TParaItem.Create;
-        hp.paratyp:=tvarsym(sym).varspez;
+        hp.paratyp:=tparavarsym(sym).varspez;
         hp.parasym:=sym;
         hp.paratype:=tt;
         hp.is_hidden:=vhidden;
@@ -3395,7 +3396,7 @@ implementation
         hp : TParaItem;
       begin
         hp:=TParaItem.Create;
-        hp.paratyp:=tvarsym(sym).varspez;
+        hp.paratyp:=tparavarsym(sym).varspez;
         hp.parasym:=sym;
         hp.paratype:=tt;
         hp.is_hidden:=vhidden;
@@ -3480,9 +3481,9 @@ implementation
           begin
             hp.paratype.resolve;
             hp.defaultvalue:=tsym(hp.defaultvaluederef.resolve);
-            hp.parasym:=tvarsym(hp.parasymderef.resolve);
+            hp.parasym:=tparavarsym(hp.parasymderef.resolve);
             { connect parasym to paraitem }
-            tvarsym(hp.parasym).paraitem:=hp;
+            tparavarsym(hp.parasym).paraitem:=hp;
             { Don't count hidden parameters }
             if (not hp.is_hidden) then
              begin
@@ -5435,7 +5436,7 @@ implementation
     procedure tobjectdef.count_published_properties(sym:tnamedindexitem;arg:pointer);
       begin
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ<>varsym) then
+            (tsym(sym).typ<>fieldvarsym) then
            inc(count);
       end;
 
@@ -5457,7 +5458,7 @@ implementation
                 rttiList.concat(Tai_const.create(ait_const_ptr,1));
                 typvalue:=3;
              end
-           else if proc.firstsym^.sym.typ=varsym then
+           else if proc.firstsym^.sym.typ=fieldvarsym then
              begin
                 address:=0;
                 hp:=proc.firstsym;
@@ -5467,15 +5468,15 @@ implementation
                      case hp^.sltype of
                        sl_load :
                          begin
-                           def:=tvarsym(hp^.sym).vartype.def;
-                           inc(address,tvarsym(hp^.sym).fieldoffset);
+                           def:=tfieldvarsym(hp^.sym).vartype.def;
+                           inc(address,tfieldvarsym(hp^.sym).fieldoffset);
                          end;
                        sl_subscript :
                          begin
                            if not(assigned(def) and (def.deftype=recorddef)) then
                              internalerror(200402171);
-                           inc(address,tvarsym(hp^.sym).fieldoffset);
-                           def:=tvarsym(hp^.sym).vartype.def;
+                           inc(address,tfieldvarsym(hp^.sym).fieldoffset);
+                           def:=tfieldvarsym(hp^.sym).vartype.def;
                          end;
                        sl_vec :
                          begin
@@ -5514,7 +5515,7 @@ implementation
       begin
          if needs_prop_entry(tsym(sym)) then
            case tsym(sym).typ of
-              varsym:
+              fieldvarsym:
                 begin
 {$ifdef dummy}
                    if not(tvarsym(sym).vartype.def.deftype=objectdef) or
@@ -5578,8 +5579,8 @@ implementation
             case tsym(sym).typ of
               propertysym:
                 tstoreddef(tpropertysym(sym).proptype.def).get_rtti_label(fullrtti);
-              varsym:
-                tstoreddef(tvarsym(sym).vartype.def).get_rtti_label(fullrtti);
+              fieldvarsym:
+                tstoreddef(tfieldvarsym(sym).vartype.def).get_rtti_label(fullrtti);
               else
                 internalerror(1509991);
             end;
@@ -5635,15 +5636,15 @@ implementation
          hp : tclasslistitem;
       begin
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ=varsym) then
+          (tsym(sym).typ=fieldvarsym) then
           begin
-             if tvarsym(sym).vartype.def.deftype<>objectdef then
+             if tfieldvarsym(sym).vartype.def.deftype<>objectdef then
                internalerror(0206001);
-             hp:=searchclasstablelist(tobjectdef(tvarsym(sym).vartype.def));
+             hp:=searchclasstablelist(tobjectdef(tfieldvarsym(sym).vartype.def));
              if not(assigned(hp)) then
                begin
                   hp:=tclasslistitem.create;
-                  hp.p:=tobjectdef(tvarsym(sym).vartype.def);
+                  hp.p:=tobjectdef(tfieldvarsym(sym).vartype.def);
                   hp.index:=tablecount;
                   classtablelist.concat(hp);
                   inc(tablecount);
@@ -5658,15 +5659,15 @@ implementation
          hp : tclasslistitem;
       begin
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ=varsym) then
+          (tsym(sym).typ=fieldvarsym) then
           begin
-             rttiList.concat(Tai_const.Create_32bit(tvarsym(sym).fieldoffset));
-             hp:=searchclasstablelist(tobjectdef(tvarsym(sym).vartype.def));
+             rttiList.concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset));
+             hp:=searchclasstablelist(tobjectdef(tfieldvarsym(sym).vartype.def));
              if not(assigned(hp)) then
                internalerror(0206002);
              rttiList.concat(Tai_const.Create_16bit(hp.index));
-             rttiList.concat(Tai_const.Create_8bit(length(tvarsym(sym).realname)));
-             rttiList.concat(Tai_string.Create(tvarsym(sym).realname));
+             rttiList.concat(Tai_const.Create_8bit(length(tfieldvarsym(sym).realname)));
+             rttiList.concat(Tai_string.Create(tfieldvarsym(sym).realname));
           end;
       end;
 
@@ -6146,6 +6147,13 @@ implementation
      end;
 
 
+    procedure terrordef.ppuwrite(ppufile:tcompilerppufile);
+      begin
+        { Can't write errordefs to ppu }
+        internalerror(200411063);
+      end;
+
+
 {$ifdef GDB}
     function terrordef.stabstring : pchar;
       begin
@@ -6236,7 +6244,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.268  2004-11-06 17:44:47  florian
+  Revision 1.269  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.268  2004/11/06 17:44:47  florian
     + additional extdebug check for wrong add_reg_instructions added
     * too long manglednames are cut off at 200 chars using a crc
 

文件差异内容过多而无法显示
+ 487 - 283
compiler/symsym.pas


+ 52 - 44
compiler/symtable.pas

@@ -98,7 +98,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
           procedure write_references(ppufile:tcompilerppufile;locals:boolean);override;
-          procedure insertfield(sym:tvarsym;addsym:boolean);
+          procedure insertfield(sym:tfieldvarsym;addsym:boolean);
           procedure addalignmentpadding;
        end;
 
@@ -203,7 +203,7 @@ interface
     function  searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym;
     function  searchsym_in_class_by_msgstr(classh:tobjectdef;const s:string):tsym;
     function  searchsystype(const s: stringid; var srsym: ttypesym): boolean;
-    function  searchsysvar(const s: stringid; var srsym: tvarsym; var symowner: tsymtable): boolean;
+    function  searchsysvar(const s: stringid; var srsym: tsym; var symowner: tsymtable): boolean;
     function  search_class_member(pd : tobjectdef;const s : string):tsym;
     function  search_assignment_operator(from_def,to_def:Tdef):Tprocdef;
 
@@ -360,8 +360,11 @@ implementation
                 ibtypesym : sym:=ttypesym.ppuload(ppufile);
                 ibprocsym : sym:=tprocsym.ppuload(ppufile);
                ibconstsym : sym:=tconstsym.ppuload(ppufile);
-                 ibvarsym : sym:=tvarsym.ppuload(ppufile);
-            ibabsolutesym : sym:=tabsolutesym.ppuload(ppufile);
+           ibglobalvarsym : sym:=tglobalvarsym.ppuload(ppufile);
+            iblocalvarsym : sym:=tlocalvarsym.ppuload(ppufile);
+             ibparavarsym : sym:=tparavarsym.ppuload(ppufile);
+            ibfieldvarsym : sym:=tfieldvarsym.ppuload(ppufile);
+         ibabsolutevarsym : sym:=tabsolutevarsym.ppuload(ppufile);
                 ibenumsym : sym:=tenumsym.ppuload(ppufile);
           ibtypedconstsym : sym:=ttypedconstsym.ppuload(ppufile);
             ibpropertysym : sym:=tpropertysym.ppuload(ppufile);
@@ -403,18 +406,18 @@ implementation
 
     procedure tstoredsymtable.writesyms(ppufile:tcompilerppufile);
       var
-        pd : Tsym;
+        pd : Tstoredsym;
       begin
          { each definition get a number, write then the amount of syms and the
            datasize to the ibsymdef entry }
          ppufile.putlongint(symindex.count);
          ppufile.writeentry(ibstartsyms);
          { foreach is used to write all symbols }
-         pd:=Tsym(symindex.first);
+         pd:=Tstoredsym(symindex.first);
          while assigned(pd) do
            begin
               pd.ppuwrite(ppufile);
-              pd:=Tsym(pd.indexnext);
+              pd:=Tstoredsym(pd.indexnext);
            end;
          { end of symbols }
          ppufile.writeentry(ibendsyms);
@@ -600,10 +603,10 @@ implementation
               the user. (Under delphi it can still be accessed using result),
               but don't allow hiding of RESULT }
             if (m_duplicate_names in aktmodeswitches) and
-               (sym.typ in [varsym,absolutesym]) and
-               (vo_is_funcret in tvarsym(sym).varoptions) and
+               (sym.typ in [localvarsym,paravarsym,absolutevarsym]) and
+               (vo_is_funcret in tabstractvarsym(sym).varoptions) and
                not((m_result in aktmodeswitches) and
-                   (vo_is_result in tvarsym(sym).varoptions)) then
+                   (vo_is_result in tabstractvarsym(sym).varoptions)) then
              sym.name:='hidden'+sym.name
             else
              DuplicateSym(sym,hsym);
@@ -714,7 +717,7 @@ implementation
 
     procedure TStoredSymtable.varsymbolused(p : TNamedIndexItem;arg:pointer);
       begin
-         if (tsym(p).typ=varsym) and
+         if (tsym(p).typ in [globalvarsym,localvarsym,paravarsym,fieldvarsym]) and
             ((tsym(p).owner.symtabletype in
              [parasymtable,localsymtable,objectsymtable,staticsymtable])) then
           begin
@@ -724,12 +727,11 @@ implementation
            { also don't count the value parameters which have local copies }
            { also don't claim for high param of open parameters (PM) }
            if (Errorcount<>0) or
-              (assigned(tvarsym(p).paraitem) and
-               tvarsym(p).paraitem.is_hidden) then
+              (vo_is_hidden in tabstractvarsym(p).varoptions) then
              exit;
-           if (tvarsym(p).refs=0) then
+           if (tstoredsym(p).refs=0) then
              begin
-                if (vo_is_funcret in tvarsym(p).varoptions) then
+                if (vo_is_funcret in tabstractvarsym(p).varoptions) then
                   begin
                     { don't warn about the result of constructors }
                     if (tsym(p).owner.symtabletype<>localsymtable) or
@@ -743,18 +745,18 @@ implementation
                 else
                   MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_not_used,tsym(p).realname);
              end
-           else if tvarsym(p).varstate=vs_assigned then
+           else if tabstractvarsym(p).varstate=vs_assigned then
              begin
                 if (tsym(p).owner.symtabletype=parasymtable) then
                   begin
-                    if not(tvarsym(p).varspez in [vs_var,vs_out]) and
-                       not(vo_is_funcret in tvarsym(p).varoptions) then
+                    if not(tabstractvarsym(p).varspez in [vs_var,vs_out]) and
+                       not(vo_is_funcret in tabstractvarsym(p).varoptions) then
                       MessagePos1(tsym(p).fileinfo,sym_h_para_identifier_only_set,tsym(p).realname)
                   end
                 else if (tsym(p).owner.symtabletype=objectsymtable) then
                   MessagePos2(tsym(p).fileinfo,sym_n_private_identifier_only_set,tsym(p).owner.realname^,tsym(p).realname)
-                else if not(vo_is_exported in tvarsym(p).varoptions) and
-                        not(vo_is_funcret in tvarsym(p).varoptions) then
+                else if not(vo_is_exported in tabstractvarsym(p).varoptions) and
+                        not(vo_is_funcret in tabstractvarsym(p).varoptions) then
                   MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_only_set,tsym(p).realname);
              end;
          end
@@ -897,10 +899,13 @@ implementation
          if b_needs_init_final then
           exit;
          case tsym(p).typ of
-           varsym :
+           fieldvarsym,
+           globalvarsym,
+           localvarsym,
+           paravarsym :
              begin
-               if not(is_class(tvarsym(p).vartype.def)) and
-                  tstoreddef(tvarsym(p).vartype.def).needs_inittable then
+               if not(is_class(tabstractvarsym(p).vartype.def)) and
+                  tstoreddef(tabstractvarsym(p).vartype.def).needs_inittable then
                  b_needs_init_final:=true;
              end;
            typedconstsym :
@@ -998,7 +1003,7 @@ implementation
       end;
 
 
-    procedure tabstractrecordsymtable.insertfield(sym : tvarsym;addsym:boolean);
+    procedure tabstractrecordsymtable.insertfield(sym : tfieldvarsym;addsym:boolean);
       var
         l      : aint;
         varalignrecord,
@@ -1009,10 +1014,10 @@ implementation
         if addsym then
           insert(sym);
         { this symbol can't be loaded to a register }
-        tvarsym(sym).varregable:=vr_none;
+        sym.varregable:=vr_none;
         { Calculate field offset }
-        l:=tvarsym(sym).getsize;
-        vardef:=tvarsym(sym).vartype.def;
+        l:=sym.getsize;
+        vardef:=sym.vartype.def;
         varalign:=vardef.alignment;
         { Calc the alignment size for C style records }
         if (usefieldalignment=-1) then
@@ -1044,14 +1049,14 @@ implementation
         if varalign=0 then
           varalign:=size_2_align(l);
         varalignfield:=used_align(varalign,aktalignment.recordalignmin,fieldalignment);
-        tvarsym(sym).fieldoffset:=align(datasize,varalignfield);
-        if (aword(l)+tvarsym(sym).fieldoffset)>high(aint) then
+        sym.fieldoffset:=align(datasize,varalignfield);
+        if (aword(l)+sym.fieldoffset)>high(aint) then
           begin
             Message(sym_e_segment_too_large);
             datasize:=high(aint);
           end
         else
-          datasize:=tvarsym(sym).fieldoffset+l;
+          datasize:=sym.fieldoffset+l;
         { Calc alignment needed for this record }
         if (usefieldalignment=-1) then
           varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
@@ -1100,7 +1105,7 @@ implementation
       the complete size (see code in pdecl unit) PM }
     procedure trecordsymtable.insertunionst(unionst : trecordsymtable;offset : longint);
       var
-        ps,nps : tvarsym;
+        ps,nps : tfieldvarsym;
         pd,npd : tdef;
         varalignrecord,varalign,
         storesize,storealign : longint;
@@ -1108,10 +1113,10 @@ implementation
         storesize:=datasize;
         storealign:=fieldalignment;
         datasize:=offset;
-        ps:=tvarsym(unionst.symindex.first);
+        ps:=tfieldvarsym(unionst.symindex.first);
         while assigned(ps) do
           begin
-            nps:=tvarsym(ps.indexnext);
+            nps:=tfieldvarsym(ps.indexnext);
             { remove from current symtable }
             unionst.symindex.deleteindex(ps);
             ps.left:=nil;
@@ -1165,7 +1170,7 @@ implementation
          hsym : tsym;
       begin
          { check for duplicate field id in inherited classes }
-         if (sym.typ=varsym) and
+         if (sym.typ=fieldvarsym) and
             assigned(defowner) and
             (
              not(m_delphi in aktmodeswitches) or
@@ -1225,10 +1230,10 @@ implementation
             { a local and the function can have the same
               name in TP and Delphi, but RESULT not }
             if (m_duplicate_names in aktmodeswitches) and
-               (hsym.typ in [absolutesym,varsym]) and
-               (vo_is_funcret in tvarsym(hsym).varoptions) and
+               (hsym.typ in [absolutevarsym,localvarsym]) and
+               (vo_is_funcret in tabstractvarsym(hsym).varoptions) and
                not((m_result in aktmodeswitches) and
-                   (vo_is_result in tvarsym(hsym).varoptions)) then
+                   (vo_is_result in tabstractvarsym(hsym).varoptions)) then
               hsym.owner.rename(hsym.name,'hidden'+hsym.name)
             else
               DuplicateSym(sym,hsym);
@@ -1244,10 +1249,10 @@ implementation
                 { a local and the function can have the same
                   name in TP and Delphi, but RESULT not }
                 if (m_duplicate_names in aktmodeswitches) and
-                   (sym.typ in [absolutesym,varsym]) and
-                   (vo_is_funcret in tvarsym(sym).varoptions) and
+                   (sym.typ in [absolutevarsym,paravarsym]) and
+                   (vo_is_funcret in tabstractvarsym(sym).varoptions) and
                    not((m_result in aktmodeswitches) and
-                       (vo_is_result in tvarsym(sym).varoptions)) then
+                       (vo_is_result in tabstractvarsym(sym).varoptions)) then
                   sym.name:='hidden'+sym.name
                 else
                   DuplicateSym(sym,hsym);
@@ -2031,18 +2036,18 @@ implementation
       end;
 
 
-    function searchsysvar(const s: stringid; var srsym: tvarsym; var symowner: tsymtable): boolean;
+    function searchsysvar(const s: stringid; var srsym: tsym; var symowner: tsymtable): boolean;
       begin
         if not(cs_compilesystem in aktmoduleswitches) then
           begin
-            srsym := tvarsym(searchsymonlyin(systemunit,s));
+            srsym := searchsymonlyin(systemunit,s);
             symowner := systemunit;
           end
         else
           searchsym(s,tsym(srsym),symowner);
         searchsysvar :=
           assigned(srsym) and
-          (srsym.typ = varsym);
+          (srsym.typ = globalvarsym);
       end;
 
 
@@ -2298,7 +2303,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.161  2004-11-05 21:16:55  peter
+  Revision 1.162  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.161  2004/11/05 21:16:55  peter
     * rename duplicate symbols and insert with unique name in the
       symtable
 

+ 17 - 45
compiler/symtype.pas

@@ -79,7 +79,7 @@ interface
          function  typename:string;
          function  gettypename:string;virtual;
          function  mangledparaname:string;
-         function  getmangledparaname:string;virtual;abstract;
+         function  getmangledparaname:string;virtual;
          function  size:aint;virtual;abstract;
          function  alignment:longint;virtual;abstract;
          function  getparentdef:tdef;virtual;
@@ -111,10 +111,7 @@ interface
          function  stabstring : pchar;virtual;
 {$endif GDB}
          constructor create(const n : string);
-         constructor loadsym(ppufile:tcompilerppufile);
          destructor destroy;override;
-         procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
-         procedure writesym(ppufile:tcompilerppufile);
          function  realname:string;
          procedure buildderef;virtual;
 {         procedure buildderefimpl;virtual;abstract;}
@@ -276,6 +273,12 @@ implementation
       end;
 
 
+    function tdef.getmangledparaname:string;
+      begin
+         result:='<unknown type>';
+      end;
+
+
     function tdef.getparentdef:tdef;
       begin
         result:=nil;
@@ -318,32 +321,6 @@ implementation
          symoptions:=current_object_option;
       end;
 
-    constructor tsym.loadsym(ppufile:tcompilerppufile);
-      var
-        s  : string;
-        nr : word;
-      begin
-         nr:=ppufile.getword;
-         s:=ppufile.getstring;
-         if s[1]='$' then
-          inherited createname(copy(s,2,255))
-         else
-          inherited createname(upper(s));
-         _realname:=stringdup(s);
-         typ:=abstractsym;
-         { force the correct indexnr. must be after create! }
-         indexnr:=nr;
-         ppufile.getposinfo(fileinfo);
-         ppufile.getsmallset(symoptions);
-         lastref:=nil;
-         defref:=nil;
-         refs:=0;
-         lastwritten:=nil;
-         refcount:=0;
-{$ifdef GDB}
-         isstabwritten := false;
-{$endif GDB}
-      end;
 
     destructor tsym.destroy;
       begin
@@ -357,23 +334,15 @@ implementation
         inherited destroy;
       end;
 
-    procedure Tsym.writesym(ppufile:tcompilerppufile);
-      begin
-         ppufile.putword(indexnr);
-         ppufile.putstring(_realname^);
-         ppufile.putposinfo(fileinfo);
-         ppufile.putsmallset(symoptions);
-      end;
 
     procedure Tsym.buildderef;
+      begin
+      end;
 
-    begin
-    end;
 
     procedure Tsym.deref;
-
-    begin
-    end;
+      begin
+      end;
 
 {$ifdef GDB}
     function Tsym.get_var_value(const s:string):string;
@@ -1048,8 +1017,8 @@ implementation
         data   : array[0..255] of byte;
       begin
         result:=nil;
-        { not initialized }
-        if dataidx=-1 then
+        { not initialized or error }
+        if dataidx<0 then
           internalerror(200306067);
         { read data }
         current_module.derefdata.seek(dataidx);
@@ -1487,7 +1456,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.46  2004-11-01 23:30:11  peter
+  Revision 1.47  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.46  2004/11/01 23:30:11  peter
     * support > 32bit accesses for x86_64
     * rewrote array size checking to support 64bit
 

+ 10 - 7
compiler/symutil.pas

@@ -47,8 +47,8 @@ implementation
 
     function is_funcret_sym(p:tsymentry):boolean;
       begin
-        is_funcret_sym:=(p.typ in [absolutesym,varsym]) and
-                        (vo_is_funcret in tvarsym(p).varoptions);
+        is_funcret_sym:=(p.typ in [absolutevarsym,localvarsym,paravarsym]) and
+                        (vo_is_funcret in tabstractvarsym(p).varoptions);
       end;
 
 
@@ -56,7 +56,7 @@ implementation
 
       begin
          needs_prop_entry:=(sp_published in tsym(sym).symoptions) and
-         (sym.typ in [propertysym,varsym]);
+         (sym.typ in [propertysym,fieldvarsym]);
       end;
 
 
@@ -103,10 +103,10 @@ implementation
     procedure count_locals(p:tnamedindexitem;arg:pointer);
       begin
         { Count only varsyms, but ignore the funcretsym }
-        if (tsym(p).typ=varsym) and
+        if (tsym(p).typ in [localvarsym,paravarsym]) and
            (tsym(p)<>current_procinfo.procdef.funcretsym) and
-           (not(vo_is_parentfp in tvarsym(p).varoptions) or
-            (tvarsym(p).refs>0)) then
+           (not(vo_is_parentfp in tabstractvarsym(p).varoptions) or
+            (tstoredsym(p).refs>0)) then
           inc(plongint(arg)^);
       end;
 
@@ -114,7 +114,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.6  2004-10-31 21:45:03  peter
+  Revision 1.7  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.6  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 5 - 2
compiler/systems.pas

@@ -239,7 +239,7 @@ interface
           shortname    : string[9];
           flags        : set of tsystemflags;
           cpu          : tsystemcpu;
-          unit_env     : string[12];
+          unit_env     : string[16];
           extradefines : string[40];
           sourceext,
           pasext,
@@ -715,7 +715,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.95  2004-11-01 15:42:00  florian
+  Revision 1.96  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.95  2004/11/01 15:42:00  florian
     * default target for x86_64 is linux
 
   Revision 1.94  2004/10/31 19:09:54  peter

+ 6 - 3
compiler/systems/t_beos.pas

@@ -35,7 +35,7 @@ interface
     timportlibbeos=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -87,7 +87,7 @@ begin
 end;
 
 
-procedure timportlibbeos.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibbeos.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -501,7 +501,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.14  2004-10-15 09:24:38  mazen
+  Revision 1.15  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.14  2004/10/15 09:24:38  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 8 - 5
compiler/systems/t_bsd.pas

@@ -50,7 +50,7 @@ implementation
     timportlibdarwin=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
       procedure generatesmartlib;override;
     end;
@@ -58,7 +58,7 @@ implementation
     timportlibbsd=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -109,7 +109,7 @@ implementation
       end;
 
 
-    procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
+    procedure timportlibdarwin.importvariable(vs:tglobalvarsym;const name,module:string);
       begin
         { insert sharedlibrary }
 {        current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
@@ -152,7 +152,7 @@ begin
 end;
 
 
-procedure timportlibbsd.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibbsd.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -627,7 +627,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.23  2004-10-25 15:38:41  peter
+  Revision 1.24  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.23  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * checkpointer fixes
 

+ 6 - 3
compiler/systems/t_linux.pas

@@ -35,7 +35,7 @@ interface
     timportliblinux=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -92,7 +92,7 @@ begin
 end;
 
 
-procedure timportliblinux.importvariable(vs:tvarsym;const name,module:string);
+procedure timportliblinux.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -592,7 +592,10 @@ end.
 
 {
   $Log$
-  Revision 1.28  2004-11-05 12:27:27  florian
+  Revision 1.29  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.28  2004/11/05 12:27:27  florian
     * fixed dyn. linker handling
 
   Revision 1.27  2004/11/05 11:04:23  florian

+ 6 - 3
compiler/systems/t_nwl.pas

@@ -111,7 +111,7 @@ implementation
     timportlibnetwlibc=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -160,7 +160,7 @@ begin
 end;
 
 
-procedure timportlibnetwlibc.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibnetwlibc.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -653,7 +653,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.8  2004-10-25 15:38:41  peter
+  Revision 1.9  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.8  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * checkpointer fixes
 

+ 6 - 3
compiler/systems/t_nwm.pas

@@ -105,7 +105,7 @@ implementation
     timportlibnetware=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -152,7 +152,7 @@ begin
 end;
 
 
-procedure timportlibnetware.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibnetware.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -571,7 +571,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.19  2004-10-25 15:38:41  peter
+  Revision 1.20  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.19  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * checkpointer fixes
 

+ 6 - 3
compiler/systems/t_sunos.pas

@@ -45,7 +45,7 @@ implementation
     timportlibsunos=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
     end;
 
@@ -98,7 +98,7 @@ begin
 end;
 
 
-procedure timportlibsunos.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibsunos.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -498,7 +498,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.13  2004-11-03 12:04:03  florian
+  Revision 1.14  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.13  2004/11/03 12:04:03  florian
     * fixed sparc <-> i386 mixture
 
   Revision 1.12  2004/10/14 18:16:17  mazen

+ 10 - 7
compiler/systems/t_win32.pas

@@ -57,7 +57,7 @@ interface
     public
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
-      procedure importvariable(vs:tvarsym;const name,module:string);override;
+      procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
       procedure generatelib;override;
       procedure generatenasmlib;virtual;
       procedure generatesmartlib;override;
@@ -169,7 +169,7 @@ implementation
       end;
 
 
-    procedure timportlibwin32.importvariable(vs:tvarsym;const name,module:string);
+    procedure timportlibwin32.importvariable(vs:tglobalvarsym;const name,module:string);
       begin
         importvariable_str(vs.mangledname,name,module);
       end;
@@ -787,8 +787,8 @@ implementation
                    inc(current_index);
                 end;
               case hp.sym.typ of
-                varsym :
-                  address_table.concat(Tai_const.Createname_rva(tvarsym(hp.sym).mangledname));
+                globalvarsym :
+                  address_table.concat(Tai_const.Createname_rva(tglobalvarsym(hp.sym).mangledname));
                 typedconstsym :
                   address_table.concat(Tai_const.Createname_rva(ttypedconstsym(hp.sym).mangledname));
                 procsym :
@@ -820,8 +820,8 @@ implementation
          while assigned(hp) do
            begin
              case hp.sym.typ of
-               varsym :
-                 s:=tvarsym(hp.sym).mangledname;
+               globalvarsym :
+                 s:=tglobalvarsym(hp.sym).mangledname;
                typedconstsym :
                  s:=ttypedconstsym(hp.sym).mangledname;
                procsym :
@@ -1612,7 +1612,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.41  2004-11-04 17:12:52  peter
+  Revision 1.42  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.41  2004/11/04 17:12:52  peter
   linking with cygwin fixed
 
   Revision 1.40  2004/10/25 15:38:41  peter

+ 250 - 143
compiler/utils/ppudump.pp

@@ -58,16 +58,20 @@ type
   tprocinfoflags=set of tprocinfoflag;
 
   { Copied from systems.pas }
-  ttargetcpu=
-  (
-        no_cpu,                   { 0 }
-        i386,                     { 1 }
-        m68k,                     { 2 }
-        alpha,                    { 3 }
-        powerpc,                  { 4 }
-        sparc,                    { 5 }
-        vm                        { 6 }
-  );
+       tsystemcpu=
+       (
+             cpu_no,                       { 0 }
+             cpu_i386,                     { 1 }
+             cpu_m68k,                     { 2 }
+             cpu_alpha,                    { 3 }
+             cpu_powerpc,                  { 4 }
+             cpu_sparc,                    { 5 }
+             cpu_vm,                       { 6 }
+             cpu_iA64,                     { 7 }
+             cpu_x86_64,                   { 8 }
+             cpu_mips,                     { 9 }
+             cpu_arm                       { 10 }
+       );
 
 var
   ppufile     : tppufile;
@@ -89,6 +93,12 @@ Begin
    has_errors:=true;
 End;
 
+
+function ToStr(w:longint):String;
+begin
+  Str(w,ToStr);
+end;
+
 Function Target2Str(w:longint):string;
 type
        { taken from systems.pas }
@@ -123,13 +133,13 @@ type
              system_x86_64_linux,       { 26 }
              system_powerpc_macosx,     { 27 }
              target_i386_emx,           { 28 }
-	     target_powerpc_netbsd,     { 29 }
+             target_powerpc_netbsd,     { 29 }
              target_powerpc_openbsd,    { 30 }
-	     target_arm_linux,          { 31 }
-	     target_i386_watcom,        { 32 }
-	     target_powerpc_MorphOS,    { 33 }
-	     target_x86_64_freebsd,     { 34 }
-	     target_i386_netwlibc       { 35 }
+             target_arm_linux,          { 31 }
+             target_i386_watcom,        { 32 }
+             target_powerpc_MorphOS,    { 33 }
+             target_x86_64_freebsd,     { 34 }
+             target_i386_netwlibc       { 35 }
        );
 const
   Targets : array[ttarget] of string[17]=(
@@ -174,19 +184,19 @@ begin
   if w<=ord(high(ttarget)) then
     Target2Str:=Targets[ttarget(w)]
   else
-    Target2Str:='<Unknown>';
+    Target2Str:='<!! Unknown target value '+tostr(w)+'>';
 end;
 
 
 Function Cpu2Str(w:longint):string;
 const
-  CpuTxt : array[ttargetcpu] of string[7]=
-    ('none','i386','m68k','alpha','powerpc','sparc','vis');
+  CpuTxt : array[tsystemcpu] of string[8]=
+    ('none','i386','m68k','alpha','powerpc','sparc','vis','ia64','x86_64','mips','arm');
 begin
-  if w<=ord(high(ttargetcpu)) then
-    Cpu2Str:=CpuTxt[ttargetcpu(w)]
+  if w<=ord(high(tsystemcpu)) then
+    Cpu2Str:=CpuTxt[tsystemcpu(w)]
   else
-    Cpu2Str:='<Unknown>';
+    Cpu2Str:='<!! Unknown cpu value '+tostr(w)+'>';
 end;
 
 
@@ -197,7 +207,17 @@ begin
   if w<=ord(high(varspezstr)) then
     Varspez2Str:=varspezstr[w]
   else
-    Varspez2Str:='<Unknown>';
+    Varspez2Str:='<!! Unknown varspez value '+tostr(w)+'>';
+end;
+
+Function VarRegable2Str(w:longint):string;
+const
+  varregableStr : array[0..3] of string[6]=('None','IntReg','FPUReg','MMReg');
+begin
+  if w<=ord(high(varregablestr)) then
+    Varregable2Str:=varregablestr[w]
+  else
+    Varregable2Str:='<!! Unknown regable value '+tostr(w)+'>';
 end;
 
 
@@ -636,9 +656,13 @@ type
     sp_private,
     sp_published,
     sp_protected,
-    sp_forwarddef,
     sp_static,
-    sp_primary_typesym    { this is for typesym, to know who is the primary symbol of a def }
+    sp_hint_deprecated,
+    sp_hint_platform,
+    sp_hint_library,
+    sp_hint_unimplemented,
+    sp_has_overloaded,
+    sp_internal  { internal symbol, not reported as unused }
   );
   tsymoptions=set of tsymoption;
   tsymopt=record
@@ -646,15 +670,19 @@ type
     str  : string[30];
   end;
 const
-  symopts=7;
+  symopts=11;
   symopt : array[1..symopts] of tsymopt=(
      (mask:sp_public;         str:'Public'),
      (mask:sp_private;        str:'Private'),
      (mask:sp_published;      str:'Published'),
      (mask:sp_protected;      str:'Protected'),
-     (mask:sp_forwarddef;     str:'ForwardDef'),
      (mask:sp_static;         str:'Static'),
-     (mask:sp_primary_typesym;str:'PrimaryTypeSym')
+     (mask:sp_hint_deprecated;str:'Hint Deprecated'),
+     (mask:sp_hint_deprecated;str:'Hint Platform'),
+     (mask:sp_hint_deprecated;str:'Hint Library'),
+     (mask:sp_hint_deprecated;str:'Hint Unimplemented'),
+     (mask:sp_has_overloaded; str:'Has overloaded'),
+     (mask:sp_internal;       str:'Internal')
   );
 var
   symoptions : tsymoptions;
@@ -679,6 +707,50 @@ begin
 end;
 
 
+procedure readcommonsym(const s:string);
+begin
+  writeln(space,'** Symbol Nr. ',ppufile.getword,' **');
+  writeln(space,s,ppufile.getstring);
+  write(space,'     File Pos : ');
+  readposinfo;
+  write(space,'   SymOptions : ');
+  readsymoptions;
+end;
+
+
+procedure readcommondef(const s:string);
+type
+  tdefoption=(df_none,
+    df_has_inittable,           { init data has been generated }
+    df_has_rttitable,           { rtti data has been generated }
+    df_unique
+  );
+  tdefoptions=set of tdefoption;
+var
+  defopts : tdefoptions;
+begin
+  writeln(space,'** Definition Nr. ',ppufile.getword,' **');
+  writeln(space,s);
+  write  (space,'      Type symbol : ');
+  readderef;
+  ppufile.getsmallset(defopts);
+
+  if df_unique in defopts then
+    writeln  (space,'      Unique type symbol');
+
+  if df_has_rttitable in defopts then
+   begin
+     write  (space,'      RTTI symbol : ');
+     readderef;
+   end;
+  if df_has_inittable in defopts then
+   begin
+     write  (space,'      Init symbol : ');
+     readderef;
+   end;
+end;
+
+
 { Read abstract procdef and return if inline procdef }
 type
   tproccalloption=(pocall_none,
@@ -884,46 +956,81 @@ begin
 end;
 
 
-procedure readcommonsym(const s:string);
-begin
-  writeln(space,'** Symbol Nr. ',ppufile.getword,' **');
-  writeln(space,s,ppufile.getstring);
-  write(space,'    File Pos: ');
-  readposinfo;
-  write(space,'  SymOptions: ');
-  readsymoptions;
-end;
-
-
-procedure readcommondef(const s:string);
 type
-  tdefoption=(df_none,
-    df_has_inittable,           { init data has been generated }
-    df_has_rttitable,           { rtti data has been generated }
-    df_unique
+  { options for variables }
+  tvaroption=(vo_none,
+    vo_is_C_var,
+    vo_is_external,
+    vo_is_dll_var,
+    vo_is_thread_var,
+    vo_has_local_copy,
+    vo_is_const,  { variable is declared as const (parameter) and can't be written to }
+    vo_is_exported,
+    vo_is_high_value,
+    vo_is_funcret,
+    vo_is_self,
+    vo_is_vmt,
+    vo_is_result,  { special result variable }
+    vo_is_parentfp,
+    vo_is_loop_counter, { used to detect assignments to loop counter }
+    vo_is_hidden
+  );
+  tvaroptions=set of tvaroption;
+  { register variable }
+  tvarregable=(vr_none,
+    vr_intreg,
+    vr_fpureg,
+    vr_mmreg
+  );
+procedure readabstractvarsym(const s:string;var varoptions:tvaroptions);
+type
+  tvaropt=record
+    mask : tvaroption;
+    str  : string[30];
+  end;
+const
+  varopts=15;
+  varopt : array[1..varopts] of tvaropt=(
+     (mask:vo_is_C_var;        str:'CVar'),
+     (mask:vo_is_external;     str:'External'),
+     (mask:vo_is_dll_var;      str:'DLLVar'),
+     (mask:vo_is_thread_var;   str:'ThreadVar'),
+     (mask:vo_has_local_copy;  str:'HasLocalCopy'),
+     (mask:vo_is_const;        str:'Constant'),
+     (mask:vo_is_exported;     str:'Exported'),
+     (mask:vo_is_high_value;   str:'HighValue'),
+     (mask:vo_is_funcret;      str:'Funcret'),
+     (mask:vo_is_self;         str:'Self'),
+     (mask:vo_is_vmt;          str:'VMT'),
+     (mask:vo_is_result;       str:'Result'),
+     (mask:vo_is_parentfp;     str:'ParentFP'),
+     (mask:vo_is_loop_counter; str:'LoopCounter'),
+     (mask:vo_is_hidden;       str:'Hidden')
   );
-  tdefoptions=set of tdefoption;
 var
-  defopts : tdefoptions;
+  i : longint;
+  first : boolean;
 begin
-  writeln(space,'** Definition Nr. ',ppufile.getword,' **');
-  writeln(space,s);
-  write  (space,'      Type symbol : ');
-  readderef;
-  ppufile.getsmallset(defopts);
-
-  if df_unique in defopts then
-    writeln  (space,'      Unique type symbol');
-
-  if df_has_rttitable in defopts then
-   begin
-     write  (space,'      RTTI symbol : ');
-     readderef;
-   end;
-  if df_has_inittable in defopts then
+  readcommonsym(s);
+  writeln(space,'         Spez : ',Varspez2Str(ppufile.getbyte));
+  writeln(space,'      Regable : ',Varregable2Str(ppufile.getbyte));
+  write  (space,'     Var Type : ');
+  readtype;
+  ppufile.getsmallset(varoptions);
+  if varoptions<>[] then
    begin
-     write  (space,'      Init symbol : ');
-     readderef;
+     write(space,'      Options : ');
+     first:=true;
+     for i:=1to varopts do
+      if (varopt[i].mask in varoptions) then
+       begin
+         if first then
+           first:=false
+         else
+           write(', ');
+         write(varopt[i].str);
+       end;
+     writeln;
    end;
 end;
 
@@ -960,21 +1067,6 @@ end;
 
 procedure readsymbols(const s:string);
 type
-  { options for variables }
-  tvaroption=(vo_none,
-    vo_regable,
-    vo_is_C_var,
-    vo_is_external,
-    vo_is_dll_var,
-    vo_is_thread_var,
-    vo_fpuregable,
-    vo_is_local_copy,
-    vo_is_const,  { variable is declared as const (parameter) and can't be written to }
-    vo_is_exported,
-    vo_is_high_value
-  );
-  tvaroptions=set of tvaroption;
-
   pguid = ^tguid;
   tguid = packed record
     D1: LongWord;
@@ -996,7 +1088,7 @@ var
   symcnt,
   i,j,len : longint;
   guid : tguid;
-
+  varoptions : tvaroptions;
 begin
   symcnt:=1;
   with ppufile do
@@ -1030,7 +1122,7 @@ begin
          ibtypesym :
            begin
              readcommonsym('Type symbol ');
-             write(space,' Result Type: ');
+             write(space,'  Result Type : ');
              readtype;
            end;
 
@@ -1040,7 +1132,7 @@ begin
              len:=ppufile.getword;
              for i:=1 to len do
               begin
-                write(space,'  Definition: ');
+                write(space,'   Definition : ');
                 readderef;
               end;
            end;
@@ -1052,15 +1144,15 @@ begin
              case tconsttyp(b) of
                constord :
                  begin
-                   write  (space,' OrdinalType: ');
+                   write  (space,'  OrdinalType : ');
                    readtype;
-                   writeln(space,'       Value: ',getint64);
+                   writeln(space,'        Value : ',getint64);
                  end;
                constpointer :
                  begin
-                   write  (space,' PointerType: ');
+                   write  (space,'  PointerType : ');
                    readtype;
-                   writeln(space,'       Value: ',getlongint)
+                   writeln(space,'        Value : ',getlongint)
                  end;
                conststring,
                constresourcestring :
@@ -1069,21 +1161,21 @@ begin
                    getmem(pc,len+1);
                    getdata(pc^,len);
                    (pc+len)^:= #0;
-                   writeln(space,'      Length: ',len);
-                   writeln(space,'       Value: "',pc,'"');
+                   writeln(space,'       Length : ',len);
+                   writeln(space,'        Value : "',pc,'"');
                    freemem(pc,len+1);
                    if tconsttyp(b)=constresourcestring then
-                    writeln(space,'       Index: ',getlongint);
+                    writeln(space,'        Index : ',getlongint);
                  end;
                constreal :
-                 writeln(space,'       Value: ',getreal);
+                 writeln(space,'        Value : ',getreal);
                constset :
                  begin
-                   write (space,'     Set Type: ');
+                   write (space,'      Set Type : ');
                    readtype;
                    for i:=1to 4 do
                     begin
-                      write (space,'       Value: ');
+                      write (space,'        Value : ');
                       for j:=1to 8 do
                        begin
                          if j>1 then
@@ -1112,96 +1204,107 @@ begin
              end;
            end;
 
-         ibvarsym :
+         ibabsolutevarsym :
            begin
-             readcommonsym('Variable symbol ');
-             writeln(space,'        Spez: ',Varspez2Str(getbyte));
-             writeln(space,'     Address: ',getlongint);
-             write  (space,'    Var Type: ');
-             readtype;
-             i:=getlongint;
-             writeln(space,'     Options: ',i);
-             if (vo_is_C_var in tvaroptions(i)) then
-               writeln(space,' Mangledname: ',getstring);
+             readabstractvarsym('Absolute variable symbol ',varoptions);
+             Write (space,' Relocated to ');
+             b:=getbyte;
+             case absolutetyp(b) of
+               tovar :
+                 readsymlist(space+'          Sym : ');
+               toasm :
+                 Writeln('Assembler name : ',getstring);
+               toaddr :
+                 begin
+                   Write('Address : ',getlongint);
+                   if tsystemcpu(ppufile.header.cpu)=cpu_i386 then
+                     WriteLn(' (Far: ',getbyte<>0,')');
+                 end;
+               else
+                 Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
+             end;
+           end;
+
+         ibfieldvarsym :
+           begin
+             readabstractvarsym('Field Variable symbol ',varoptions);
+             writeln(space,'      Address : ',getlongint);
+           end;
+
+         ibglobalvarsym :
+           begin
+             readabstractvarsym('Global Variable symbol ',varoptions);
+             write  (space,' DefaultConst : ');
+             readderef;
+             if (vo_is_C_var in varoptions) then
+               writeln(space,' Mangledname : ',getstring);
+           end;
+
+         iblocalvarsym :
+           begin
+             readabstractvarsym('Local Variable symbol ',varoptions);
+             write  (space,' DefaultConst : ');
+             readderef;
+           end;
+
+         ibparavarsym :
+           begin
+             readabstractvarsym('Parameter Variable symbol ',varoptions);
+             write  (space,' DefaultConst : ');
+             readderef;
            end;
 
          ibenumsym :
            begin
              readcommonsym('Enumeration symbol ');
-             write  (space,'  Definition: ');
+             write  (space,'   Definition : ');
              readderef;
-             writeln(space,'       Value: ',getlongint);
+             writeln(space,'        Value : ',getlongint);
            end;
 
          ibsyssym :
            begin
              readcommonsym('Internal system symbol ');
-             writeln(space,' Internal Nr: ',getlongint);
+             writeln(space,'  Internal Nr : ',getlongint);
            end;
 
          ibrttisym :
            begin
              readcommonsym('RTTI symbol ');
-             writeln(space,'   RTTI Type: ',getbyte);
+             writeln(space,'    RTTI Type : ',getbyte);
            end;
 
          ibtypedconstsym :
            begin
              readcommonsym('Typed constant ');
-             write  (space,' Constant Type: ');
+             write  (space,'  Constant Type : ');
              readtype;
-             writeln(space,'   ReallyConst: ',(getbyte<>0));
-           end;
-
-         ibabsolutesym :
-           begin
-             readcommonsym('Absolute variable symbol ');
-             writeln(space,'          Type: ',getbyte);
-             writeln(space,'       Address: ',getlongint);
-             write  (space,'      Var Type: ');
-             readtype;
-             writeln(space,'       Options: ',getlongint);
-             Write (space,' Relocated to ');
-             b:=getbyte;
-             case absolutetyp(b) of
-               tovar :
-                 readsymlist(space+'         Sym: ');
-               toasm :
-                 Writeln('Assembler name : ',getstring);
-               toaddr :
-                 begin
-                   Write('Address : ',getlongint);
-                   if ttargetcpu(ppufile.header.cpu)=i386 then
-                     WriteLn(' (Far: ',getbyte<>0,')');
-                 end;
-               else
-                 Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
-             end;
+             writeln(space,'    ReallyConst : ',(getbyte<>0));
            end;
 
          ibpropertysym :
            begin
              readcommonsym('Property ');
              i:=getlongint;
-             writeln(space,' PropOptions: ',i);
+             writeln(space,'  PropOptions : ',i);
              if (i and 32)>0 then
               begin
-                write  (space,'OverrideProp: ');
+                write  (space,' OverrideProp : ');
                 readderef;
               end
              else
               begin
-                write  (space,'   Prop Type: ');
+                write  (space,'    Prop Type : ');
                 readtype;
-                writeln(space,'       Index: ',getlongint);
-                writeln(space,'     Default: ',getlongint);
-                write  (space,'  Index Type: ');
+                writeln(space,'        Index : ',getlongint);
+                writeln(space,'      Default : ',getlongint);
+                write  (space,'   Index Type : ');
                 readtype;
-                write  (space,'  Readaccess: ');
+                write  (space,'   Readaccess : ');
                 readsymlist(space+'         Sym: ');
-                write  (space,' Writeaccess: ');
+                write  (space,'  Writeaccess : ');
                 readsymlist(space+'         Sym: ');
-                write  (space,'Storedaccess: ');
+                write  (space,' Storedaccess : ');
                 readsymlist(space+'         Sym: ');
               end;
            end;
@@ -1425,6 +1528,7 @@ begin
              writeln(space,'         DataSize : ',getlongint);
              writeln(space,'       FieldAlign : ',getbyte);
              writeln(space,'      RecordAlign : ',getbyte);
+             writeln(space,'         PadAlign : ',getbyte);
              if not EndOfEntry then
               Writeln('!! Entry has more information stored');
              {read the record definitions and symbols}
@@ -1984,7 +2088,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.57  2004-11-02 22:17:25  olle
+  Revision 1.58  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.57  2004/11/02 22:17:25  olle
     * fixed possible problem with null termination
 
   Revision 1.56  2004/09/27 18:04:11  olle

+ 6 - 3
compiler/x86/aasmcpu.pas

@@ -881,7 +881,7 @@ implementation
       begin
         case o.typ of
           top_local :
-            o.localoper^.localsymderef.build(tvarsym(o.localoper^.localsym));
+            o.localoper^.localsymderef.build(tlocalvarsym(o.localoper^.localsym));
         end;
       end;
 
@@ -897,7 +897,7 @@ implementation
                 objectlibrary.derefasmsymbol(o.ref^.relsymbol);
             end;
           top_local :
-            o.localoper^.localsym:=tvarsym(o.localoper^.localsymderef.resolve);
+            o.localoper^.localsym:=tlocalvarsym(o.localoper^.localsymderef.resolve);
         end;
       end;
 
@@ -2111,7 +2111,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.62  2004-10-31 21:45:04  peter
+  Revision 1.63  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.62  2004/10/31 21:45:04  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 5 - 2
compiler/x86/rax86att.pas

@@ -312,7 +312,7 @@ Implementation
                     will generate buggy code. Allow it only for explicit typecasting }
                   if hasdot and
                      (not oper.hastype) and
-                     (tvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
+                     (oper.opr.localsym.owner.symtabletype=parasymtable) and
                      (current_procinfo.procdef.proccalloption<>pocall_register) then
                     Message(asmr_e_cannot_access_field_directly_for_parameters);
                   inc(oper.opr.localsymofs,l)
@@ -788,7 +788,10 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.6  2004-10-31 21:45:04  peter
+  Revision 1.7  2004-11-08 22:09:59  peter
+    * tvarsym splitted
+
+  Revision 1.6  2004/10/31 21:45:04  peter
     * generic tlocation
     * move tlocation to cgutils
 

部分文件因为文件数量过多而无法显示