Browse Source

* tai_const.create_ptr added

peter 21 năm trước cách đây
mục cha
commit
356b3378e8

+ 30 - 6
compiler/aasmtai.pas

@@ -53,6 +53,7 @@ interface
           ait_symbol,
           ait_symbol,
           ait_symbol_end, { needed to calc the size of a symbol }
           ait_symbol_end, { needed to calc the size of a symbol }
           ait_label,
           ait_label,
+          ait_const_64bit,
           ait_const_32bit,
           ait_const_32bit,
           ait_const_16bit,
           ait_const_16bit,
           ait_const_8bit,
           ait_const_8bit,
@@ -102,6 +103,7 @@ interface
           'symbol',
           'symbol',
           'symbol_end',
           'symbol_end',
           'label',
           'label',
+          'const_64bit',
           'const_32bit',
           'const_32bit',
           'const_16bit',
           'const_16bit',
           'const_8bit',
           'const_8bit',
@@ -329,9 +331,11 @@ interface
        end;
        end;
 
 
 
 
-       { Generates a long integer (32 bit) }
+       { Generates an integer const }
        tai_const = class(tai)
        tai_const = class(tai)
-          value : cardinal;
+          value : qword;
+          constructor Create_ptr(_value : TConstPtrUInt);
+          constructor Create_64bit(_value : qword);
           constructor Create_32bit(_value : cardinal);
           constructor Create_32bit(_value : cardinal);
           constructor Create_16bit(_value : word);
           constructor Create_16bit(_value : word);
           constructor Create_8bit(_value : byte);
           constructor Create_8bit(_value : byte);
@@ -878,24 +882,41 @@ implementation
                                TAI_CONST
                                TAI_CONST
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tai_const.Create_32bit(_value : cardinal);
+    constructor tai_const.Create_ptr(_value : TConstPtrUInt);
+      begin
+{$ifdef cpu64bit}
+        self.create_64bit(_value);
+{$else cpu64bit}
+        self.create_32bit(_value);
+{$endif cpu64bit}
+      end;
+
+
+    constructor tai_const.Create_64bit(_value : qword);
+      begin
+         inherited Create;
+         typ:=ait_const_64bit;
+         value:=_value;
+      end;
+
 
 
+    constructor tai_const.Create_32bit(_value : cardinal);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_32bit;
          typ:=ait_const_32bit;
          value:=_value;
          value:=_value;
       end;
       end;
 
 
-    constructor tai_const.Create_16bit(_value : word);
 
 
+    constructor tai_const.Create_16bit(_value : word);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_16bit;
          typ:=ait_const_16bit;
          value:=_value;
          value:=_value;
       end;
       end;
 
 
-    constructor tai_const.Create_8bit(_value : byte);
 
 
+    constructor tai_const.Create_8bit(_value : byte);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const_8bit;
          typ:=ait_const_8bit;
@@ -1974,7 +1995,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.71  2004-02-08 23:10:21  jonas
+  Revision 1.72  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.71  2004/02/08 23:10:21  jonas
     * taicpu.is_same_reg_move() now gets a regtype parameter so it only
     * taicpu.is_same_reg_move() now gets a regtype parameter so it only
       removes moves of that particular register type. This is necessary so
       removes moves of that particular register type. This is necessary so
       we don't remove the live_start instruction of a register before it
       we don't remove the live_start instruction of a register before it

+ 6 - 3
compiler/cresstr.pas

@@ -154,7 +154,7 @@ procedure TResourceStrings.CreateResourceStringList;
     With P Do
     With P Do
      begin
      begin
        if (Value=nil) or (len=0) then
        if (Value=nil) or (len=0) then
-         resourcestringlist.concat(tai_const.create_32bit(0))
+         resourcestringlist.concat(tai_const.create_ptr(0))
        else
        else
          begin
          begin
             objectlibrary.getdatalabel(l1);
             objectlibrary.getdatalabel(l1);
