浏览代码

* 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)));
                             sym:=tstoredsym(symt.search(upper(ss)));
                        end;
                        end;
                   end;
                   end;
-                varsym :
+                globalvarsym,
+                localvarsym,
+                paravarsym,
+                fieldvarsym :
                   begin
                   begin
-                     if tvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
+                     if tabstractvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
                        begin
                        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));
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -516,7 +516,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 8 - 5
compiler/defcmp.pas

@@ -28,9 +28,9 @@ interface
 
 
     uses
     uses
        cclasses,
        cclasses,
-       globtype,globals,tokens,
+       globtype,globals,
        node,
        node,
-       symconst,symbase,symtype,symdef;
+       symconst,symtype,symdef;
 
 
      type
      type
        { if acp is cp_all the var const or nothing are considered equal }
        { 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
                 if currpara1.is_hidden<>currpara2.is_hidden then
                   exit;
                   exit;
                 eq:=te_equal;
                 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
                  begin
                    if (currpara1.paratyp<>currpara2.paratyp) then
                    if (currpara1.paratyp<>currpara2.paratyp) then
                     exit;
                     exit;
@@ -1296,7 +1296,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * procvar arguments need to be at least equal
 
 
   Revision 1.56  2004/11/01 08:02:26  peter
   Revision 1.56  2004/11/01 08:02:26  peter

+ 18 - 13
compiler/htypechk.pas

@@ -347,7 +347,7 @@ implementation
         result:=false;
         result:=false;
         case pf.parast.symindex.count of
         case pf.parast.symindex.count of
           1 : begin
           1 : begin
-                ld:=tvarsym(pf.parast.symindex.first).vartype.def;
+                ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
                 { assignment is a special case }
                 { assignment is a special case }
                 if optoken=_ASSIGNMENT then
                 if optoken=_ASSIGNMENT then
                   begin
                   begin
@@ -370,8 +370,8 @@ implementation
                 for i:=1 to tok2nodes do
                 for i:=1 to tok2nodes do
                   if tok2node[i].tok=optoken then
                   if tok2node[i].tok=optoken then
                     begin
                     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:=
                       result:=
                         tok2node[i].op_overloading_supported and
                         tok2node[i].op_overloading_supported and
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
@@ -635,8 +635,8 @@ implementation
             typeconvn :
             typeconvn :
               make_not_regable(ttypeconvnode(p).left);
               make_not_regable(ttypeconvnode(p).left);
             loadn :
             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;
       end;
       end;
 
 
@@ -733,7 +733,7 @@ implementation
 
 
     procedure set_varstate(p:tnode;newstate:tvarstate;must_be_valid:boolean);
     procedure set_varstate(p:tnode;newstate:tvarstate;must_be_valid:boolean);
       var
       var
-        hsym : tvarsym;
+        hsym : tabstractvarsym;
       begin
       begin
         while assigned(p) do
         while assigned(p) do
          begin
          begin
@@ -765,9 +765,9 @@ implementation
                break;
                break;
              loadn :
              loadn :
                begin
                begin
-                 if (tloadnode(p).symtableentry.typ=varsym) then
+                 if (tloadnode(p).symtableentry.typ in [localvarsym,paravarsym,globalvarsym]) then
                   begin
                   begin
-                    hsym:=tvarsym(tloadnode(p).symtableentry);
+                    hsym:=tabstractvarsym(tloadnode(p).symtableentry);
                     if must_be_valid and (hsym.varstate=vs_declared) then
                     if must_be_valid and (hsym.varstate=vs_declared) then
                       begin
                       begin
                         { Give warning/note for uninitialized locals }
                         { Give warning/note for uninitialized locals }
@@ -1030,15 +1030,17 @@ implementation
              loadn :
              loadn :
                begin
                begin
                  case tloadnode(hp).symtableentry.typ of
                  case tloadnode(hp).symtableentry.typ of
-                   absolutesym,
-                   varsym :
+                   absolutevarsym,
+                   globalvarsym,
+                   localvarsym,
+                   paravarsym :
                      begin
                      begin
                        { loop counter? }
                        { loop counter? }
                        if not(Valid_Const in opts) and
                        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);
                          CGMessage1(parser_e_illegal_assignment_to_count_var,tloadnode(hp).symtableentry.realname);
                        { derefed pointer }
                        { derefed pointer }
-                       if (tvarsym(tloadnode(hp).symtableentry).varspez=vs_const) then
+                       if (tabstractvarsym(tloadnode(hp).symtableentry).varspez=vs_const) then
                         begin
                         begin
                           { allow p^:= constructions with p is const parameter }
                           { allow p^:= constructions with p is const parameter }
                           if gotderef or (Valid_Const in opts) then
                           if gotderef or (Valid_Const in opts) then
@@ -1931,7 +1933,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * give IE instead of crash when no procsym is passed for calln
 
 
   Revision 1.101  2004/10/24 11:44:28  peter
   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(hp2).opcode = A_RET)) and
          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
          not(assigned(current_procinfo.procdef.funcretsym) 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
          (taicpu(p).oper[0]^.ref^.index = NR_NO) then
         begin
         begin
           asml.remove(p);
           asml.remove(p);
@@ -980,7 +980,7 @@ begin
                                (taicpu(p).oper[1]^.typ = top_ref) and
                                (taicpu(p).oper[1]^.typ = top_ref) and
                                (taicpu(p).oper[1]^.ref^.base = current_procinfo.FramePointer) and
                                (taicpu(p).oper[1]^.ref^.base = current_procinfo.FramePointer) and
                                not(assigned(current_procinfo.procdef.funcretsym) 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[1]^.ref^.index = NR_NO) and
                                (taicpu(p).oper[0]^.typ = top_reg) then
                                (taicpu(p).oper[0]^.typ = top_reg) then
                               begin
                               begin
@@ -1526,7 +1526,7 @@ begin
                          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
                          (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
                          (taicpu(p).oper[0]^.ref^.index = NR_NO) and
                          (taicpu(p).oper[0]^.ref^.index = NR_NO) and
                          not(assigned(current_procinfo.procdef.funcretsym) 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
                          (hp1.typ = ait_instruction) and
                          (taicpu(hp1).opcode = A_MOV) and
                          (taicpu(hp1).opcode = A_MOV) and
                          (taicpu(hp1).opsize = S_B) and
                          (taicpu(hp1).opsize = S_B) and
@@ -1999,7 +1999,10 @@ end.
 
 
 {
 {
   $Log$
   $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()
     * several fixes to allocregbetween()
 
 
   Revision 1.63  2004/10/05 20:41:02  peter
   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
                       if assigned(sym) then
                        begin
                        begin
                          case sym.typ of
                          case sym.typ of
-                           varsym :
-                             l:=tvarsym(sym).getsize;
+                           fieldvarsym :
+                             l:=tfieldvarsym(sym).getsize;
                            typedconstsym :
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
                            typesym :
@@ -914,12 +914,15 @@ Unit Ra386int;
                       if assigned(sym) then
                       if assigned(sym) then
                        begin
                        begin
                          case sym.typ of
                          case sym.typ of
-                           varsym :
+                           globalvarsym :
                              begin
                              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;
                              end;
                            typedconstsym :
                            typedconstsym :
                              begin
                              begin
@@ -1458,7 +1461,7 @@ Unit Ra386int;
                           will generate buggy code. Allow it only for explicit typecasting
                           will generate buggy code. Allow it only for explicit typecasting
                           and when the parameter is in a register (delphi compatible) }
                           and when the parameter is in a register (delphi compatible) }
                         if (not oper.hastype) and
                         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
                            (current_procinfo.procdef.proccalloption<>pocall_register) then
                           Message(asmr_e_cannot_access_field_directly_for_parameters);
                           Message(asmr_e_cannot_access_field_directly_for_parameters);
                         inc(oper.opr.localsymofs,toffset)
                         inc(oper.opr.localsymofs,toffset)
@@ -2014,7 +2017,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

+ 6 - 3
compiler/import.pas

@@ -59,7 +59,7 @@ type
       destructor Destroy;override;
       destructor Destroy;override;
       procedure preparelib(const s:string);virtual;
       procedure preparelib(const s:string);virtual;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;virtual;
       procedure generatesmartlib;virtual;
       procedure generatesmartlib;virtual;
    end;
    end;
@@ -186,7 +186,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlib.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlib.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   NotSupported;
   NotSupported;
 end;
 end;
@@ -238,7 +238,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $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
     * logs truncated
 
 
 }
 }

+ 32 - 30
compiler/ncal.pas

@@ -804,7 +804,7 @@ type
             while assigned(para) do
             while assigned(para) do
               begin
               begin
                 if para.paraitem.is_hidden and
                 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
                  begin
                    para.left.free;
                    para.left.free;
                    para.left := _funcretnode.getcopy;
                    para.left := _funcretnode.getcopy;
@@ -1119,10 +1119,10 @@ type
 
 
     function tcallnode.gen_self_tree_methodpointer:tnode;
     function tcallnode.gen_self_tree_methodpointer:tnode;
       var
       var
-        hsym : tvarsym;
+        hsym : tfieldvarsym;
       begin
       begin
         { find self field in methodpointer record }
         { 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
         if not assigned(hsym) then
           internalerror(200305251);
           internalerror(200305251);
         { Load tmehodpointer(right).self }
         { Load tmehodpointer(right).self }
@@ -1300,7 +1300,7 @@ type
               { generate hidden tree }
               { generate hidden tree }
               used_by_callnode:=false;
               used_by_callnode:=false;
               hiddentree:=nil;
               hiddentree:=nil;
-              if (vo_is_funcret in tvarsym(currpara.parasym).varoptions) then
+              if (vo_is_funcret in tparavarsym(currpara.parasym).varoptions) then
                begin
                begin
                  { Generate funcretnode if not specified }
                  { Generate funcretnode if not specified }
                  if assigned(funcretnode) then
                  if assigned(funcretnode) then
@@ -1319,7 +1319,7 @@ type
                   end;
                   end;
                end
                end
               else
               else
-               if vo_is_high_value in tvarsym(currpara.parasym).varoptions then
+               if vo_is_high_value in tparavarsym(currpara.parasym).varoptions then
                 begin
                 begin
                   if not assigned(pt) then
                   if not assigned(pt) then
                     internalerror(200304082);
                     internalerror(200304082);
@@ -1327,7 +1327,7 @@ type
                   hiddentree:=gen_high_tree(pt.left,tparaitem(currpara.previous).paratype.def);
                   hiddentree:=gen_high_tree(pt.left,tparaitem(currpara.previous).paratype.def);
                 end
                 end
               else
               else
-               if vo_is_self in tvarsym(currpara.parasym).varoptions then
+               if vo_is_self in tparavarsym(currpara.parasym).varoptions then
                  begin
                  begin
                    if assigned(right) then
                    if assigned(right) then
                      hiddentree:=gen_self_tree_methodpointer
                      hiddentree:=gen_self_tree_methodpointer
@@ -1335,12 +1335,12 @@ type
                      hiddentree:=gen_self_tree;
                      hiddentree:=gen_self_tree;
                  end
                  end
               else
               else
-               if vo_is_vmt in tvarsym(currpara.parasym).varoptions then
+               if vo_is_vmt in tparavarsym(currpara.parasym).varoptions then
                  begin
                  begin
                    hiddentree:=gen_vmt_tree;
                    hiddentree:=gen_vmt_tree;
                  end
                  end
               else
               else
-               if vo_is_parentfp in tvarsym(currpara.parasym).varoptions then
+               if vo_is_parentfp in tparavarsym(currpara.parasym).varoptions then
                  begin
                  begin
                    if not(assigned(procdefinition.owner.defowner)) then
                    if not(assigned(procdefinition.owner.defowner)) then
                      internalerror(200309287);
                      internalerror(200309287);
@@ -1742,8 +1742,8 @@ type
 
 
                { The object is already used if it is called once }
                { The object is already used if it is called once }
                if (hpt.nodetype=loadn) and
                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;
              end;
 
 
             { if we are calling the constructor check for abstract
             { if we are calling the constructor check for abstract
@@ -1898,8 +1898,7 @@ type
             else
             else
               begin
               begin
                 { local? }
                 { local? }
-                if (tloadnode(n).symtableentry.typ <> varsym) or
-                   (tloadnode(n).symtableentry.owner <> tprocdef(procdefinition).localst) then
+                if (tloadnode(n).symtableentry.typ <> localvarsym) then
                   exit;
                   exit;
                 if (tloadnode(n).symtableentry.indexnr > high(inlinelocals)) or
                 if (tloadnode(n).symtableentry.indexnr > high(inlinelocals)) or
                    not assigned(inlinelocals[tloadnode(n).symtableentry.indexnr]) then
                    not assigned(inlinelocals[tloadnode(n).symtableentry.indexnr]) then
@@ -1927,12 +1926,12 @@ type
         tempinfo: ptempnodes absolute ptempnodes(arg);
         tempinfo: ptempnodes absolute ptempnodes(arg);
         tempnode: ttempcreatenode;
         tempnode: ttempcreatenode;
       begin
       begin
-        if (tsymentry(p).typ <> varsym) then
+        if (tsymentry(p).typ <> localvarsym) then
           exit;
           exit;
         if (p.indexnr > high(inlinelocals)) then
         if (p.indexnr > high(inlinelocals)) then
           setlength(inlinelocals,p.indexnr+10);
           setlength(inlinelocals,p.indexnr+10);
 {$ifndef VER1_0}
 {$ifndef VER1_0}
-        if (vo_is_funcret in tvarsym(p).varoptions) and
+        if (vo_is_funcret in tabstractvarsym(p).varoptions) and
            assigned(funcretnode) then
            assigned(funcretnode) then
           begin
           begin
             if node_complexity(funcretnode) > 1 then
             if node_complexity(funcretnode) > 1 then
@@ -1943,26 +1942,26 @@ type
                 { a global variable that gets changed inside the function                }
                 { a global variable that gets changed inside the function                }
                 internalerror(2004072101);
                 internalerror(2004072101);
               end;
               end;
-            inlinelocals[tvarsym(p).indexnr] := funcretnode.getcopy
+            inlinelocals[tabstractvarsym(p).indexnr] := funcretnode.getcopy
           end
           end
         else
         else
 {$endif ndef VER1_0}
 {$endif ndef VER1_0}
           begin
           begin
             if (cs_regvars in aktglobalswitches) and
             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
             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);
             addstatement(tempinfo^.createstatement,tempnode);
-            if assigned(tvarsym(p).defaultconstsym) then
+            if assigned(tlocalvarsym(p).defaultconstsym) then
               begin
               begin
                 { warning: duplicate from psub.pas:initializevars() -> must refactor }
                 { warning: duplicate from psub.pas:initializevars() -> must refactor }
                 addstatement(tempinfo^.createstatement,cassignmentnode.create(
                 addstatement(tempinfo^.createstatement,cassignmentnode.create(
                                   ctemprefnode.create(tempnode),
                                   ctemprefnode.create(tempnode),
-                                  cloadnode.create(tvarsym(p).defaultconstsym,tvarsym(p).defaultconstsym.owner)));
+                                  cloadnode.create(tlocalvarsym(p).defaultconstsym,tlocalvarsym(p).defaultconstsym.owner)));
               end;
               end;
-            if (vo_is_funcret in tvarsym(p).varoptions) then
+            if (vo_is_funcret in tlocalvarsym(p).varoptions) then
               begin
               begin
                 funcretnode := ctemprefnode.create(tempnode);
                 funcretnode := ctemprefnode.create(tempnode);
                 addstatement(tempinfo^.deletestatement,ctempdeletenode.create_normal_temp(tempnode));
                 addstatement(tempinfo^.deletestatement,ctempdeletenode.create_normal_temp(tempnode));
@@ -1988,14 +1987,14 @@ type
         para := tcallparanode(left);
         para := tcallparanode(left);
         while assigned(para) do
         while assigned(para) do
           begin
           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 }
                { 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
                 (not assigned(funcretnode))) then
               begin
               begin
                 { create temps for value parameters, function result and also for    }
                 { create temps for value parameters, function result and also for    }
                 { const parameters which are passed by value instead of by reference }
                 { 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_value) or
                    ((para.paraitem.paratyp = vs_const) and
                    ((para.paraitem.paratyp = vs_const) and
                     (not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption) or
                     (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
                      (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
                   begin
                   begin
                     if (cs_regvars in aktglobalswitches) and
                     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)
                       tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
                     else
                     else
                       tempnode := ctempcreatenode.create(para.left.resulttype,para.left.resulttype.def.size,tt_persistent);
                       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 }
                     { 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  }
                     { (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)                                   }
                     {  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
                       begin
                         addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                         addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                           para.left));
                           para.left));
@@ -2031,7 +2030,7 @@ type
                 else if node_complexity(para.left) > 1 then
                 else if node_complexity(para.left) > 1 then
                   begin
                   begin
                     if (cs_regvars in aktglobalswitches) and
                     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)
                       tempnode := ctempcreatenode.create_reg(voidpointertype,voidpointertype.def.size,tt_persistent)
                     else
                     else
                       tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
                       tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