@@ -171,7 +171,7 @@ procedure TResourceStrings.CreateResourceStringList;
             consts.concat(tai_const.create_8bit(0));
             consts.concat(tai_const.create_8bit(0));
          end;
          end;
        { append Current value (nil) and hash...}
        { append Current value (nil) and hash...}
-       resourcestringlist.concat(tai_const.create_32bit(0));
+       resourcestringlist.concat(tai_const.create_ptr(0));
        resourcestringlist.concat(tai_const.create_32bit(hash));
        resourcestringlist.concat(tai_const.create_32bit(hash));
        { Append the name as a ansistring. }
        { Append the name as a ansistring. }
        objectlibrary.getdatalabel(l1);
        objectlibrary.getdatalabel(l1);
@@ -300,7 +300,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2003-12-29 19:31:20  florian
+  Revision 1.21  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.20  2003/12/29 19:31:20  florian
     * fixed error message, if a resource file can't be written
     * fixed error message, if a resource file can't be written
 
 
   Revision 1.19  2003/12/08 22:34:24  peter
   Revision 1.19  2003/12/08 22:34:24  peter

+ 6 - 3
compiler/ncgcon.pas

@@ -349,7 +349,7 @@ implementation
                         begin
                         begin
                            { an empty ansi string is nil! }
                            { an empty ansi string is nil! }
                            if len=0 then
                            if len=0 then
-                             Consts.concat(Tai_const.Create_32bit(0))
+                             Consts.concat(Tai_const.Create_ptr(0))
                            else
                            else
                              begin
                              begin
                                 objectlibrary.getdatalabel(l1);
                                 objectlibrary.getdatalabel(l1);
@@ -374,7 +374,7 @@ implementation
                         begin
                         begin
                            { an empty wide string is nil! }
                            { an empty wide string is nil! }
                            if len=0 then
                            if len=0 then
-                             Consts.concat(Tai_const.Create_32bit(0))
+                             Consts.concat(Tai_const.Create_ptr(0))
                            else
                            else
                              begin
                              begin
                                 objectlibrary.getdatalabel(l1);
                                 objectlibrary.getdatalabel(l1);
@@ -574,7 +574,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.36  2004-01-24 18:12:40  florian
+  Revision 1.37  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.36  2004/01/24 18:12:40  florian
     * fixed several arm floating point issues
     * fixed several arm floating point issues
 
 
   Revision 1.35  2004/01/12 16:39:40  peter
   Revision 1.35  2004/01/12 16:39:40  peter

+ 16 - 13
compiler/nobj.pas

@@ -444,8 +444,8 @@ implementation
               datasegment.concat(tai_align.create(const_align(POINTER_SIZE)));
               datasegment.concat(tai_align.create(const_align(POINTER_SIZE)));
               dataSegment.concat(Tai_label.Create(r));
               dataSegment.concat(Tai_label.Create(r));
               { entries for caching }
               { entries for caching }
-              dataSegment.concat(Tai_const.Create_32bit(0));
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
 
 
               dataSegment.concat(Tai_const.Create_32bit(count));
               dataSegment.concat(Tai_const.Create_32bit(count));
               if assigned(root) then
               if assigned(root) then
@@ -897,7 +897,7 @@ implementation
         else
         else
           begin
           begin
             { nil for Corba interfaces }
             { nil for Corba interfaces }
-            dataSegment.concat(Tai_const.Create_32bit(0)); { nil }
+            dataSegment.concat(Tai_const.Create_ptr(0)); { nil }
           end;
           end;
         { VTable }
         { VTable }
         dataSegment.concat(Tai_const_symbol.Createname(gintfgetvtbllabelname(contintfindex)));
         dataSegment.concat(Tai_const_symbol.Createname(gintfgetvtbllabelname(contintfindex)));
@@ -1281,7 +1281,7 @@ implementation
               if assigned(dmtlabel) then
               if assigned(dmtlabel) then
                 dataSegment.concat(Tai_const_symbol.Create(dmtlabel)))
                 dataSegment.concat(Tai_const_symbol.Create(dmtlabel)))
               else
               else
-                dataSegment.concat(Tai_const.Create_32bit(0));
+                dataSegment.concat(Tai_const.Create_ptr(0));
            end;
            end;
 {$endif WITHDMT}
 {$endif WITHDMT}
          { write pointer to parent VMT, this isn't implemented in TP }
          { write pointer to parent VMT, this isn't implemented in TP }
@@ -1292,7 +1292,7 @@ implementation
             (oo_has_vmt in _class.childof.objectoptions) then
             (oo_has_vmt in _class.childof.objectoptions) then
            dataSegment.concat(Tai_const_symbol.Createname(_class.childof.vmt_mangledname))
            dataSegment.concat(Tai_const_symbol.Createname(_class.childof.vmt_mangledname))
          else
          else
-           dataSegment.concat(Tai_const.Create_32bit(0));
+           dataSegment.concat(Tai_const.Create_ptr(0));
 
 
          { write extended info for classes, for the order see rtl/inc/objpash.inc }
          { write extended info for classes, for the order see rtl/inc/objpash.inc }
          if is_class(_class) then
          if is_class(_class) then
@@ -1303,36 +1303,36 @@ implementation
             if (oo_has_msgint in _class.objectoptions) then
             if (oo_has_msgint in _class.objectoptions) then
               dataSegment.concat(Tai_const_symbol.Create(intmessagetable))
               dataSegment.concat(Tai_const_symbol.Create(intmessagetable))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
             { pointer to method table }
             { pointer to method table }
             if assigned(methodnametable) then
             if assigned(methodnametable) then
               dataSegment.concat(Tai_const_symbol.Create(methodnametable))
               dataSegment.concat(Tai_const_symbol.Create(methodnametable))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
             { pointer to field table }
             { pointer to field table }
             dataSegment.concat(Tai_const_symbol.Create(fieldtablelabel));
             dataSegment.concat(Tai_const_symbol.Create(fieldtablelabel));
             { pointer to type info of published section }
             { pointer to type info of published section }
             if (oo_can_have_published in _class.objectoptions) then
             if (oo_can_have_published in _class.objectoptions) then
               dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(fullrtti)))
               dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(fullrtti)))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
             { inittable for con-/destruction }
             { inittable for con-/destruction }
             if _class.members_need_inittable then
             if _class.members_need_inittable then
               dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(initrtti)))
               dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(initrtti)))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
             { auto table }
             { auto table }
-            dataSegment.concat(Tai_const.Create_32bit(0));
+            dataSegment.concat(Tai_const.Create_ptr(0));
             { interface table }
             { interface table }
             if _class.implementedinterfaces.count>0 then
             if _class.implementedinterfaces.count>0 then
               dataSegment.concat(Tai_const_symbol.Create(interfacetable))
               dataSegment.concat(Tai_const_symbol.Create(interfacetable))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
             { table for string messages }
             { table for string messages }
             if (oo_has_msgstr in _class.objectoptions) then
             if (oo_has_msgstr in _class.objectoptions) then
               dataSegment.concat(Tai_const_symbol.Create(strmessagetable))
               dataSegment.concat(Tai_const_symbol.Create(strmessagetable))
             else
             else
-              dataSegment.concat(Tai_const.Create_32bit(0));
+              dataSegment.concat(Tai_const.Create_ptr(0));
           end;
           end;
          { write virtual methods }
          { write virtual methods }
          writevirtualmethods(dataSegment);
          writevirtualmethods(dataSegment);
@@ -1380,7 +1380,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.62  2004-02-19 17:07:42  florian
+  Revision 1.63  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.62  2004/02/19 17:07:42  florian
     * fixed arg. area calculation
     * fixed arg. area calculation
 
 
   Revision 1.61  2004/02/13 15:41:24  peter
   Revision 1.61  2004/02/13 15:41:24  peter

+ 9 - 6
compiler/pmodules.pas