@@ -2414,7 +2413,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
       supress the generation of warning/hints
 
 

+ 6 - 3
compiler/ncgbas.pas

@@ -134,7 +134,7 @@ interface
 
 
       procedure ResolveRef(var op:toper);
       procedure ResolveRef(var op:toper);
         var
         var
-          sym : tvarsym;
+          sym : tlocalvarsym;
 {$ifdef x86}
 {$ifdef x86}
           scale : byte;
           scale : byte;
 {$endif x86}
 {$endif x86}
@@ -150,7 +150,7 @@ interface
               scale:=op.localoper^.localscale;
               scale:=op.localoper^.localscale;
 {$endif x86}
 {$endif x86}
               getoffset:=op.localoper^.localgetoffset;
               getoffset:=op.localoper^.localgetoffset;
-              sym:=tvarsym(pointer(op.localoper^.localsym));
+              sym:=tlocalvarsym(pointer(op.localoper^.localsym));
               dispose(op.localoper);
               dispose(op.localoper);
               case sym.localloc.loc of
               case sym.localloc.loc of
                 LOC_REFERENCE :
                 LOC_REFERENCE :
@@ -491,7 +491,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

+ 8 - 5
compiler/ncgcal.pas

@@ -386,7 +386,7 @@ implementation
                begin
                begin
                  { don't push a node that already generated a pointer type
                  { don't push a node that already generated a pointer type
                    by address for implicit hidden parameters }
                    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
                     (not(left.resulttype.def.deftype in [pointerdef,classrefdef]) and
                      paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
                      paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
                          aktcallnode.procdefinition.proccalloption)) then
                          aktcallnode.procdefinition.proccalloption)) then
@@ -398,7 +398,7 @@ implementation
              else if (paraitem.paratype.def.deftype=formaldef) then
              else if (paraitem.paratype.def.deftype=formaldef) then
                begin
                begin
                   { allow passing of a constant to a const formaldef }
                   { 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
                      (left.location.loc=LOC_CONSTANT) then
                     location_force_mem(exprasmlist,left.location);
                     location_force_mem(exprasmlist,left.location);
 
 
@@ -461,7 +461,7 @@ implementation
              { update return location in callnode when this is the function
              { update return location in callnode when this is the function
                result }
                result }
              if assigned(paraitem.parasym) and
              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);
                location_copy(aktcallnode.location,left.location);
            end;
            end;
 
 
@@ -663,7 +663,7 @@ implementation
                begin
                begin
                  { don't release the funcret temp }
                  { don't release the funcret temp }
                  if not(assigned(ppn.paraitem.parasym)) or
                  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);
                    location_freetemp(exprasmlist,ppn.left.location);
                  { process also all nodes of an array of const }
                  { process also all nodes of an array of const }
                  if ppn.left.nodetype=arrayconstructorn then
                  if ppn.left.nodetype=arrayconstructorn then
@@ -1253,7 +1253,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed arm compilation with cgutils
     * ...
     * ...
 
 

+ 10 - 7
compiler/ncgflw.pas

@@ -1158,11 +1158,11 @@ implementation
          { what a hack ! }
          { what a hack ! }
          if assigned(exceptsymtable) then
          if assigned(exceptsymtable) then
            begin
            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,
              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
            end
          else
          else
            begin
            begin
@@ -1221,8 +1221,8 @@ implementation
          { clear some stuff }
          { clear some stuff }
          if assigned(exceptsymtable) then
          if assigned(exceptsymtable) then
            begin
            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
            end
          else
          else
            tg.Ungettemp(exprasmlist,exceptref);
            tg.Ungettemp(exprasmlist,exceptref);
@@ -1443,7 +1443,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
     * loadref parameter removed from concatcopy,incrrefcount,etc
 
 

+ 25 - 20
compiler/ncgld.pas

@@ -72,7 +72,7 @@ implementation
     procedure tcgloadnode.generate_picvaraccess;
     procedure tcgloadnode.generate_picvaraccess;
       begin
       begin
         location.reference.base:=current_procinfo.got;
         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;
       end;
 
 
 
 
@@ -90,20 +90,20 @@ implementation
          newsize:=def_cgsize(resulttype.def);
          newsize:=def_cgsize(resulttype.def);
          location_reset(location,LOC_REFERENCE,newsize);
          location_reset(location,LOC_REFERENCE,newsize);
          case symtableentry.typ of
          case symtableentry.typ of
-            absolutesym :
+            absolutevarsym :
                begin
                begin
                   { this is only for toasm and toaddr }
                   { this is only for toasm and toaddr }
-                  case tabsolutesym(symtableentry).abstyp of
+                  case tabsolutevarsym(symtableentry).abstyp of
                     toaddr :
                     toaddr :
                       begin
                       begin
 {$ifdef i386}
 {$ifdef i386}
-                        if tabsolutesym(symtableentry).absseg then
+                        if tabsolutevarsym(symtableentry).absseg then
                           location.reference.segment:=NR_FS;
                           location.reference.segment:=NR_FS;
 {$endif i386}
 {$endif i386}
-                        location.reference.offset:=tabsolutesym(symtableentry).fieldoffset;
+                        location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                       end;
                       end;
                     toasm :
                     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
                     else
                       internalerror(200310283);
                       internalerror(200310283);
                   end;
                   end;
@@ -119,12 +119,14 @@ implementation
                  else
                  else
                    internalerror(22798);
                    internalerror(22798);
               end;
               end;
-            varsym :
+            globalvarsym,
+            localvarsym,
+            paravarsym :
                begin
                begin
                   symtabletype:=symtable.symtabletype;
                   symtabletype:=symtable.symtabletype;
                   hregister:=NR_NO;
                   hregister:=NR_NO;
                   { DLL variable }
                   { DLL variable }
-                  if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
+                  if (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then
                     begin
                     begin
                       if target_info.system=system_powerpc_darwin then
                       if target_info.system=system_powerpc_darwin then
                         begin
                         begin
@@ -135,13 +137,13 @@ implementation
                       else
                       else
                         begin
                         begin
                           hregister:=cg.getaddressregister(exprasmlist);
                           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);
                           cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister);
                           reference_reset_base(location.reference,hregister,0);
                           reference_reset_base(location.reference,hregister,0);
                         end;
                         end;
                     end
                     end
                   { Thread variable }
                   { 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
                     begin
                        {
                        {
                          Thread var loading is optimized to first check if
                          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_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister);
                        cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,norelocatelab);
                        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 }
                        { 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);
                        paramanager.allocparaloc(exprasmlist,paraloc1);
                        cg.a_param_ref(exprasmlist,OS_ADDR,href,paraloc1);
                        cg.a_param_ref(exprasmlist,OS_ADDR,href,paraloc1);
                        paramanager.freeparaloc(exprasmlist,paraloc1);
                        paramanager.freeparaloc(exprasmlist,paraloc1);
@@ -181,7 +183,7 @@ implementation
                          layout of a threadvar is (4 bytes pointer):
                          layout of a threadvar is (4 bytes pointer):
                            0 - Threadvar index
                            0 - Threadvar index
                            4 - Threadvar value in single threading }
                            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_loadaddr_ref_reg(exprasmlist,href,hregister);
                        cg.a_label(exprasmlist,endrelocatelab);
                        cg.a_label(exprasmlist,endrelocatelab);
                        location.reference.base:=hregister;
                        location.reference.base:=hregister;
@@ -194,10 +196,10 @@ implementation
                       secondpass(left);
                       secondpass(left);
                       if left.location.loc<>LOC_REGISTER then
                       if left.location.loc<>LOC_REGISTER then
                         internalerror(200309286);
                         internalerror(200309286);
-                      if tvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
+                      if tabstractnormalvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
                         internalerror(200409241);
                         internalerror(200409241);
                       hregister:=left.location.register;
                       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
                     end
                   { Normal (or external) variable }
                   { Normal (or external) variable }
                   else
                   else
@@ -229,7 +231,7 @@ implementation
                               stt_exceptsymtable,
                               stt_exceptsymtable,
                               localsymtable,
                               localsymtable,
                               parasymtable :
                               parasymtable :
-                                location:=tvarsym(symtableentry).localloc;
+                                location:=tabstractnormalvarsym(symtableentry).localloc;
                               globalsymtable,
                               globalsymtable,
                               staticsymtable :
                               staticsymtable :
                                 begin
                                 begin
@@ -241,10 +243,10 @@ implementation
                                     end
                                     end
                                   else
                                   else
                                     begin
                                     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
                                       else
-                                        location:=tvarsym(symtableentry).localloc;
+                                        location:=tglobalvarsym(symtableentry).localloc;
                                     end;
                                     end;
                                 end;
                                 end;
                               else
                               else
@@ -272,7 +274,7 @@ implementation
                     end;
                     end;
 
 
                   { make const a LOC_CREFERENCE }
                   { 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_REFERENCE) then
                     location.loc:=LOC_CREFERENCE;
                     location.loc:=LOC_CREFERENCE;
                end;
                end;
@@ -955,7 +957,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * support @labelsym
 
 
   Revision 1.129  2004/10/31 21:45:03  peter
   Revision 1.129  2004/10/31 21:45:03  peter

+ 9 - 6
compiler/ncgmem.pas

@@ -163,7 +163,7 @@ implementation
     procedure tcgloadparentfpnode.pass_2;
     procedure tcgloadparentfpnode.pass_2;
       var
       var
         currpi : tprocinfo;
         currpi : tprocinfo;
-        hsym   : tvarsym;
+        hsym   : tparavarsym;
         href   : treference;
         href   : treference;
       begin
       begin
         if (current_procinfo.procdef.parast.symtablelevel=parentpd.parast.symtablelevel) then
         if (current_procinfo.procdef.parast.symtablelevel=parentpd.parast.symtablelevel) then
@@ -177,7 +177,7 @@ implementation
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location.register:=cg.getaddressregister(exprasmlist);
             location.register:=cg.getaddressregister(exprasmlist);
             { load framepointer of current proc }
             { load framepointer of current proc }
-            hsym:=tvarsym(currpi.procdef.parast.search('parentfp'));
+            hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
             if not assigned(hsym) then
             if not assigned(hsym) then
               internalerror(200309281);
               internalerror(200309281);
             cg.a_load_loc_reg(exprasmlist,OS_ADDR,hsym.localloc,location.register);
             cg.a_load_loc_reg(exprasmlist,OS_ADDR,hsym.localloc,location.register);
@@ -187,7 +187,7 @@ implementation
                 currpi:=currpi.parent;
                 currpi:=currpi.parent;
                 if not assigned(currpi) then
                 if not assigned(currpi) then
                   internalerror(200311201);
                   internalerror(200311201);
-                hsym:=tvarsym(currpi.procdef.parast.search('parentfp'));
+                hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
                 if not assigned(hsym) then
                 if not assigned(hsym) then
                   internalerror(200309282);
                   internalerror(200309282);
                 if hsym.localloc.loc<>LOC_REFERENCE then
                 if hsym.localloc.loc<>LOC_REFERENCE then
@@ -223,7 +223,7 @@ implementation
             (left.nodetype=loadn) and
             (left.nodetype=loadn) and
             (tloadnode(left).resulttype.def.deftype=procvardef) and
             (tloadnode(left).resulttype.def.deftype=procvardef) and
             assigned(tloadnode(left).symtableentry) 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)
            cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register)
          else
          else
            cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
            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
             if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
              begin
              begin
                { Get high value }
                { 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 }
                { it must be available }
                if not assigned(hightree) then
                if not assigned(hightree) then
                  internalerror(200212201);
                  internalerror(200212201);
@@ -878,7 +878,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * support > 32bit accesses for x86_64
     * rewrote array size checking to support 64bit
     * 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 free_exception(list:TAAsmoutput;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean);
 
 
     procedure insertconstdata(sym : ttypedconstsym);
     procedure insertconstdata(sym : ttypedconstsym);
-    procedure insertbssdata(sym : tvarsym);
+    procedure insertbssdata(sym : tglobalvarsym);
 
 
     procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable);
     procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable);
     procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable);
     procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable);
@@ -721,52 +721,52 @@ implementation
         href : treference;
         href : treference;
         hreg : tregister;
         hreg : tregister;
         list : TAAsmoutput;
         list : TAAsmoutput;
-        hsym : tvarsym;
+        hsym : tparavarsym;
         l    : longint;
         l    : longint;
         localcopyloc : tlocation;
         localcopyloc : tlocation;
       begin
       begin
         list:=taasmoutput(arg);
         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
          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
             begin
               { cdecl functions don't have a high pointer so it is not possible to generate
               { cdecl functions don't have a high pointer so it is not possible to generate
                 a local copy }
                 a local copy }
               if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
               if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
                 begin
                 begin
-                  hsym:=tvarsym(tsym(p).owner.search('high'+p.name));
+                  hsym:=tparavarsym(tsym(p).owner.search('high'+p.name));
                   if not assigned(hsym) then
                   if not assigned(hsym) then
                     internalerror(200306061);
                     internalerror(200306061);
                   hreg:=cg.getaddressregister(list);
                   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;
             end
             end
            else
            else
             begin
             begin
               { Allocate space for the local copy }
               { Allocate space for the local copy }