@@ -242,7 +242,7 @@ implementation
             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.createdataname_global(s,0));
             ltvTable.insert(tai_symbol.createdataname_global(s,0));
-            ltvTable.concat(tai_const.create_32bit(0));  { end of list marker }
+            ltvTable.concat(tai_const.create_ptr(0));  { end of list marker }
             ltvTable.concat(tai_symbol_end.createname(s));
             ltvTable.concat(tai_symbol_end.createname(s));
             if (cs_create_smart in aktmoduleswitches) then
             if (cs_create_smart in aktmoduleswitches) then
              dataSegment.concat(Tai_cut.Create);
              dataSegment.concat(Tai_cut.Create);
@@ -307,11 +307,11 @@ implementation
               if (hp.u.flags and uf_init)<>0 then
               if (hp.u.flags and uf_init)<>0 then
                unitinits.concat(Tai_const_symbol.Createname(make_mangledname('INIT$',hp.u.globalsymtable,'')))
                unitinits.concat(Tai_const_symbol.Createname(make_mangledname('INIT$',hp.u.globalsymtable,'')))
               else
               else
-               unitinits.concat(Tai_const.Create_32bit(0));
+               unitinits.concat(Tai_const.Create_ptr(0));
               if (hp.u.flags and uf_finalize)<>0 then
               if (hp.u.flags and uf_finalize)<>0 then
                unitinits.concat(Tai_const_symbol.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,'')))
                unitinits.concat(Tai_const_symbol.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,'')))
               else
               else
-               unitinits.concat(Tai_const.Create_32bit(0));
+               unitinits.concat(Tai_const.Create_ptr(0));
               inc(count);
               inc(count);
             end;
             end;
            hp:=tused_unit(hp.next);
            hp:=tused_unit(hp.next);
@@ -322,11 +322,11 @@ implementation
            if (current_module.flags and uf_init)<>0 then
            if (current_module.flags and uf_init)<>0 then
             unitinits.concat(Tai_const_symbol.Createname(make_mangledname('INIT$',current_module.localsymtable,'')))
             unitinits.concat(Tai_const_symbol.Createname(make_mangledname('INIT$',current_module.localsymtable,'')))
            else
            else
-            unitinits.concat(Tai_const.Create_32bit(0));
+            unitinits.concat(Tai_const.Create_ptr(0));
            if (current_module.flags and uf_finalize)<>0 then
            if (current_module.flags and uf_finalize)<>0 then
             unitinits.concat(Tai_const_symbol.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,'')))
             unitinits.concat(Tai_const_symbol.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,'')))
            else
            else
-            unitinits.concat(Tai_const.Create_32bit(0));
+            unitinits.concat(Tai_const.Create_ptr(0));
            inc(count);
            inc(count);
          end;
          end;
         { TableCount,InitCount }
         { TableCount,InitCount }
@@ -1438,7 +1438,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.139  2004-02-06 22:37:00  daniel
+  Revision 1.140  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.139  2004/02/06 22:37:00  daniel
     * Removed not very usefull nextglobal & previousglobal fields from
     * Removed not very usefull nextglobal & previousglobal fields from
       Tstoreddef, saving 78 kb of memory
       Tstoreddef, saving 78 kb of memory
 
 

+ 5 - 1
compiler/psystem.pas

@@ -448,6 +448,7 @@ implementation
         aiclass[ait_symbol]:=tai_symbol;
         aiclass[ait_symbol]:=tai_symbol;
         aiclass[ait_symbol_end]:=tai_symbol_end;
         aiclass[ait_symbol_end]:=tai_symbol_end;
         aiclass[ait_label]:=tai_label;
         aiclass[ait_label]:=tai_label;
+        aiclass[ait_const_64bit]:=tai_const;
         aiclass[ait_const_32bit]:=tai_const;
         aiclass[ait_const_32bit]:=tai_const;
         aiclass[ait_const_16bit]:=tai_const;
         aiclass[ait_const_16bit]:=tai_const;
         aiclass[ait_const_8bit]:=tai_const;
         aiclass[ait_const_8bit]:=tai_const;
@@ -488,7 +489,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.62  2004-02-04 22:15:15  daniel
+  Revision 1.63  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.62  2004/02/04 22:15:15  daniel
     * Rtti generation moved to ncgutil
     * Rtti generation moved to ncgutil
     * Assmtai usage of symsym removed
     * Assmtai usage of symsym removed
     * operator overloading cleanup up
     * operator overloading cleanup up

+ 9 - 5
compiler/symdef.pas

@@ -1730,7 +1730,7 @@ implementation
          if assigned(basedef) then
          if assigned(basedef) then
            rttiList.concat(Tai_const_symbol.Create(basedef.get_rtti_label(rt)))
            rttiList.concat(Tai_const_symbol.Create(basedef.get_rtti_label(rt)))
          else
          else
-           rttiList.concat(Tai_const.Create_32bit(0));
+           rttiList.concat(Tai_const.Create_ptr(0));
          hp:=tenumsym(firstenum);
          hp:=tenumsym(firstenum);
          while assigned(hp) do
          while assigned(hp) do
            begin
            begin
@@ -1908,6 +1908,7 @@ implementation
             begin
             begin
               rttiList.concat(Tai_const.Create_8bit(tkInt64));
               rttiList.concat(Tai_const.Create_8bit(tkInt64));
               write_rtti_name;
               write_rtti_name;
+{$warning maybe change to create_64bit}
               if target_info.endian=endian_little then
               if target_info.endian=endian_little then
                 begin
                 begin
                   { low }
                   { low }
@@ -5400,7 +5401,7 @@ implementation
                    { isn't it stored ? }
                    { isn't it stored ? }
                    if not(ppo_stored in tpropertysym(sym).propoptions) then
                    if not(ppo_stored in tpropertysym(sym).propoptions) then
                      begin
                      begin
-                        rttiList.concat(Tai_const.Create_32bit(0));
+                        rttiList.concat(Tai_const.Create_ptr(0));
                         proctypesinfo:=proctypesinfo or (3 shl 4);
                         proctypesinfo:=proctypesinfo or (3 shl 4);
                      end
                      end
                    else
                    else
@@ -5607,13 +5608,13 @@ implementation
                   not(objecttype in [odt_interfacecom,odt_interfacecorba]) then
                   not(objecttype in [odt_interfacecom,odt_interfacecorba]) then
                  rttiList.concat(Tai_const_symbol.Createname(vmt_mangledname))
                  rttiList.concat(Tai_const_symbol.Createname(vmt_mangledname))
                else
                else
-                 rttiList.concat(Tai_const.Create_32bit(0));
+                 rttiList.concat(Tai_const.Create_ptr(0));
 
 
                { write owner typeinfo }
                { write owner typeinfo }
                if assigned(childof) and (oo_can_have_published in childof.objectoptions) then
                if assigned(childof) and (oo_can_have_published in childof.objectoptions) then
                  rttiList.concat(Tai_const_symbol.Create(childof.get_rtti_label(fullrtti)))
                  rttiList.concat(Tai_const_symbol.Create(childof.get_rtti_label(fullrtti)))
                else
                else
-                 rttiList.concat(Tai_const.Create_32bit(0));
+                 rttiList.concat(Tai_const.Create_ptr(0));
 
 
                { count total number of properties }
                { count total number of properties }
                if assigned(childof) and (oo_can_have_published in childof.objectoptions) then
                if assigned(childof) and (oo_can_have_published in childof.objectoptions) then
@@ -6118,7 +6119,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.222  2004-02-22 19:55:25  daniel
+  Revision 1.223  2004-02-26 16:16:38  peter
+    * tai_const.create_ptr added
+
+  Revision 1.222  2004/02/22 19:55:25  daniel
     * Revert my latest change
     * Revert my latest change
 
 
   Revision 1.221  2004/02/22 18:49:03  daniel
   Revision 1.221  2004/02/22 18:49:03  daniel