-              l:=tvarsym(p).getsize;
+              l:=tparavarsym(p).getsize;
               localcopyloc.loc:=LOC_REFERENCE;
               localcopyloc.loc:=LOC_REFERENCE;
               localcopyloc.size:=int_cgsize(l);
               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 }
               { Copy data }
-              if is_shortstring(tvarsym(p).vartype.def) then
+              if is_shortstring(tparavarsym(p).vartype.def) then
                 begin
                 begin
                   { this code is only executed before the code for the body and the entry/exit code is generated
                   { 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
                     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);
                   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
                 end
               else
               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 }
               { 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;
          end;
       end;
       end;
@@ -775,11 +775,12 @@ implementation
     { initializes the regvars from staticsymtable with 0 }
     { initializes the regvars from staticsymtable with 0 }
     procedure initialize_regvars(p : tnamedindexitem;arg:pointer);
     procedure initialize_regvars(p : tnamedindexitem;arg:pointer);
       begin
       begin
-        if (tsym(p).typ=varsym) then
+        if (tsym(p).typ=globalvarsym) then
          begin
          begin
-           case tvarsym(p).localloc.loc of
+           case tglobalvarsym(p).localloc.loc of
              LOC_CREGISTER :
              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 : ;
              LOC_REFERENCE : ;
              else
              else
                internalerror(200410124);
                internalerror(200410124);
@@ -794,10 +795,10 @@ implementation
         oldexprasmlist : TAAsmoutput;
         oldexprasmlist : TAAsmoutput;
         hp : tnode;
         hp : tnode;
       begin
       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
          begin
            oldexprasmlist:=exprasmlist;
            oldexprasmlist:=exprasmlist;
            exprasmlist:=taasmoutput(arg);
            exprasmlist:=taasmoutput(arg);
@@ -829,16 +830,12 @@ implementation
     { generates the code for finalisation of local variables }
     { generates the code for finalisation of local variables }
     procedure finalize_local_vars(p : tnamedindexitem;arg:pointer);
     procedure finalize_local_vars(p : tnamedindexitem;arg:pointer);
       begin
       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;
       end;
 
 
 
 
@@ -878,12 +875,12 @@ implementation
         pd : tprocdef;
         pd : tprocdef;
       begin
       begin
         case tsym(p).typ of
         case tsym(p).typ of
-          varsym :
+          globalvarsym :
             begin
             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));
                 finalize_sym(taasmoutput(arg),tsym(p));
             end;
             end;
           typedconstsym :
           typedconstsym :
@@ -916,22 +913,22 @@ implementation
         list : TAAsmoutput;
         list : TAAsmoutput;
       begin
       begin
         list:=taasmoutput(arg);
         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
          begin
-           case tvarsym(p).varspez of
+           case tparavarsym(p).varspez of
              vs_value :
              vs_value :
                begin
                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;
                end;
              vs_out :
              vs_out :
                begin
                begin
                  tmpreg:=cg.getaddressregister(list);
                  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);
                  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;
            end;
          end;
          end;
@@ -945,29 +942,30 @@ implementation
         href : treference;
         href : treference;
         l : tlocation;
         l : tlocation;
       begin
       begin
+        if not(tsym(p).typ=paravarsym) then
+          exit;
         list:=taasmoutput(arg);
         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
          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
             begin
               include(current_procinfo.flags,pi_needs_implicit_finally);
               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;
          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;
       end;
 
 
 
 
@@ -1016,7 +1014,7 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
         href   : treference;
         href   : treference;
 {$endif cpu64bit}
 {$endif cpu64bit}
-        ressym : tvarsym;
+        ressym : tabstractnormalvarsym;
         resloc,
         resloc,
         restmploc : tlocation;
         restmploc : tlocation;
         hreg   : tregister;
         hreg   : tregister;
@@ -1027,7 +1025,7 @@ implementation
            (
            (
             (po_assembler in current_procinfo.procdef.procoptions) and
             (po_assembler in current_procinfo.procdef.procoptions) and
             (not(assigned(current_procinfo.procdef.funcretsym)) or
             (not(assigned(current_procinfo.procdef.funcretsym)) or
-             (tvarsym(current_procinfo.procdef.funcretsym).refs=0))
+             (tabstractvarsym(current_procinfo.procdef.funcretsym).refs=0))
            ) then
            ) then
            exit;
            exit;
 
 
@@ -1037,9 +1035,9 @@ implementation
 
 
         { constructors return self }
         { constructors return self }
         if (current_procinfo.procdef.proctypeoption=potype_constructor) then
         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
         else
-          ressym:=tvarsym(current_procinfo.procdef.funcretsym);
+          ressym:=tabstractnormalvarsym(current_procinfo.procdef.funcretsym);
         if (ressym.refs>0) then
         if (ressym.refs>0) then
           begin
           begin
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
@@ -1304,10 +1302,10 @@ implementation
             paraloc:=hp.paraloc[calleeside].location;
             paraloc:=hp.paraloc[calleeside].location;
             if not assigned(paraloc) then
             if not assigned(paraloc) then
               internalerror(200408203);
               internalerror(200408203);
-            case tvarsym(hp.parasym).localloc.loc of
+            case tabstractnormalvarsym(hp.parasym).localloc.loc of
               LOC_REFERENCE :
               LOC_REFERENCE :
                 begin
                 begin
-                  href:=tvarsym(hp.parasym).localloc.reference;
+                  href:=tparavarsym(hp.parasym).localloc.reference;
                   while assigned(paraloc) do
                   while assigned(paraloc) do
                     begin
                     begin
                       unget_para(paraloc^);
                       unget_para(paraloc^);
@@ -1319,28 +1317,28 @@ implementation
               LOC_CREGISTER :
               LOC_CREGISTER :
                 begin
                 begin
 {$ifndef cpu64bit}
 {$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
                     begin
                       { First 32bits }
                       { First 32bits }
                       unget_para(paraloc^);
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
                       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
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reglo);
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reglo);
                       { Second 32bits }
                       { Second 32bits }
                       if not assigned(paraloc^.next) then
                       if not assigned(paraloc^.next) then
                         internalerror(200410104);
                         internalerror(200410104);
                       unget_para(paraloc^);
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
                       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
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reghi);
+                        gen_load_reg(paraloc^,tparavarsym(hp.parasym).localloc.register64.reghi);
                     end
                     end
                   else
                   else
 {$endif cpu64bit}
 {$endif cpu64bit}
                     begin
                     begin
                       unget_para(paraloc^);
                       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
                       if assigned(paraloc^.next) then
                         internalerror(200410105);
                         internalerror(200410105);
                     end;
                     end;
@@ -1363,7 +1361,7 @@ implementation
                   tg.UnGetTemp(list,tempref);
                   tg.UnGetTemp(list,tempref);
 {$else sparc}
 {$else sparc}
                   unget_para(paraloc^);
                   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
                   if assigned(paraloc^.next) then
                     internalerror(200410109);
                     internalerror(200410109);
 {$endif sparc}
 {$endif sparc}
@@ -1371,7 +1369,7 @@ implementation
               LOC_CMMREGISTER :
               LOC_CMMREGISTER :
                 begin
                 begin
                   unget_para(paraloc^);
                   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
                   if assigned(paraloc^.next) then
                     internalerror(200410108);
                     internalerror(200410108);
                 end;
                 end;
@@ -1619,30 +1617,30 @@ implementation
                tostr(N_LSYM)+',0,0,'+tostr(current_procinfo.parent_framepointer_offset)))); }
                tostr(N_LSYM)+',0,0,'+tostr(current_procinfo.parent_framepointer_offset)))); }
 
 
             if assigned(current_procinfo.procdef.funcretsym) and
             if assigned(current_procinfo.procdef.funcretsym) and
-               (tvarsym(current_procinfo.procdef.funcretsym).refs>0) then
+               (tabstractnormalvarsym(current_procinfo.procdef.funcretsym).refs>0) then
               begin
               begin
-                if tvarsym(current_procinfo.procdef.funcretsym).localloc.loc=LOC_REFERENCE then
+                if tabstractnormalvarsym(current_procinfo.procdef.funcretsym).localloc.loc=LOC_REFERENCE then
                   begin
                   begin
 {$warning Need to add gdb support for ret in param register calling}
 {$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
                     if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
                       begin
                       begin
                         list.concat(Tai_stabs.Create(strpnew(
                         list.concat(Tai_stabs.Create(strpnew(
                            '"'+current_procinfo.procdef.procsym.name+':X*'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
                            '"'+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
                         if (m_result in aktmodeswitches) then
                           list.concat(Tai_stabs.Create(strpnew(
                           list.concat(Tai_stabs.Create(strpnew(
                              '"RESULT:X*'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
                              '"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
                     else
                     else
                       begin
                       begin
                         list.concat(Tai_stabs.Create(strpnew(
                         list.concat(Tai_stabs.Create(strpnew(
                            '"'+current_procinfo.procdef.procsym.name+':X'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
                            '"'+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
                         if (m_result in aktmodeswitches) then
                           list.concat(Tai_stabs.Create(strpnew(
                           list.concat(Tai_stabs.Create(strpnew(
                              '"RESULT:X'+tstoreddef(current_procinfo.procdef.rettype.def).numberstring+'",'+
                              '"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;
                   end;
               end;
               end;
@@ -1812,7 +1810,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure insertbssdata(sym : tvarsym);
+    procedure insertbssdata(sym : tglobalvarsym);
       var
       var
         l,varalign : longint;
         l,varalign : longint;
         storefilepos : tfileposinfo;
         storefilepos : tfileposinfo;
@@ -1852,16 +1850,16 @@ implementation
         sym:=tsym(st.symindex.first);
         sym:=tsym(st.symindex.first);
         while assigned(sym) do
         while assigned(sym) do
           begin
           begin
-            if (sym.typ=varsym) then
+            if (sym.typ in [globalvarsym,localvarsym,paravarsym]) then
               begin
               begin
-                with tvarsym(sym) do
+                with tabstractnormalvarsym(sym) do
                   begin
                   begin
                     { Parameters passed to assembler procedures need to be kept
                     { Parameters passed to assembler procedures need to be kept
                       in the original location }
                       in the original location }
-                    if (st.symtabletype=parasymtable) and
+                    if (sym.typ=paravarsym) and
                        (po_assembler in current_procinfo.procdef.procoptions) then
                        (po_assembler in current_procinfo.procdef.procoptions) then
                       begin
                       begin
-                        paraitem.paraloc[calleeside].get_location(localloc);
+                        tparavarsym(sym).paraitem.paraloc[calleeside].get_location(localloc);
                       end
                       end
                     else
                     else
                       begin
                       begin
@@ -1916,10 +1914,10 @@ implementation
                               parasymtable :
                               parasymtable :
                                 begin
                                 begin
                                   { Reuse the parameter location for values to are at a single location on the stack }
                                   { 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
                                     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
                                     end
                                   else
                                   else
                                     begin
                                     begin
@@ -1981,9 +1979,9 @@ implementation
         sym:=tsym(st.symindex.first);
         sym:=tsym(st.symindex.first);
         while assigned(sym) do
         while assigned(sym) do
           begin
           begin
-            if (sym.typ=varsym) then
+            if (sym.typ in [globalvarsym,localvarsym,paravarsym]) then
               begin
               begin
-                with tvarsym(sym) do
+                with tabstractnormalvarsym(sym) do
                   begin
                   begin
                     { Note: We need to keep the data available in memory
                     { Note: We need to keep the data available in memory
                       for the sub procedures that can access local data
                       for the sub procedures that can access local data
@@ -2019,9 +2017,9 @@ implementation
         sym:=tsym(pd.parast.symindex.first);
         sym:=tsym(pd.parast.symindex.first);
         while assigned(sym) do
         while assigned(sym) do
           begin
           begin
-            if sym.typ=varsym then
+            if sym.typ=paravarsym then
               begin
               begin
-                with tvarsym(sym) do
+                with tparavarsym(sym) do
                   begin
                   begin
                     { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
                     { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
                     localloc.loc:=LOC_REFERENCE;
                     localloc.loc:=LOC_REFERENCE;
@@ -2086,7 +2084,7 @@ implementation
            (po_assembler in pd.procoptions) then
            (po_assembler in pd.procoptions) then
           exit;
           exit;
         { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
         { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
-        with tvarsym(pd.funcretsym) do
+        with tlocalvarsym(pd.funcretsym) do
           begin
           begin
             localloc.loc:=LOC_REFERENCE;
             localloc.loc:=LOC_REFERENCE;
             localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline));
             localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline));
@@ -2182,8 +2180,10 @@ implementation
         case p.typ of
         case p.typ of
           typesym :
           typesym :
             def:=tstoreddef(ttypesym(p).restype.def);
             def:=tstoreddef(ttypesym(p).restype.def);
-          varsym :
-            def:=tstoreddef(tvarsym(p).vartype.def);
+          globalvarsym,
+          localvarsym,
+          paravarsym :
+            def:=tstoreddef(tabstractvarsym(p).vartype.def);
           else
           else
             internalerror(200108263);
             internalerror(200108263);
         end;
         end;
@@ -2212,7 +2212,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed open arrays when using register variables
 
 
   Revision 1.236  2004/11/04 17:12:24  peter
   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);
           exclude(loopflags,lnf_dont_mind_loopvar_on_exit);
           writeln('Loopvar does matter on exit');
           writeln('Loopvar does matter on exit');
         end;
         end;
-      Tvarsym(symbol).unregister_notification(loopvar_notid);
+      Tabstractvarsym(symbol).unregister_notification(loopvar_notid);
     end;
     end;
 
 
     function tfornode.det_resulttype:tnode;
     function tfornode.det_resulttype:tnode;
@@ -729,7 +729,7 @@ implementation
 
 
     function tfornode.pass_1 : tnode;
     function tfornode.pass_1 : tnode;
       var
       var
-         old_t_times : longint; 
+         old_t_times : longint;
      begin
      begin
          result:=nil;
          result:=nil;
          expectloc:=LOC_VOID;
          expectloc:=LOC_VOID;
@@ -746,7 +746,7 @@ implementation
             if codegenerror then
             if codegenerror then
              exit;
              exit;
           end;
           end;
-           
+
          registersint:=t1.registersint;
          registersint:=t1.registersint;
          registersfpu:=t1.registersfpu;
          registersfpu:=t1.registersfpu;
 {$ifdef SUPPORT_MMX}
 {$ifdef SUPPORT_MMX}
@@ -1424,7 +1424,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 9 - 6
compiler/ninl.pas

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

+ 30 - 23
compiler/nld.pas

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

+ 9 - 6
compiler/nmem.pas

@@ -77,7 +77,7 @@ interface
        tderefnodeclass = class of tderefnode;
        tderefnodeclass = class of tderefnode;
 
 
        tsubscriptnode = class(tunarynode)
        tsubscriptnode = class(tunarynode)
-          vs : tvarsym;
+          vs : tfieldvarsym;
           vsderef : tderef;
           vsderef : tderef;
           constructor create(varsym : tsym;l : tnode);virtual;
           constructor create(varsym : tsym;l : tnode);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
@@ -433,8 +433,8 @@ implementation
 {$ifdef i386}
 {$ifdef i386}
             if assigned(hp) and
             if assigned(hp) and
                (hp.nodetype=loadn) 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
              begin
                if not(nf_typedaddr in flags) then
                if not(nf_typedaddr in flags) then
                  resulttype:=voidfarpointertype
                  resulttype:=voidfarpointertype
@@ -558,7 +558,7 @@ implementation
       begin
       begin
          inherited create(subscriptn,l);
          inherited create(subscriptn,l);
          { vs should be changed to tsym! }
          { vs should be changed to tsym! }
-         vs:=tvarsym(varsym);
+         vs:=tfieldvarsym(varsym);
       end;
       end;
 
 
     constructor tsubscriptnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
     constructor tsubscriptnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
@@ -585,7 +585,7 @@ implementation
     procedure tsubscriptnode.derefimpl;
     procedure tsubscriptnode.derefimpl;
       begin
       begin
         inherited derefimpl;
         inherited derefimpl;
-        vs:=tvarsym(vsderef.resolve);
+        vs:=tfieldvarsym(vsderef.resolve);
       end;
       end;
 
 
 
 
@@ -982,7 +982,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
       supress the generation of warning/hints
 
 

+ 7 - 4
compiler/nobj.pas

@@ -1375,10 +1375,10 @@ implementation
         end;
         end;
       hsym:=tsym(procdef.parast.search('self'));
       hsym:=tsym(procdef.parast.search('self'));
       if not(assigned(hsym) and
       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);
         internalerror(200305251);
-      paraloc:=tvarsym(hsym).paraitem.paraloc[callerside].location^;
+      paraloc:=tparavarsym(hsym).paraitem.paraloc[callerside].location^;
       case paraloc.loc of
       case paraloc.loc of
         LOC_REGISTER:
         LOC_REGISTER:
           cg.a_op_const_reg(exprasmlist,OP_SUB,paraloc.size,ioffset,paraloc.register);
           cg.a_op_const_reg(exprasmlist,OP_SUB,paraloc.size,ioffset,paraloc.register);
@@ -1400,7 +1400,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed writing of methodtable
 
 
   Revision 1.78  2004/10/15 09:14:17  mazen
   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);
     procedure load_procvar_from_calln(var p1:tnode);
     function maybe_call_procvar(var p1:tnode;tponly:boolean):boolean;
     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_self_node:tnode;
     function load_result_node:tnode;
     function load_result_node:tnode;
     function load_self_pointer_node:tnode;
     function load_self_pointer_node:tnode;
@@ -236,7 +236,7 @@ implementation
       end;
       end;
 
 
 
 
-    function load_high_value_node(vs:tvarsym):tnode;
+    function load_high_value_node(vs:tparavarsym):tnode;
       var
       var
         srsym : tsym;
         srsym : tsym;
         srsymtable : tsymtable;
         srsymtable : tsymtable;
@@ -326,8 +326,8 @@ implementation
     function is_self_node(p:tnode):boolean;
     function is_self_node(p:tnode):boolean;
       begin
       begin
         is_self_node:=(p.nodetype=loadn) and
         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;
       end;
 
 
 
 
@@ -456,8 +456,8 @@ implementation
               loadn:
               loadn:
                 begin
                 begin
 		  { threadvars need a helper call }
 		  { 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)
                     inc(result,5)
                   else
                   else
                     inc(result);
                     inc(result);
@@ -519,7 +519,10 @@ end.
 
 
 {
 {
   $Log$
   $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
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
       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,
        nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
        { codegen }
        { codegen }
        ncgutil,
        ncgutil,
-{$ifdef GDB}
-       gdb,
-{$endif GDB}
        { parser }
        { parser }
        scanner,
        scanner,
        pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
        pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
@@ -279,11 +276,8 @@ implementation
          case tsym(p).typ of
          case tsym(p).typ of
            typesym :
            typesym :
              pd:=ttypesym(p).restype.def;
              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
            else
              exit;
              exit;
          end;
          end;
@@ -659,7 +653,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR 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);
     procedure insert_funcret_para(pd:tabstractprocdef);
       var
       var
         storepos : tfileposinfo;
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
       begin
       begin
         if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
         if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
            not is_void(pd.rettype.def) and
            not is_void(pd.rettype.def) and
@@ -104,7 +104,7 @@ implementation
             akttokenpos:=tprocdef(pd).fileinfo;
             akttokenpos:=tprocdef(pd).fileinfo;
 
 
            { Generate result variable accessing function result }
            { 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);
            include(vs.varoptions,vo_is_funcret);
            pd.parast.insert(vs);
            pd.parast.insert(vs);
            { For left to right add it at the end to be delphi compatible }
            { For left to right add it at the end to be delphi compatible }
@@ -124,7 +124,7 @@ implementation
     procedure insert_parentfp_para(pd:tabstractprocdef);
     procedure insert_parentfp_para(pd:tabstractprocdef);
       var
       var
         storepos : tfileposinfo;
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
       begin
       begin
         if pd.parast.symtablelevel>normal_function_level then
         if pd.parast.symtablelevel>normal_function_level then
           begin
           begin
@@ -135,7 +135,7 @@ implementation
             { Generate result variable accessing function result, it
             { Generate result variable accessing function result, it
               can't be put in a register since it must be accessable
               can't be put in a register since it must be accessable
               from the framepointer }
               from the framepointer }
-            vs:=tvarsym.create('$parentfp',vs_var,voidpointertype);
+            vs:=tparavarsym.create('$parentfp',vs_var,voidpointertype);
             include(vs.varoptions,vo_is_parentfp);
             include(vs.varoptions,vo_is_parentfp);
             vs.varregable:=vr_none;
             vs.varregable:=vr_none;
             pd.parast.insert(vs);
             pd.parast.insert(vs);
@@ -149,7 +149,7 @@ implementation
     procedure insert_self_and_vmt_para(pd:tabstractprocdef);
     procedure insert_self_and_vmt_para(pd:tabstractprocdef);
       var
       var
         storepos : tfileposinfo;
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tparavarsym;
         tt       : ttype;
         tt       : ttype;
         vsp      : tvarspez;
         vsp      : tvarspez;
       begin
       begin
@@ -158,7 +158,7 @@ implementation
           begin
           begin
             { Generate self variable }
             { Generate self variable }
             tt:=voidpointertype;
             tt:=voidpointertype;
-            vs:=tvarsym.create('$self',vs_value,tt);
+            vs:=tparavarsym.create('$self',vs_value,tt);
             include(vs.varoptions,vo_is_self);
             include(vs.varoptions,vo_is_self);
             { Insert as hidden parameter }
             { Insert as hidden parameter }
             pd.parast.insert(vs);
             pd.parast.insert(vs);
@@ -179,7 +179,7 @@ implementation
                    { can't use classrefdef as type because inheriting
                    { can't use classrefdef as type because inheriting
                      will then always file because of a type mismatch }
                      will then always file because of a type mismatch }
                    tt:=voidpointertype;
                    tt:=voidpointertype;
-                   vs:=tvarsym.create('$vmt',vs_value,tt);
+                   vs:=tparavarsym.create('$vmt',vs_value,tt);
                    include(vs.varoptions,vo_is_vmt);
                    include(vs.varoptions,vo_is_vmt);
                    { Insert as hidden parameter }
                    { Insert as hidden parameter }
                    pd.parast.insert(vs);
                    pd.parast.insert(vs);
@@ -202,7 +202,7 @@ implementation
                       vsp:=vs_var;
                       vsp:=vs_var;
                     tt.setdef(tprocdef(pd)._class);
                     tt.setdef(tprocdef(pd)._class);
                   end;
                   end;
-                vs:=tvarsym.create('$self',vsp,tt);
+                vs:=tparavarsym.create('$self',vsp,tt);
                 include(vs.varoptions,vo_is_self);
                 include(vs.varoptions,vo_is_self);
                 { Insert as hidden parameter }
                 { Insert as hidden parameter }
                 pd.parast.insert(vs);
                 pd.parast.insert(vs);
@@ -217,7 +217,8 @@ implementation
     procedure insert_funcret_local(pd:tprocdef);
     procedure insert_funcret_local(pd:tprocdef);
       var
       var
         storepos : tfileposinfo;
         storepos : tfileposinfo;
-        vs       : tvarsym;
+        vs       : tlocalvarsym;
+        aliasvs  : tabsolutevarsym;
         sl       : tsymlist;
         sl       : tsymlist;
       begin
       begin
         { The result from constructors and destructors can't be accessed directly }
         { The result from constructors and destructors can't be accessed directly }
@@ -235,7 +236,7 @@ implementation
              when it is returning in a register }
              when it is returning in a register }
            if not paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
            if not paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
             begin
             begin
-              vs:=tvarsym.create('$result',vs_value,pd.rettype);
+              vs:=tlocalvarsym.create('$result',vs_value,pd.rettype);
               include(vs.varoptions,vo_is_funcret);
               include(vs.varoptions,vo_is_funcret);
               pd.localst.insert(vs);
               pd.localst.insert(vs);
               pd.funcretsym:=vs;
               pd.funcretsym:=vs;
@@ -248,19 +249,19 @@ implementation
             pd.resultname:=pd.procsym.name;
             pd.resultname:=pd.procsym.name;
            sl:=tsymlist.create;
            sl:=tsymlist.create;
            sl.addsym(sl_load,pd.funcretsym);
            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 }
            { insert result also if support is on }
            if (m_result in aktmodeswitches) then
            if (m_result in aktmodeswitches) then
             begin
             begin
               sl:=tsymlist.create;
               sl:=tsymlist.create;
               sl.addsym(sl_load,pd.funcretsym);
               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;
             end;
 
 
            akttokenpos:=storepos;
            akttokenpos:=storepos;
@@ -271,7 +272,7 @@ implementation
     procedure insert_hidden_para(pd:tabstractprocdef);
     procedure insert_hidden_para(pd:tabstractprocdef);
       var
       var
         currpara : tparaitem;
         currpara : tparaitem;
-        hvs : tvarsym;
+        hvs : tparavarsym;
       begin
       begin
         { walk from right to left, so we can insert the
         { walk from right to left, so we can insert the
           high parameters after the current parameter }
           high parameters after the current parameter }
@@ -283,9 +284,9 @@ implementation
             begin
             begin
               if assigned(currpara.parasym) then
               if assigned(currpara.parasym) then
                begin
                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);
                  include(hvs.varoptions,vo_is_high_value);
-                 tvarsym(currpara.parasym).owner.insert(hvs);
+                 tparavarsym(currpara.parasym).owner.insert(hvs);
                end
                end
               else
               else
                hvs:=nil;
                hvs:=nil;
@@ -311,9 +312,9 @@ implementation
 
 
     procedure check_c_para(p:tnamedindexitem;arg:pointer);
     procedure check_c_para(p:tnamedindexitem;arg:pointer);
       begin
       begin
-        if (tsym(p).typ<>varsym) then
+        if (tsym(p).typ<>paravarsym) then
          exit;
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
          begin
          begin
            case vartype.def.deftype of
            case vartype.def.deftype of
              arraydef :
              arraydef :
@@ -326,8 +327,8 @@ implementation
                   end;
                   end;
                  if is_array_of_const(vartype.def) and
                  if is_array_of_const(vartype.def) and
                     assigned(indexnext) 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);
                    Message(parser_e_C_array_of_const_must_be_last);
                end;
                end;
             end;
             end;
@@ -337,9 +338,9 @@ implementation
 
 
     procedure set_addr_param_regable(p:tnamedindexitem;arg:pointer);
     procedure set_addr_param_regable(p:tnamedindexitem;arg:pointer);
       begin
       begin
-        if (tsym(p).typ<>varsym) then
+        if (tsym(p).typ<>paravarsym) then
          exit;
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
          begin
          begin
            if not vartype.def.needs_inittable and
            if not vartype.def.needs_inittable and
               paramanager.push_addr_param(varspez,vartype.def,tprocdef(arg).proccalloption) then
               paramanager.push_addr_param(varspez,vartype.def,tprocdef(arg).proccalloption) then
@@ -356,7 +357,7 @@ implementation
         sc      : tsinglelist;
         sc      : tsinglelist;
         tt      : ttype;
         tt      : ttype;
         arrayelementtype : ttype;
         arrayelementtype : ttype;
-        vs      : tvarsym;
+        vs      : tparavarsym;
         srsym   : tsym;
         srsym   : tsym;
         hs1 : string;
         hs1 : string;
         varspez : Tvarspez;
         varspez : Tvarspez;
@@ -409,7 +410,7 @@ implementation
           { read identifiers and insert with error type }
           { read identifiers and insert with error type }
           sc.reset;
           sc.reset;
           repeat
           repeat
-            vs:=tvarsym.create(orgpattern,varspez,generrortype);
+            vs:=tparavarsym.create(orgpattern,varspez,generrortype);
             currparast.insert(vs);
             currparast.insert(vs);
             if assigned(vs.owner) then
             if assigned(vs.owner) then
              sc.insert(vs)
              sc.insert(vs)
@@ -493,7 +494,7 @@ implementation
                  begin
                  begin
                    if try_to_consume(_EQUAL) then
                    if try_to_consume(_EQUAL) then
                     begin
                     begin
-                      vs:=tvarsym(sc.first);
+                      vs:=tparavarsym(sc.first);
                       if assigned(vs.listnext) then
                       if assigned(vs.listnext) then
                         Message(parser_e_default_value_only_one_para);
                         Message(parser_e_default_value_only_one_para);
                       { prefix 'def' to the parameter name }
                       { prefix 'def' to the parameter name }
@@ -528,7 +529,7 @@ implementation
              (varspez<>vs_var) then
              (varspez<>vs_var) then
             CGMessage(cg_e_file_must_call_by_reference);
             CGMessage(cg_e_file_must_call_by_reference);
 
 
-          vs:=tvarsym(sc.first);
+          vs:=tparavarsym(sc.first);
           while assigned(vs) do
           while assigned(vs) do
            begin
            begin
              { update varsym }
              { update varsym }
@@ -551,7 +552,7 @@ implementation
                    if explicit_paraloc then
                    if explicit_paraloc then
                      Message(parser_e_paraloc_all_paras);
                      Message(parser_e_paraloc_all_paras);
                end;
                end;
-             vs:=tvarsym(vs.listnext);
+             vs:=tparavarsym(vs.listnext);
            end;
            end;
         until not try_to_consume(_SEMICOLON);
         until not try_to_consume(_SEMICOLON);
 
 
@@ -931,7 +932,7 @@ implementation
                         Message(parser_e_comparative_operator_return_boolean);
                         Message(parser_e_comparative_operator_return_boolean);
                      if (optoken=_ASSIGNMENT) and
                      if (optoken=_ASSIGNMENT) and
                         equal_defs(pd.rettype.def,
                         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)
                        message(parser_e_no_such_assignment)
                      else if not isoperatoracceptable(pd,optoken) then
                      else if not isoperatoracceptable(pd,optoken) then
                        Message(parser_e_overload_impossible);
                        Message(parser_e_overload_impossible);
@@ -1887,10 +1888,10 @@ const
         currpara:=tparaitem(pd.para.first);
         currpara:=tparaitem(pd.para.first);
         while assigned(currpara) do
         while assigned(currpara) do
          begin
          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);
              internalerror(200304232);
            { connect parasym to paraitem }
            { 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
            { We need a local copy for a value parameter when only the
              address is pushed. Open arrays and Array of Const are
              address is pushed. Open arrays and Array of Const are
              an exception because they are allocated at runtime and the
              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
               paramanager.push_addr_param(currpara.paratyp,currpara.paratype.def,pd.proccalloption) and
               not(is_open_array(currpara.paratype.def) or
               not(is_open_array(currpara.paratype.def) or
                   is_array_of_const(currpara.paratype.def)) then
                   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);
            currpara:=tparaitem(currpara.next);
          end;
          end;
       end;
       end;
@@ -1961,8 +1962,11 @@ const
         pdflags:=[pd_procvar];
         pdflags:=[pd_procvar];
         pd:=nil;
         pd:=nil;
         case sym.typ of
         case sym.typ of
-          varsym :
-            pd:=tabstractprocdef(tvarsym(sym).vartype.def);
+          fieldvarsym,
+          globalvarsym,
+          localvarsym,
+          paravarsym :
+            pd:=tabstractprocdef(tabstractvarsym(sym).vartype.def);
           typedconstsym :
           typedconstsym :
             pd:=tabstractprocdef(ttypedconstsym(sym).typedconsttype.def);
             pd:=tabstractprocdef(ttypedconstsym(sym).typedconsttype.def);
           typesym :
           typesym :
@@ -2132,9 +2136,9 @@ const
                       fd:=tsym(pd.parast.symindex.first);
                       fd:=tsym(pd.parast.symindex.first);
                       repeat
                       repeat
                         { skip default parameter constsyms }
                         { skip default parameter constsyms }
-                        while assigned(ad) and (ad.typ<>varsym) do
+                        while assigned(ad) and (ad.typ<>paravarsym) do
                          ad:=tsym(ad.indexnext);
                          ad:=tsym(ad.indexnext);
-                        while assigned(fd) and (fd.typ<>varsym) do
+                        while assigned(fd) and (fd.typ<>paravarsym) do
                          fd:=tsym(fd.indexnext);
                          fd:=tsym(fd.indexnext);
                         { stop when one of the two lists is at the end }
                         { stop when one of the two lists is at the end }
                         if not assigned(ad) or not assigned(fd) then
                         if not assigned(ad) or not assigned(fd) then
@@ -2259,7 +2263,10 @@ const
 end.
 end.
 {
 {
   $Log$
   $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
     * rename duplicate symbols and insert with unique name in the
       symtable
       symtable
 
 

+ 111 - 83
compiler/pdecvar.pas

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

+ 6 - 3
compiler/pexports.pas

@@ -90,8 +90,8 @@ implementation
                 hp.sym:=srsym;
                 hp.sym:=srsym;
                 InternalProcName:='';
                 InternalProcName:='';
                 case srsym.typ of
                 case srsym.typ of
-                  varsym :
-                    InternalProcName:=tvarsym(srsym).mangledname;
+                  globalvarsym :
+                    InternalProcName:=tglobalvarsym(srsym).mangledname;
                   typedconstsym :
                   typedconstsym :
                     InternalProcName:=ttypedconstsym(srsym).mangledname;
                     InternalProcName:=ttypedconstsym(srsym).mangledname;
                   procsym :
                   procsym :
@@ -182,7 +182,10 @@ end.
 
 
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 20 - 18
compiler/pexpr.pas

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

+ 9 - 6
compiler/pmodules.pas

@@ -233,13 +233,13 @@ implementation
         ltvTable : taasmoutput;
         ltvTable : taasmoutput;
       begin
       begin
         ltvTable:=taasmoutput(arg);
         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
          begin
            { address of threadvar }
            { 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 }
            { size of threadvar }
-           ltvTable.concat(tai_const.create_32bit(tvarsym(p).getsize));
+           ltvTable.concat(tai_const.create_32bit(tglobalvarsym(p).getsize));
          end;
          end;
       end;
       end;
 
 
@@ -257,7 +257,7 @@ implementation
           begin
           begin
             s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
             s:=make_mangledname('THREADVARLIST',current_module.localsymtable,'');
             { add begin and end of the list }
             { 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.insert(Tai_align.Create(const_align(32)));
             ltvTable.concat(tai_const.create_sym(nil));  { end of list marker }
             ltvTable.concat(tai_const.create_sym(nil));  { end of list marker }
             ltvTable.concat(tai_symbol_end.createname(s));
             ltvTable.concat(tai_symbol_end.createname(s));
@@ -1520,7 +1520,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * THREADVARLIST is now aligned
 
 
   Revision 1.171  2004/11/04 23:59:13  peter
   Revision 1.171  2004/11/04 23:59:13  peter

+ 20 - 19
compiler/ppu.pas

@@ -44,11 +44,7 @@ type
 {$endif Test_Double_checksum}
 {$endif Test_Double_checksum}
 
 
 const
 const
-{$ifdef ansistring_bits}
-  CurrentPPUVersion=44;
-{$else}
-  CurrentPPUVersion=44;
-{$endif}
+  CurrentPPUVersion=45;
 
 
 { buffer sizes }
 { buffer sizes }
   maxentrysize = 1024;
   maxentrysize = 1024;
@@ -86,19 +82,21 @@ const
   ibusedmacros           = 16;
   ibusedmacros           = 16;
   ibderefdata            = 17;
   ibderefdata            = 17;
   {syms}
   {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}
   {definitions}
   iborddef         = 40;
   iborddef         = 40;
   ibpointerdef     = 41;
   ibpointerdef     = 41;
@@ -1056,7 +1054,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $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
     * paraloc branch merged
 
 
   Revision 1.56.4.1  2004/09/12 14:01:23  peter
   Revision 1.56.4.1  2004/09/12 14:01:23  peter

+ 17 - 13
compiler/pstatmnt.pas

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

+ 20 - 17
compiler/psub.pas

@@ -117,9 +117,9 @@ implementation
       var
       var
         b : tblocknode;
         b : tblocknode;
       begin
       begin
-        if tsym(p).typ<>varsym then
+        if not (tsym(p).typ in [localvarsym,globalvarsym]) then
          exit;
          exit;
-        with tvarsym(p) do
+        with tabstractnormalvarsym(p) do
          begin
          begin
            if assigned(defaultconstsym) then
            if assigned(defaultconstsym) then
             begin
             begin
@@ -136,21 +136,21 @@ implementation
 
 
     procedure check_finalize_paras(p : tnamedindexitem;arg:pointer);
     procedure check_finalize_paras(p : tnamedindexitem;arg:pointer);
       begin
       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);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
 
 
     procedure check_finalize_locals(p : tnamedindexitem;arg:pointer);
     procedure check_finalize_locals(p : tnamedindexitem;arg:pointer);
       begin
       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);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
@@ -595,9 +595,9 @@ implementation
 
 
     procedure clearrefs(p : tnamedindexitem;arg:pointer);
     procedure clearrefs(p : tnamedindexitem;arg:pointer);
       begin
       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;
       end;
 
 
 
 
@@ -1088,9 +1088,9 @@ implementation
 
 
     procedure check_init_paras(p:tnamedindexitem;arg:pointer);
     procedure check_init_paras(p:tnamedindexitem;arg:pointer);
       begin
       begin
-        if tsym(p).typ<>varsym then
+        if tsym(p).typ<>paravarsym then
          exit;
          exit;
-        with tvarsym(p) do
+        with tparavarsym(p) do
           if (not is_class(vartype.def) and
           if (not is_class(vartype.def) and
              vartype.def.needs_inittable and
              vartype.def.needs_inittable and
              (varspez in [vs_value,vs_out])) then
              (varspez in [vs_value,vs_out])) then
@@ -1403,7 +1403,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
       supress the generation of warning/hints
 
 

+ 10 - 7
compiler/psystem.pas

@@ -215,12 +215,12 @@ implementation
         hrecst:=trecordsymtable.create(aktpackrecords);
         hrecst:=trecordsymtable.create(aktpackrecords);
         vmttype.setdef(trecorddef.create(hrecst));
         vmttype.setdef(trecorddef.create(hrecst));
         pvmttype.setdef(tpointerdef.create(vmttype));
         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));
         vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
         tarraydef(vmtarraytype.def).setelementtype(voidpointertype);
         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('$__vtbl_ptr_type',vmttype);
         addtype('$pvmt',pvmttype);
         addtype('$pvmt',pvmttype);
         vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
         vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
@@ -228,8 +228,8 @@ implementation
         addtype('$vtblarray',vmtarraytype);
         addtype('$vtblarray',vmtarraytype);
         { Add a type for methodpointers }
         { Add a type for methodpointers }
         hrecst:=trecordsymtable.create(1);
         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));
         methodpointertype.setdef(trecorddef.create(hrecst));
         addtype('$methodpointer',methodpointertype);
         addtype('$methodpointer',methodpointertype);
       { Add functions that require compiler magic }
       { Add functions that require compiler magic }
@@ -534,7 +534,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 15 - 12
compiler/ptconst.pas

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

+ 13 - 10
compiler/raatt.pas

@@ -1334,8 +1334,10 @@ unit raatt;
                       if assigned(sym) then
                       if assigned(sym) then
                        begin
                        begin
                          case sym.typ of
                          case sym.typ of
-                           varsym :
-                             l:=tvarsym(sym).getsize;
+                           globalvarsym,
+                           localvarsym,
+                           paravarsym :
+                             l:=tabstractvarsym(sym).getsize;
                            typedconstsym :
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
                            typesym :
@@ -1378,13 +1380,11 @@ unit raatt;
                       if assigned(sym) then
                       if assigned(sym) then
                        begin
                        begin
                          case sym.typ of
                          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 :
                            typedconstsym :
                              hs:=ttypedconstsym(sym).mangledname;
                              hs:=ttypedconstsym(sym).mangledname;
                            procsym :
                            procsym :
@@ -1500,7 +1500,10 @@ end.
 
 
 {
 {
   $Log$
   $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
     * logs truncated
 
 
   Revision 1.11  2004/06/16 20:07:09  florian
   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_CONSTANT  : (val:aint);
       OPR_SYMBOL    : (symbol:tasmsymbol;symofs:aint);
       OPR_SYMBOL    : (symbol:tasmsymbol;symofs:aint);
       OPR_REFERENCE : (ref:treference);
       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);
       OPR_REGISTER  : (reg:tregister);
 {$ifdef m68k}
 {$ifdef m68k}
       OPR_REGLIST   : (regset : tcpuregisterset);
       OPR_REGLIST   : (regset : tcpuregisterset);
@@ -772,7 +772,7 @@ end;
 
 
 Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
 Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
 
 
-  function symtable_has_varsyms(st:tsymtable):boolean;
+  function symtable_has_localvarsyms(st:tsymtable):boolean;
   var
   var
     sym : tsym;
     sym : tsym;
   begin
   begin
@@ -780,7 +780,7 @@ Function TOperand.SetupVar(const s:string;GetOffset : boolean): Boolean;
     sym:=tsym(st.symindex.first);
     sym:=tsym(st.symindex.first);
     while assigned(sym) do
     while assigned(sym) do
       begin
       begin
-        if sym.typ=varsym then
+        if sym.typ=localvarsym then
           begin
           begin
             result:=true;
             result:=true;
             exit;
             exit;
@@ -825,12 +825,12 @@ Begin
   asmsearchsym(s,sym,srsymtable);
   asmsearchsym(s,sym,srsymtable);
   if sym = nil then
   if sym = nil then
    exit;
    exit;
-  if sym.typ=absolutesym then
+  if sym.typ=absolutevarsym then
     begin
     begin
-      if (tabsolutesym(sym).abstyp=tovar) then
+      if (tabsolutevarsym(sym).abstyp=tovar) then
         begin
         begin
           { Only support simple loads }
           { Only support simple loads }
-          plist:=tabsolutesym(sym).ref.firstsym;
+          plist:=tabsolutevarsym(sym).ref.firstsym;
           if assigned(plist) and
           if assigned(plist) and
              (plist^.sltype=sl_load) then
              (plist^.sltype=sl_load) then
             sym:=plist^.sym
             sym:=plist^.sym
@@ -847,80 +847,73 @@ Begin
         end;
         end;
     end;
     end;
   case sym.typ of
   case sym.typ of
-    varsym :
+    fieldvarsym :
+      begin
+        setconst(tfieldvarsym(sym).fieldoffset);
+        hasvar:=true;
+        SetupVar:=true;
+      end;
+    globalvarsym,
+    localvarsym,
+    paravarsym :
       begin
       begin
         { we always assume in asm statements that     }
         { we always assume in asm statements that     }
         { that the variable is valid.                 }
         { 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 }
         { 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,
           globalsymtable,
           staticsymtable :
           staticsymtable :
             begin
             begin
               initref;
               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;
             end;
           parasymtable,
           parasymtable,
           localsymtable :
           localsymtable :
             begin
             begin
-              if (vo_is_external in tvarsym(sym).varoptions) then
+              if opr.typ=OPR_REFERENCE then
                 begin
                 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
                 end
               else
               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);
                 SetSize(sizeof(aint),false);
             end;
             end;
         end;
         end;
-        case tvarsym(sym).vartype.def.deftype of
+        case tabstractvarsym(sym).vartype.def.deftype of
           orddef,
           orddef,
           enumdef,
           enumdef,
           pointerdef,
           pointerdef,
           floatdef :
           floatdef :
-            SetSize(tvarsym(sym).getsize,false);
+            SetSize(tabstractvarsym(sym).getsize,false);
           arraydef :
           arraydef :
             begin
             begin
               { for arrays try to get the element size, take care of
               { for arrays try to get the element size, take care of
                 multiple indexes }
                 multiple indexes }
-              harrdef:=tarraydef(tvarsym(sym).vartype.def);
+              harrdef:=tarraydef(tabstractvarsym(sym).vartype.def);
               while assigned(harrdef.elementtype.def) and
               while assigned(harrdef.elementtype.def) and
                     (harrdef.elementtype.def.deftype=arraydef) do
                     (harrdef.elementtype.def.deftype=arraydef) do
                harrdef:=tarraydef(harrdef.elementtype.def);
                harrdef:=tarraydef(harrdef.elementtype.def);
@@ -1364,30 +1357,14 @@ Begin
      { we can start with a var,type,typedconst }
      { we can start with a var,type,typedconst }
      if assigned(sym) then
      if assigned(sym) then
        case sym.typ of
        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 :
          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 :
          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
        end
      else
      else
        s:='';
        s:='';
@@ -1412,8 +1389,8 @@ Begin
       end;
       end;
      st:=nil;
      st:=nil;
      case sym.typ of
      case sym.typ of
-       varsym :
-         with Tvarsym(sym) do
+       fieldvarsym :
+         with Tfieldvarsym(sym) do
            begin
            begin
              inc(Offset,fieldoffset);
              inc(Offset,fieldoffset);
              size:=getsize;
              size:=getsize;
@@ -1659,7 +1636,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

+ 9 - 4
compiler/scanner.pas

@@ -31,7 +31,7 @@ interface
        globtype,globals,version,tokens,
        globtype,globals,version,tokens,
        verbose,comphook,
        verbose,comphook,
        finput,
        finput,
-       widestr,cpuinfo;
+       widestr;
 
 
     const
     const
        max_include_nesting=32;
        max_include_nesting=32;
@@ -532,8 +532,10 @@ implementation
                       begin
                       begin
                         l:=0;
                         l:=0;
                         case srsym.typ of
                         case srsym.typ of
-                          varsym :
-                            l:=tvarsym(srsym).getsize;
+                          globalvarsym,
+                          localvarsym,
+                          paravarsym :
+                            l:=tabstractvarsym(srsym).getsize;
                           typedconstsym :
                           typedconstsym :
                             l:=ttypedconstsym(srsym).getsize;
                             l:=ttypedconstsym(srsym).getsize;
                           typesym:
                           typesym:
@@ -3290,7 +3292,10 @@ exit_label:
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

+ 14 - 8
compiler/symconst.pas

@@ -290,7 +290,8 @@ type
     vo_is_vmt,
     vo_is_vmt,
     vo_is_result,  { special result variable }
     vo_is_result,  { special result variable }
     vo_is_parentfp,
     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;
   tvaroptions=set of tvaroption;
 
 
@@ -317,9 +318,10 @@ type
               classrefdef,forwarddef,variantdef);
               classrefdef,forwarddef,variantdef);
 
 
   { possible types for symtable entries }
   { 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 }
   { State of the variable, if it's declared, assigned or used }
   tvarstate=(vs_none,
   tvarstate=(vs_none,
@@ -383,9 +385,10 @@ const
    pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
    pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
 
 
      SymTypeName : array[tsymtyp] of string[12] = (
      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] = (
      DefTypeName : array[tdeftype] of string[12] = (
@@ -409,7 +412,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * symlist typeconv for absolute fixed
 
 
   Revision 1.90  2004/10/24 20:01:08  peter
   Revision 1.90  2004/10/24 20:01:08  peter

+ 51 - 40
compiler/symdef.pas

@@ -179,6 +179,7 @@ interface
 
 
        terrordef = class(tstoreddef)
        terrordef = class(tstoreddef)
           constructor create;
           constructor create;
+          procedure ppuwrite(ppufile:tcompilerppufile);override;
           function  gettypename:string;override;
           function  gettypename:string;override;
           function  getmangledparaname : string;override;
           function  getmangledparaname : string;override;
           { debug }
           { debug }
@@ -1685,7 +1686,7 @@ implementation
 
 
     procedure tenumdef.calcsavesize;
     procedure tenumdef.calcsavesize;
       begin
       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
          savesize:=8
         else
         else
          if (aktpackenum=4) or (min<low(smallint)) or (max>high(word)) then
          if (aktpackenum=4) or (min<low(smallint)) or (max>high(word)) then
@@ -3067,7 +3068,7 @@ implementation
       begin
       begin
         state:=arg;
         state:=arg;
         { static variables from objects are like global objects }
         { 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
           begin
             if (sp_protected in tsym(p).symoptions) then
             if (sp_protected in tsym(p).symoptions) then
               spec:='/1'
               spec:='/1'
@@ -3075,13 +3076,13 @@ implementation
               spec:='/0'
               spec:='/0'
             else
             else
               spec:='';
               spec:='';
-            varsize:=tvarsym(p).vartype.def.size;
+            varsize:=tfieldvarsym(p).vartype.def.size;
             { open arrays made overflows !! }
             { open arrays made overflows !! }
             if varsize>$fffffff then
             if varsize>$fffffff then
               varsize:=$fffffff;
               varsize:=$fffffff;
             newrec:=stabstr_evaluate('$1:$2,$3,$4;',[p.name,
             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
             if state^.stabsize+strlen(newrec)>=state^.staballoc-256 then
               begin
               begin
                 inc(state^.staballoc,memsizeinc);
                 inc(state^.staballoc,memsizeinc);
@@ -3091,15 +3092,15 @@ implementation
             inc(state^.stabsize,strlen(newrec));
             inc(state^.stabsize,strlen(newrec));
             strdispose(newrec);
             strdispose(newrec);
             {This should be used for case !!}
             {This should be used for case !!}
-            inc(state^.recoffset,Tvarsym(p).vartype.def.size);
+            inc(state^.recoffset,Tfieldvarsym(p).vartype.def.size);
           end;
           end;
       end;
       end;
 
 
 
 
     procedure tabstractrecorddef.field_concatstabto(p:Tnamedindexitem;arg:pointer);
     procedure tabstractrecorddef.field_concatstabto(p:Tnamedindexitem;arg:pointer);
       begin
       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;
       end;
 
 
 
 
@@ -3109,8 +3110,8 @@ implementation
     procedure tabstractrecorddef.count_field_rtti(sym : tnamedindexitem;arg:pointer);
     procedure tabstractrecorddef.count_field_rtti(sym : tnamedindexitem;arg:pointer);
       begin
       begin
          if (FRTTIType=fullrtti) or
          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);
            inc(Count);
       end;
       end;
 
 
@@ -3118,20 +3119,20 @@ implementation
     procedure tabstractrecorddef.generate_field_rtti(sym:tnamedindexitem;arg:pointer);
     procedure tabstractrecorddef.generate_field_rtti(sym:tnamedindexitem;arg:pointer);
       begin
       begin
          if (FRTTIType=fullrtti) or
          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;
       end;
 
 
 
 
     procedure tabstractrecorddef.write_field_rtti(sym : tnamedindexitem;arg:pointer);
     procedure tabstractrecorddef.write_field_rtti(sym : tnamedindexitem;arg:pointer);
       begin
       begin
          if (FRTTIType=fullrtti) or
          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
           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;
       end;
       end;
 
 
@@ -3369,7 +3370,7 @@ implementation
         hp : TParaItem;
         hp : TParaItem;
       begin
       begin
         hp:=TParaItem.Create;
         hp:=TParaItem.Create;
-        hp.paratyp:=tvarsym(sym).varspez;
+        hp.paratyp:=tparavarsym(sym).varspez;
         hp.parasym:=sym;
         hp.parasym:=sym;
         hp.paratype:=tt;
         hp.paratype:=tt;
         hp.is_hidden:=vhidden;
         hp.is_hidden:=vhidden;
@@ -3395,7 +3396,7 @@ implementation
         hp : TParaItem;
         hp : TParaItem;
       begin
       begin
         hp:=TParaItem.Create;
         hp:=TParaItem.Create;
-        hp.paratyp:=tvarsym(sym).varspez;
+        hp.paratyp:=tparavarsym(sym).varspez;
         hp.parasym:=sym;
         hp.parasym:=sym;
         hp.paratype:=tt;
         hp.paratype:=tt;
         hp.is_hidden:=vhidden;
         hp.is_hidden:=vhidden;
@@ -3480,9 +3481,9 @@ implementation
           begin
           begin
             hp.paratype.resolve;
             hp.paratype.resolve;
             hp.defaultvalue:=tsym(hp.defaultvaluederef.resolve);
             hp.defaultvalue:=tsym(hp.defaultvaluederef.resolve);
-            hp.parasym:=tvarsym(hp.parasymderef.resolve);
+            hp.parasym:=tparavarsym(hp.parasymderef.resolve);
             { connect parasym to paraitem }
             { connect parasym to paraitem }
-            tvarsym(hp.parasym).paraitem:=hp;
+            tparavarsym(hp.parasym).paraitem:=hp;
             { Don't count hidden parameters }
             { Don't count hidden parameters }
             if (not hp.is_hidden) then
             if (not hp.is_hidden) then
              begin
              begin
@@ -5435,7 +5436,7 @@ implementation
     procedure tobjectdef.count_published_properties(sym:tnamedindexitem;arg:pointer);
     procedure tobjectdef.count_published_properties(sym:tnamedindexitem;arg:pointer);
       begin
       begin
          if needs_prop_entry(tsym(sym)) and
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ<>varsym) then
+            (tsym(sym).typ<>fieldvarsym) then
            inc(count);
            inc(count);
       end;
       end;
 
 
@@ -5457,7 +5458,7 @@ implementation
                 rttiList.concat(Tai_const.create(ait_const_ptr,1));
                 rttiList.concat(Tai_const.create(ait_const_ptr,1));
                 typvalue:=3;
                 typvalue:=3;
              end
              end
-           else if proc.firstsym^.sym.typ=varsym then
+           else if proc.firstsym^.sym.typ=fieldvarsym then
              begin
              begin
                 address:=0;
                 address:=0;
                 hp:=proc.firstsym;
                 hp:=proc.firstsym;
@@ -5467,15 +5468,15 @@ implementation
                      case hp^.sltype of
                      case hp^.sltype of
                        sl_load :
                        sl_load :
                          begin
                          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;
                          end;
                        sl_subscript :
                        sl_subscript :
                          begin
                          begin
                            if not(assigned(def) and (def.deftype=recorddef)) then
                            if not(assigned(def) and (def.deftype=recorddef)) then
                              internalerror(200402171);
                              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;
                          end;
                        sl_vec :
                        sl_vec :
                          begin
                          begin
@@ -5514,7 +5515,7 @@ implementation
       begin
       begin
          if needs_prop_entry(tsym(sym)) then
          if needs_prop_entry(tsym(sym)) then
            case tsym(sym).typ of
            case tsym(sym).typ of
-              varsym:
+              fieldvarsym:
                 begin
                 begin
 {$ifdef dummy}
 {$ifdef dummy}
                    if not(tvarsym(sym).vartype.def.deftype=objectdef) or
                    if not(tvarsym(sym).vartype.def.deftype=objectdef) or
@@ -5578,8 +5579,8 @@ implementation
             case tsym(sym).typ of
             case tsym(sym).typ of
               propertysym:
               propertysym:
                 tstoreddef(tpropertysym(sym).proptype.def).get_rtti_label(fullrtti);
                 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
               else
                 internalerror(1509991);
                 internalerror(1509991);
             end;
             end;
@@ -5635,15 +5636,15 @@ implementation
          hp : tclasslistitem;
          hp : tclasslistitem;
       begin
       begin
          if needs_prop_entry(tsym(sym)) and
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ=varsym) then
+          (tsym(sym).typ=fieldvarsym) then
           begin
           begin
-             if tvarsym(sym).vartype.def.deftype<>objectdef then
+             if tfieldvarsym(sym).vartype.def.deftype<>objectdef then
                internalerror(0206001);
                internalerror(0206001);
-             hp:=searchclasstablelist(tobjectdef(tvarsym(sym).vartype.def));
+             hp:=searchclasstablelist(tobjectdef(tfieldvarsym(sym).vartype.def));
              if not(assigned(hp)) then
              if not(assigned(hp)) then
                begin
                begin
                   hp:=tclasslistitem.create;
                   hp:=tclasslistitem.create;
-                  hp.p:=tobjectdef(tvarsym(sym).vartype.def);
+                  hp.p:=tobjectdef(tfieldvarsym(sym).vartype.def);
                   hp.index:=tablecount;
                   hp.index:=tablecount;
                   classtablelist.concat(hp);
                   classtablelist.concat(hp);
                   inc(tablecount);
                   inc(tablecount);
@@ -5658,15 +5659,15 @@ implementation
          hp : tclasslistitem;
          hp : tclasslistitem;
       begin
       begin
          if needs_prop_entry(tsym(sym)) and
          if needs_prop_entry(tsym(sym)) and
-          (tsym(sym).typ=varsym) then
+          (tsym(sym).typ=fieldvarsym) then
           begin
           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
              if not(assigned(hp)) then
                internalerror(0206002);
                internalerror(0206002);
              rttiList.concat(Tai_const.Create_16bit(hp.index));
              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;
       end;
       end;
 
 
@@ -6146,6 +6147,13 @@ implementation
      end;
      end;
 
 
 
 
+    procedure terrordef.ppuwrite(ppufile:tcompilerppufile);
+      begin
+        { Can't write errordefs to ppu }
+        internalerror(200411063);
+      end;
+
+
 {$ifdef GDB}
 {$ifdef GDB}
     function terrordef.stabstring : pchar;
     function terrordef.stabstring : pchar;
       begin
       begin
@@ -6236,7 +6244,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     + additional extdebug check for wrong add_reg_instructions added
     * too long manglednames are cut off at 200 chars using a crc
     * 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 ppuwrite(ppufile:tcompilerppufile);override;
           procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
           procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
           procedure write_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;
           procedure addalignmentpadding;
        end;
        end;
 
 
@@ -203,7 +203,7 @@ interface
     function  searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym;
     function  searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym;
     function  searchsym_in_class_by_msgstr(classh:tobjectdef;const s:string):tsym;
     function  searchsym_in_class_by_msgstr(classh:tobjectdef;const s:string):tsym;
     function  searchsystype(const s: stringid; var srsym: ttypesym): boolean;
     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_class_member(pd : tobjectdef;const s : string):tsym;
     function  search_assignment_operator(from_def,to_def:Tdef):Tprocdef;
     function  search_assignment_operator(from_def,to_def:Tdef):Tprocdef;
 
 
@@ -360,8 +360,11 @@ implementation
                 ibtypesym : sym:=ttypesym.ppuload(ppufile);
                 ibtypesym : sym:=ttypesym.ppuload(ppufile);
                 ibprocsym : sym:=tprocsym.ppuload(ppufile);
                 ibprocsym : sym:=tprocsym.ppuload(ppufile);
                ibconstsym : sym:=tconstsym.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);
                 ibenumsym : sym:=tenumsym.ppuload(ppufile);
           ibtypedconstsym : sym:=ttypedconstsym.ppuload(ppufile);
           ibtypedconstsym : sym:=ttypedconstsym.ppuload(ppufile);
             ibpropertysym : sym:=tpropertysym.ppuload(ppufile);
             ibpropertysym : sym:=tpropertysym.ppuload(ppufile);
@@ -403,18 +406,18 @@ implementation
 
 
     procedure tstoredsymtable.writesyms(ppufile:tcompilerppufile);
     procedure tstoredsymtable.writesyms(ppufile:tcompilerppufile);
       var
       var
-        pd : Tsym;
+        pd : Tstoredsym;
       begin
       begin
          { each definition get a number, write then the amount of syms and the
          { each definition get a number, write then the amount of syms and the
            datasize to the ibsymdef entry }
            datasize to the ibsymdef entry }
          ppufile.putlongint(symindex.count);
          ppufile.putlongint(symindex.count);
          ppufile.writeentry(ibstartsyms);
          ppufile.writeentry(ibstartsyms);
          { foreach is used to write all symbols }
          { foreach is used to write all symbols }
-         pd:=Tsym(symindex.first);
+         pd:=Tstoredsym(symindex.first);
          while assigned(pd) do
          while assigned(pd) do
            begin
            begin
               pd.ppuwrite(ppufile);
               pd.ppuwrite(ppufile);
-              pd:=Tsym(pd.indexnext);
+              pd:=Tstoredsym(pd.indexnext);
            end;
            end;
          { end of symbols }
          { end of symbols }
          ppufile.writeentry(ibendsyms);
          ppufile.writeentry(ibendsyms);
@@ -600,10 +603,10 @@ implementation
               the user. (Under delphi it can still be accessed using result),
               the user. (Under delphi it can still be accessed using result),
               but don't allow hiding of RESULT }
               but don't allow hiding of RESULT }
             if (m_duplicate_names in aktmodeswitches) and
             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
                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
              sym.name:='hidden'+sym.name
             else
             else
              DuplicateSym(sym,hsym);
              DuplicateSym(sym,hsym);
@@ -714,7 +717,7 @@ implementation
 
 
     procedure TStoredSymtable.varsymbolused(p : TNamedIndexItem;arg:pointer);
     procedure TStoredSymtable.varsymbolused(p : TNamedIndexItem;arg:pointer);
       begin
       begin
-         if (tsym(p).typ=varsym) and
+         if (tsym(p).typ in [globalvarsym,localvarsym,paravarsym,fieldvarsym]) and
             ((tsym(p).owner.symtabletype in
             ((tsym(p).owner.symtabletype in
              [parasymtable,localsymtable,objectsymtable,staticsymtable])) then
              [parasymtable,localsymtable,objectsymtable,staticsymtable])) then
           begin
           begin
@@ -724,12 +727,11 @@ implementation
            { also don't count the value parameters which have local copies }
            { also don't count the value parameters which have local copies }
            { also don't claim for high param of open parameters (PM) }
            { also don't claim for high param of open parameters (PM) }
            if (Errorcount<>0) or
            if (Errorcount<>0) or
-              (assigned(tvarsym(p).paraitem) and
-               tvarsym(p).paraitem.is_hidden) then
+              (vo_is_hidden in tabstractvarsym(p).varoptions) then
              exit;
              exit;
-           if (tvarsym(p).refs=0) then
+           if (tstoredsym(p).refs=0) then
              begin
              begin
-                if (vo_is_funcret in tvarsym(p).varoptions) then
+                if (vo_is_funcret in tabstractvarsym(p).varoptions) then
                   begin
                   begin
                     { don't warn about the result of constructors }
                     { don't warn about the result of constructors }
                     if (tsym(p).owner.symtabletype<>localsymtable) or
                     if (tsym(p).owner.symtabletype<>localsymtable) or
@@ -743,18 +745,18 @@ implementation
                 else
                 else
                   MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_not_used,tsym(p).realname);
                   MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_not_used,tsym(p).realname);
              end
              end
-           else if tvarsym(p).varstate=vs_assigned then
+           else if tabstractvarsym(p).varstate=vs_assigned then
              begin
              begin
                 if (tsym(p).owner.symtabletype=parasymtable) then
                 if (tsym(p).owner.symtabletype=parasymtable) then
                   begin
                   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)
                       MessagePos1(tsym(p).fileinfo,sym_h_para_identifier_only_set,tsym(p).realname)
                   end
                   end
                 else if (tsym(p).owner.symtabletype=objectsymtable) then
                 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)
                   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);
                   MessagePos1(tsym(p).fileinfo,sym_n_local_identifier_only_set,tsym(p).realname);
              end;
              end;
          end
          end
@@ -897,10 +899,13 @@ implementation
          if b_needs_init_final then
          if b_needs_init_final then
           exit;
           exit;
          case tsym(p).typ of
          case tsym(p).typ of
-           varsym :
+           fieldvarsym,
+           globalvarsym,
+           localvarsym,
+           paravarsym :
              begin
              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;
                  b_needs_init_final:=true;
              end;
              end;
            typedconstsym :
            typedconstsym :
@@ -998,7 +1003,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tabstractrecordsymtable.insertfield(sym : tvarsym;addsym:boolean);
+    procedure tabstractrecordsymtable.insertfield(sym : tfieldvarsym;addsym:boolean);
       var
       var
         l      : aint;
         l      : aint;
         varalignrecord,
         varalignrecord,
@@ -1009,10 +1014,10 @@ implementation
         if addsym then
         if addsym then
           insert(sym);
           insert(sym);
         { this symbol can't be loaded to a register }
         { this symbol can't be loaded to a register }
-        tvarsym(sym).varregable:=vr_none;
+        sym.varregable:=vr_none;
         { Calculate field offset }
         { Calculate field offset }
-        l:=tvarsym(sym).getsize;
-        vardef:=tvarsym(sym).vartype.def;
+        l:=sym.getsize;
+        vardef:=sym.vartype.def;
         varalign:=vardef.alignment;
         varalign:=vardef.alignment;
         { Calc the alignment size for C style records }
         { Calc the alignment size for C style records }
         if (usefieldalignment=-1) then
         if (usefieldalignment=-1) then
@@ -1044,14 +1049,14 @@ implementation
         if varalign=0 then
         if varalign=0 then
           varalign:=size_2_align(l);
           varalign:=size_2_align(l);
         varalignfield:=used_align(varalign,aktalignment.recordalignmin,fieldalignment);
         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
           begin
             Message(sym_e_segment_too_large);
             Message(sym_e_segment_too_large);
             datasize:=high(aint);
             datasize:=high(aint);
           end
           end
         else
         else
-          datasize:=tvarsym(sym).fieldoffset+l;
+          datasize:=sym.fieldoffset+l;
         { Calc alignment needed for this record }
         { Calc alignment needed for this record }
         if (usefieldalignment=-1) then
         if (usefieldalignment=-1) then
           varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
           varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
@@ -1100,7 +1105,7 @@ implementation
       the complete size (see code in pdecl unit) PM }
       the complete size (see code in pdecl unit) PM }
     procedure trecordsymtable.insertunionst(unionst : trecordsymtable;offset : longint);
     procedure trecordsymtable.insertunionst(unionst : trecordsymtable;offset : longint);
       var
       var
-        ps,nps : tvarsym;
+        ps,nps : tfieldvarsym;
         pd,npd : tdef;
         pd,npd : tdef;
         varalignrecord,varalign,
         varalignrecord,varalign,
         storesize,storealign : longint;
         storesize,storealign : longint;
@@ -1108,10 +1113,10 @@ implementation
         storesize:=datasize;
         storesize:=datasize;
         storealign:=fieldalignment;
         storealign:=fieldalignment;
         datasize:=offset;
         datasize:=offset;
-        ps:=tvarsym(unionst.symindex.first);
+        ps:=tfieldvarsym(unionst.symindex.first);
         while assigned(ps) do
         while assigned(ps) do
           begin
           begin
-            nps:=tvarsym(ps.indexnext);
+            nps:=tfieldvarsym(ps.indexnext);
             { remove from current symtable }
             { remove from current symtable }
             unionst.symindex.deleteindex(ps);
             unionst.symindex.deleteindex(ps);
             ps.left:=nil;
             ps.left:=nil;
@@ -1165,7 +1170,7 @@ implementation
          hsym : tsym;
          hsym : tsym;
       begin
       begin
          { check for duplicate field id in inherited classes }
          { check for duplicate field id in inherited classes }
-         if (sym.typ=varsym) and
+         if (sym.typ=fieldvarsym) and
             assigned(defowner) and
             assigned(defowner) and
             (
             (
              not(m_delphi in aktmodeswitches) or
              not(m_delphi in aktmodeswitches) or
@@ -1225,10 +1230,10 @@ implementation
             { a local and the function can have the same
             { a local and the function can have the same
               name in TP and Delphi, but RESULT not }
               name in TP and Delphi, but RESULT not }
             if (m_duplicate_names in aktmodeswitches) and
             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
                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)
               hsym.owner.rename(hsym.name,'hidden'+hsym.name)
             else
             else
               DuplicateSym(sym,hsym);
               DuplicateSym(sym,hsym);
@@ -1244,10 +1249,10 @@ implementation
                 { a local and the function can have the same
                 { a local and the function can have the same
                   name in TP and Delphi, but RESULT not }
                   name in TP and Delphi, but RESULT not }
                 if (m_duplicate_names in aktmodeswitches) and
                 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
                    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
                   sym.name:='hidden'+sym.name
                 else
                 else
                   DuplicateSym(sym,hsym);
                   DuplicateSym(sym,hsym);
@@ -2031,18 +2036,18 @@ implementation
       end;
       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
       begin
         if not(cs_compilesystem in aktmoduleswitches) then
         if not(cs_compilesystem in aktmoduleswitches) then
           begin
           begin
-            srsym := tvarsym(searchsymonlyin(systemunit,s));
+            srsym := searchsymonlyin(systemunit,s);
             symowner := systemunit;
             symowner := systemunit;
           end
           end
         else
         else
           searchsym(s,tsym(srsym),symowner);
           searchsym(s,tsym(srsym),symowner);
         searchsysvar :=
         searchsysvar :=
           assigned(srsym) and
           assigned(srsym) and
-          (srsym.typ = varsym);
+          (srsym.typ = globalvarsym);
       end;
       end;
 
 
 
 
@@ -2298,7 +2303,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * rename duplicate symbols and insert with unique name in the
       symtable
       symtable
 
 

+ 17 - 45
compiler/symtype.pas

@@ -79,7 +79,7 @@ interface
          function  typename:string;
          function  typename:string;
          function  gettypename:string;virtual;
          function  gettypename:string;virtual;
          function  mangledparaname:string;
          function  mangledparaname:string;
-         function  getmangledparaname:string;virtual;abstract;
+         function  getmangledparaname:string;virtual;
          function  size:aint;virtual;abstract;
          function  size:aint;virtual;abstract;
          function  alignment:longint;virtual;abstract;
          function  alignment:longint;virtual;abstract;
          function  getparentdef:tdef;virtual;
          function  getparentdef:tdef;virtual;
@@ -111,10 +111,7 @@ interface
          function  stabstring : pchar;virtual;
          function  stabstring : pchar;virtual;
 {$endif GDB}
 {$endif GDB}
          constructor create(const n : string);
          constructor create(const n : string);
-         constructor loadsym(ppufile:tcompilerppufile);
          destructor destroy;override;
          destructor destroy;override;
-         procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
-         procedure writesym(ppufile:tcompilerppufile);
          function  realname:string;
          function  realname:string;
          procedure buildderef;virtual;
          procedure buildderef;virtual;
 {         procedure buildderefimpl;virtual;abstract;}
 {         procedure buildderefimpl;virtual;abstract;}
@@ -276,6 +273,12 @@ implementation
       end;
       end;
 
 
 
 
+    function tdef.getmangledparaname:string;
+      begin
+         result:='<unknown type>';
+      end;
+
+
     function tdef.getparentdef:tdef;
     function tdef.getparentdef:tdef;
       begin
       begin
         result:=nil;
         result:=nil;
@@ -318,32 +321,6 @@ implementation
          symoptions:=current_object_option;
          symoptions:=current_object_option;
       end;
       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;
     destructor tsym.destroy;
       begin
       begin
@@ -357,23 +334,15 @@ implementation
         inherited destroy;
         inherited destroy;
       end;
       end;
 
 
-    procedure Tsym.writesym(ppufile:tcompilerppufile);
-      begin
-         ppufile.putword(indexnr);
-         ppufile.putstring(_realname^);
-         ppufile.putposinfo(fileinfo);
-         ppufile.putsmallset(symoptions);
-      end;
 
 
     procedure Tsym.buildderef;
     procedure Tsym.buildderef;
+      begin
+      end;
 
 
-    begin
-    end;
 
 
     procedure Tsym.deref;
     procedure Tsym.deref;
-
-    begin
-    end;
+      begin
+      end;
 
 
 {$ifdef GDB}
 {$ifdef GDB}
     function Tsym.get_var_value(const s:string):string;
     function Tsym.get_var_value(const s:string):string;
@@ -1048,8 +1017,8 @@ implementation
         data   : array[0..255] of byte;
         data   : array[0..255] of byte;
       begin
       begin
         result:=nil;
         result:=nil;
-        { not initialized }
-        if dataidx=-1 then
+        { not initialized or error }
+        if dataidx<0 then
           internalerror(200306067);
           internalerror(200306067);
         { read data }
         { read data }
         current_module.derefdata.seek(dataidx);
         current_module.derefdata.seek(dataidx);
@@ -1487,7 +1456,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $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
     * support > 32bit accesses for x86_64
     * rewrote array size checking to support 64bit
     * rewrote array size checking to support 64bit
 
 

+ 10 - 7
compiler/symutil.pas

@@ -47,8 +47,8 @@ implementation
 
 
     function is_funcret_sym(p:tsymentry):boolean;
     function is_funcret_sym(p:tsymentry):boolean;
       begin
       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;
       end;
 
 
 
 
@@ -56,7 +56,7 @@ implementation
 
 
       begin
       begin
          needs_prop_entry:=(sp_published in tsym(sym).symoptions) and
          needs_prop_entry:=(sp_published in tsym(sym).symoptions) and
-         (sym.typ in [propertysym,varsym]);
+         (sym.typ in [propertysym,fieldvarsym]);
       end;
       end;
 
 
 
 
@@ -103,10 +103,10 @@ implementation
     procedure count_locals(p:tnamedindexitem;arg:pointer);
     procedure count_locals(p:tnamedindexitem;arg:pointer);
       begin
       begin
         { Count only varsyms, but ignore the funcretsym }
         { 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
            (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)^);
           inc(plongint(arg)^);
       end;
       end;
 
 
@@ -114,7 +114,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

+ 5 - 2
compiler/systems.pas

@@ -239,7 +239,7 @@ interface
           shortname    : string[9];
           shortname    : string[9];
           flags        : set of tsystemflags;
           flags        : set of tsystemflags;
           cpu          : tsystemcpu;
           cpu          : tsystemcpu;
-          unit_env     : string[12];
+          unit_env     : string[16];
           extradefines : string[40];
           extradefines : string[40];
           sourceext,
           sourceext,
           pasext,
           pasext,
@@ -715,7 +715,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $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
     * default target for x86_64 is linux
 
 
   Revision 1.94  2004/10/31 19:09:54  peter
   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)
     timportlibbeos=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -87,7 +87,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlibbeos.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibbeos.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -501,7 +501,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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 DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 8 - 5
compiler/systems/t_bsd.pas

@@ -50,7 +50,7 @@ implementation
     timportlibdarwin=class(timportlib)
     timportlibdarwin=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
       procedure generatesmartlib;override;
       procedure generatesmartlib;override;
     end;
     end;
@@ -58,7 +58,7 @@ implementation
     timportlibbsd=class(timportlib)
     timportlibbsd=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -109,7 +109,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
+    procedure timportlibdarwin.importvariable(vs:tglobalvarsym;const name,module:string);
       begin
       begin
         { insert sharedlibrary }
         { insert sharedlibrary }
 {        current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
 {        current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
@@ -152,7 +152,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlibbsd.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibbsd.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -627,7 +627,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 6 - 3
compiler/systems/t_linux.pas

@@ -35,7 +35,7 @@ interface
     timportliblinux=class(timportlib)
     timportliblinux=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -92,7 +92,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportliblinux.importvariable(vs:tvarsym;const name,module:string);
+procedure timportliblinux.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -592,7 +592,10 @@ end.
 
 
 {
 {
   $Log$
   $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
     * fixed dyn. linker handling
 
 
   Revision 1.27  2004/11/05 11:04:23  florian
   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)
     timportlibnetwlibc=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -160,7 +160,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlibnetwlibc.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibnetwlibc.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -653,7 +653,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 6 - 3
compiler/systems/t_nwm.pas

@@ -105,7 +105,7 @@ implementation
     timportlibnetware=class(timportlib)
     timportlibnetware=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -152,7 +152,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlibnetware.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibnetware.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -571,7 +571,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 6 - 3
compiler/systems/t_sunos.pas

@@ -45,7 +45,7 @@ implementation
     timportlibsunos=class(timportlib)
     timportlibsunos=class(timportlib)
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
     end;
     end;
 
 
@@ -98,7 +98,7 @@ begin
 end;
 end;
 
 
 
 
-procedure timportlibsunos.importvariable(vs:tvarsym;const name,module:string);
+procedure timportlibsunos.importvariable(vs:tglobalvarsym;const name,module:string);
 begin
 begin
   { insert sharedlibrary }
   { insert sharedlibrary }
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@@ -498,7 +498,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed sparc <-> i386 mixture
 
 
   Revision 1.12  2004/10/14 18:16:17  mazen
   Revision 1.12  2004/10/14 18:16:17  mazen

+ 10 - 7
compiler/systems/t_win32.pas

@@ -57,7 +57,7 @@ interface
     public
     public
       procedure preparelib(const s:string);override;
       procedure preparelib(const s:string);override;
       procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name: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 generatelib;override;
       procedure generatenasmlib;virtual;
       procedure generatenasmlib;virtual;
       procedure generatesmartlib;override;
       procedure generatesmartlib;override;
@@ -169,7 +169,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure timportlibwin32.importvariable(vs:tvarsym;const name,module:string);
+    procedure timportlibwin32.importvariable(vs:tglobalvarsym;const name,module:string);
       begin
       begin
         importvariable_str(vs.mangledname,name,module);
         importvariable_str(vs.mangledname,name,module);
       end;
       end;
@@ -787,8 +787,8 @@ implementation
                    inc(current_index);
                    inc(current_index);
                 end;
                 end;
               case hp.sym.typ of
               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 :
                 typedconstsym :
                   address_table.concat(Tai_const.Createname_rva(ttypedconstsym(hp.sym).mangledname));
                   address_table.concat(Tai_const.Createname_rva(ttypedconstsym(hp.sym).mangledname));
                 procsym :
                 procsym :
@@ -820,8 +820,8 @@ implementation
          while assigned(hp) do
          while assigned(hp) do
            begin
            begin
              case hp.sym.typ of
              case hp.sym.typ of
-               varsym :
-                 s:=tvarsym(hp.sym).mangledname;
+               globalvarsym :
+                 s:=tglobalvarsym(hp.sym).mangledname;
                typedconstsym :
                typedconstsym :
                  s:=ttypedconstsym(hp.sym).mangledname;
                  s:=ttypedconstsym(hp.sym).mangledname;
                procsym :
                procsym :
@@ -1612,7 +1612,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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
   linking with cygwin fixed
 
 
   Revision 1.40  2004/10/25 15:38:41  peter
   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;
   tprocinfoflags=set of tprocinfoflag;
 
 
   { Copied from systems.pas }
   { 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
 var
   ppufile     : tppufile;
   ppufile     : tppufile;
@@ -89,6 +93,12 @@ Begin
    has_errors:=true;
    has_errors:=true;
 End;
 End;
 
 
+
+function ToStr(w:longint):String;
+begin
+  Str(w,ToStr);
+end;
+
 Function Target2Str(w:longint):string;
 Function Target2Str(w:longint):string;
 type
 type
        { taken from systems.pas }
        { taken from systems.pas }
@@ -123,13 +133,13 @@ type
              system_x86_64_linux,       { 26 }
              system_x86_64_linux,       { 26 }
              system_powerpc_macosx,     { 27 }
              system_powerpc_macosx,     { 27 }
              target_i386_emx,           { 28 }
              target_i386_emx,           { 28 }
-	     target_powerpc_netbsd,     { 29 }
+             target_powerpc_netbsd,     { 29 }
              target_powerpc_openbsd,    { 30 }
              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
 const
   Targets : array[ttarget] of string[17]=(
   Targets : array[ttarget] of string[17]=(
@@ -174,19 +184,19 @@ begin
   if w<=ord(high(ttarget)) then
   if w<=ord(high(ttarget)) then
     Target2Str:=Targets[ttarget(w)]
     Target2Str:=Targets[ttarget(w)]
   else
   else
-    Target2Str:='<Unknown>';
+    Target2Str:='<!! Unknown target value '+tostr(w)+'>';
 end;
 end;
 
 
 
 
 Function Cpu2Str(w:longint):string;
 Function Cpu2Str(w:longint):string;
 const
 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
 begin
-  if w<=ord(high(ttargetcpu)) then
-    Cpu2Str:=CpuTxt[ttargetcpu(w)]
+  if w<=ord(high(tsystemcpu)) then
+    Cpu2Str:=CpuTxt[tsystemcpu(w)]
   else
   else
-    Cpu2Str:='<Unknown>';
+    Cpu2Str:='<!! Unknown cpu value '+tostr(w)+'>';
 end;
 end;
 
 
 
 
@@ -197,7 +207,17 @@ begin
   if w<=ord(high(varspezstr)) then
   if w<=ord(high(varspezstr)) then
     Varspez2Str:=varspezstr[w]
     Varspez2Str:=varspezstr[w]
   else
   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;
 end;
 
 
 
 
@@ -636,9 +656,13 @@ type
     sp_private,
     sp_private,
     sp_published,
     sp_published,
     sp_protected,
     sp_protected,
-    sp_forwarddef,
     sp_static,
     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;
   tsymoptions=set of tsymoption;
   tsymopt=record
   tsymopt=record
@@ -646,15 +670,19 @@ type
     str  : string[30];
     str  : string[30];
   end;
   end;
 const
 const
-  symopts=7;
+  symopts=11;
   symopt : array[1..symopts] of tsymopt=(
   symopt : array[1..symopts] of tsymopt=(
      (mask:sp_public;         str:'Public'),
      (mask:sp_public;         str:'Public'),
      (mask:sp_private;        str:'Private'),
      (mask:sp_private;        str:'Private'),
      (mask:sp_published;      str:'Published'),
      (mask:sp_published;      str:'Published'),
      (mask:sp_protected;      str:'Protected'),
      (mask:sp_protected;      str:'Protected'),
-     (mask:sp_forwarddef;     str:'ForwardDef'),
      (mask:sp_static;         str:'Static'),
      (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
 var
   symoptions : tsymoptions;
   symoptions : tsymoptions;
@@ -679,6 +707,50 @@ begin
 end;
 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 }
 { Read abstract procdef and return if inline procdef }
 type
 type
   tproccalloption=(pocall_none,
   tproccalloption=(pocall_none,
@@ -884,46 +956,81 @@ begin
 end;
 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
 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
 var
-  defopts : tdefoptions;
+  i : longint;
+  first : boolean;
 begin
 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
    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;
 end;
 end;
 
 
@@ -960,21 +1067,6 @@ end;
 
 
 procedure readsymbols(const s:string);
 procedure readsymbols(const s:string);
 type
 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;
   pguid = ^tguid;
   tguid = packed record
   tguid = packed record
     D1: LongWord;
     D1: LongWord;
@@ -996,7 +1088,7 @@ var
   symcnt,
   symcnt,
   i,j,len : longint;
   i,j,len : longint;
   guid : tguid;
   guid : tguid;
-
+  varoptions : tvaroptions;
 begin
 begin
   symcnt:=1;
   symcnt:=1;
   with ppufile do
   with ppufile do
@@ -1030,7 +1122,7 @@ begin
          ibtypesym :
          ibtypesym :
            begin
            begin
              readcommonsym('Type symbol ');
              readcommonsym('Type symbol ');
-             write(space,' Result Type: ');
+             write(space,'  Result Type : ');
              readtype;
              readtype;
            end;
            end;
 
 
@@ -1040,7 +1132,7 @@ begin
              len:=ppufile.getword;
              len:=ppufile.getword;
              for i:=1 to len do
              for i:=1 to len do
               begin
               begin
-                write(space,'  Definition: ');
+                write(space,'   Definition : ');
                 readderef;
                 readderef;
               end;
               end;
            end;
            end;
@@ -1052,15 +1144,15 @@ begin
              case tconsttyp(b) of
              case tconsttyp(b) of
                constord :
                constord :
                  begin
                  begin
-                   write  (space,' OrdinalType: ');
+                   write  (space,'  OrdinalType : ');
                    readtype;
                    readtype;
-                   writeln(space,'       Value: ',getint64);
+                   writeln(space,'        Value : ',getint64);
                  end;
                  end;
                constpointer :
                constpointer :
                  begin
                  begin
-                   write  (space,' PointerType: ');
+                   write  (space,'  PointerType : ');
                    readtype;
                    readtype;
-                   writeln(space,'       Value: ',getlongint)
+                   writeln(space,'        Value : ',getlongint)
                  end;
                  end;
                conststring,
                conststring,
                constresourcestring :
                constresourcestring :
@@ -1069,21 +1161,21 @@ begin
                    getmem(pc,len+1);
                    getmem(pc,len+1);
                    getdata(pc^,len);
                    getdata(pc^,len);
                    (pc+len)^:= #0;
                    (pc+len)^:= #0;
-                   writeln(space,'      Length: ',len);
-                   writeln(space,'       Value: "',pc,'"');
+                   writeln(space,'       Length : ',len);
+                   writeln(space,'        Value : "',pc,'"');
                    freemem(pc,len+1);
                    freemem(pc,len+1);
                    if tconsttyp(b)=constresourcestring then
                    if tconsttyp(b)=constresourcestring then
-                    writeln(space,'       Index: ',getlongint);
+                    writeln(space,'        Index : ',getlongint);
                  end;
                  end;
                constreal :
                constreal :
-                 writeln(space,'       Value: ',getreal);
+                 writeln(space,'        Value : ',getreal);
                constset :
                constset :
                  begin
                  begin
-                   write (space,'     Set Type: ');
+                   write (space,'      Set Type : ');
                    readtype;
                    readtype;
                    for i:=1to 4 do
                    for i:=1to 4 do
                     begin
                     begin
-                      write (space,'       Value: ');
+                      write (space,'        Value : ');
                       for j:=1to 8 do
                       for j:=1to 8 do
                        begin
                        begin
                          if j>1 then
                          if j>1 then
@@ -1112,96 +1204,107 @@ begin
              end;
              end;
            end;
            end;
 
 
-         ibvarsym :
+         ibabsolutevarsym :
            begin
            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;
            end;
 
 
          ibenumsym :
          ibenumsym :
            begin
            begin
              readcommonsym('Enumeration symbol ');
              readcommonsym('Enumeration symbol ');
-             write  (space,'  Definition: ');
+             write  (space,'   Definition : ');
              readderef;
              readderef;
-             writeln(space,'       Value: ',getlongint);
+             writeln(space,'        Value : ',getlongint);
            end;
            end;
 
 
          ibsyssym :
          ibsyssym :
            begin
            begin
              readcommonsym('Internal system symbol ');
              readcommonsym('Internal system symbol ');
-             writeln(space,' Internal Nr: ',getlongint);
+             writeln(space,'  Internal Nr : ',getlongint);
            end;
            end;
 
 
          ibrttisym :
          ibrttisym :
            begin
            begin
              readcommonsym('RTTI symbol ');
              readcommonsym('RTTI symbol ');
-             writeln(space,'   RTTI Type: ',getbyte);
+             writeln(space,'    RTTI Type : ',getbyte);
            end;
            end;
 
 
          ibtypedconstsym :
          ibtypedconstsym :
            begin
            begin
              readcommonsym('Typed constant ');
              readcommonsym('Typed constant ');
-             write  (space,' Constant Type: ');
+             write  (space,'  Constant Type : ');
              readtype;
              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;
            end;
 
 
          ibpropertysym :
          ibpropertysym :
            begin
            begin
              readcommonsym('Property ');
              readcommonsym('Property ');
              i:=getlongint;
              i:=getlongint;
-             writeln(space,' PropOptions: ',i);
+             writeln(space,'  PropOptions : ',i);
              if (i and 32)>0 then
              if (i and 32)>0 then
               begin
               begin
-                write  (space,'OverrideProp: ');
+                write  (space,' OverrideProp : ');
                 readderef;
                 readderef;
               end
               end
              else
              else
               begin
               begin
-                write  (space,'   Prop Type: ');
+                write  (space,'    Prop Type : ');
                 readtype;
                 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;
                 readtype;
-                write  (space,'  Readaccess: ');
+                write  (space,'   Readaccess : ');
                 readsymlist(space+'         Sym: ');
                 readsymlist(space+'         Sym: ');
-                write  (space,' Writeaccess: ');
+                write  (space,'  Writeaccess : ');
                 readsymlist(space+'         Sym: ');
                 readsymlist(space+'         Sym: ');
-                write  (space,'Storedaccess: ');
+                write  (space,' Storedaccess : ');
                 readsymlist(space+'         Sym: ');
                 readsymlist(space+'         Sym: ');
               end;
               end;
            end;
            end;
@@ -1425,6 +1528,7 @@ begin
              writeln(space,'         DataSize : ',getlongint);
              writeln(space,'         DataSize : ',getlongint);
              writeln(space,'       FieldAlign : ',getbyte);
              writeln(space,'       FieldAlign : ',getbyte);
              writeln(space,'      RecordAlign : ',getbyte);
              writeln(space,'      RecordAlign : ',getbyte);
+             writeln(space,'         PadAlign : ',getbyte);
              if not EndOfEntry then
              if not EndOfEntry then
               Writeln('!! Entry has more information stored');
               Writeln('!! Entry has more information stored');
              {read the record definitions and symbols}
              {read the record definitions and symbols}
@@ -1984,7 +2088,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed possible problem with null termination
 
 
   Revision 1.56  2004/09/27 18:04:11  olle
   Revision 1.56  2004/09/27 18:04:11  olle

+ 6 - 3
compiler/x86/aasmcpu.pas

@@ -881,7 +881,7 @@ implementation
       begin
       begin
         case o.typ of
         case o.typ of
           top_local :
           top_local :
-            o.localoper^.localsymderef.build(tvarsym(o.localoper^.localsym));
+            o.localoper^.localsymderef.build(tlocalvarsym(o.localoper^.localsym));
         end;
         end;
       end;
       end;
 
 
@@ -897,7 +897,7 @@ implementation
                 objectlibrary.derefasmsymbol(o.ref^.relsymbol);
                 objectlibrary.derefasmsymbol(o.ref^.relsymbol);
             end;
             end;
           top_local :
           top_local :
-            o.localoper^.localsym:=tvarsym(o.localoper^.localsymderef.resolve);
+            o.localoper^.localsym:=tlocalvarsym(o.localoper^.localsymderef.resolve);
         end;
         end;
       end;
       end;
 
 
@@ -2111,7 +2111,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * 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 }
                     will generate buggy code. Allow it only for explicit typecasting }
                   if hasdot and
                   if hasdot and
                      (not oper.hastype) 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
                      (current_procinfo.procdef.proccalloption<>pocall_register) then
                     Message(asmr_e_cannot_access_field_directly_for_parameters);
                     Message(asmr_e_cannot_access_field_directly_for_parameters);
                   inc(oper.opr.localsymofs,l)
                   inc(oper.opr.localsymofs,l)
@@ -788,7 +788,10 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * generic tlocation
     * move tlocation to cgutils
     * move tlocation to cgutils
 
 

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