فهرست منبع

+ introduce the usage of asizeint/asizeuint for cpus with sizeof("alu")<>sizeof(pointer)

git-svn-id: trunk@17011 -
florian 14 سال پیش
والد
کامیت
26fbfaf5a7

+ 1 - 1
compiler/cgobj.pas

@@ -3866,7 +3866,7 @@ implementation
            a_cmp_const_reg_label(list,OS_ADDR,OC_NE,0,reg,oklabel);
            cgpara1.init;
            paramanager.getintparaloc(pocall_default,1,cgpara1);
-           a_load_const_cgpara(list,OS_INT,210,cgpara1);
+           a_load_const_cgpara(list,OS_INT,aint(210),cgpara1);
            paramanager.freecgpara(list,cgpara1);
            a_call_name(list,'FPC_HANDLEERROR',false);
            a_label(list,oklabel);

+ 9 - 5
compiler/dbgdwarf.pas

@@ -1701,10 +1701,10 @@ implementation
 
     procedure TDebugInfoDwarf.appenddef_string(list:TAsmList;def:tstringdef);
 
-      procedure addnormalstringdef(const name: shortstring; lendef: tdef; maxlen: aword);
+      procedure addnormalstringdef(const name: shortstring; lendef: tdef; maxlen: asizeuint);
         var
           { maxlen can be > high(int64) }
-          slen : aword;
+          slen : asizeuint;
           arr : tasmlabel;
         begin
           { fix length of openshortstring }
@@ -1782,9 +1782,13 @@ implementation
               }
 {$ifdef cpu64bitaddr}
               addnormalstringdef('LongString',u64inttype,qword(1024*1024));
-{$else cpu64bitaddr}
-              addnormalstringdef('LongString',u32inttype,cardinal(1024*1024));
 {$endif cpu64bitaddr}
+{$ifdef cpu32bitaddr}
+              addnormalstringdef('LongString',u32inttype,cardinal(1024*1024));
+{$endif cpu32bitaddr}
+{$ifdef cpu16bitaddr}
+              addnormalstringdef('LongString',u16inttype,cardinal(1024));
+{$endif cpu16bitaddr}
            end;
          st_ansistring:
            begin
@@ -2453,7 +2457,7 @@ implementation
       var
         bitoffset,
         fieldoffset,
-        fieldnatsize: aint;
+        fieldnatsize: asizeint;
       begin
         if (sp_static in sym.symoptions) or
            (sym.visibility=vis_hidden) then

+ 6 - 1
compiler/dbgstabs.pas

@@ -354,7 +354,7 @@ implementation
     procedure TDebugInfoStabs.field_add_stabstr(p:TObject;arg:pointer);
       var
         spec    : string[3];
-        varsize : aint;
+        varsize : asizeint;
         newss   : ansistring;
         ss      : pansistring absolute arg;
       begin
@@ -379,8 +379,13 @@ implementation
                 varsize:=tfieldvarsym(p).vardef.size;
                 { open arrays made overflows !! }
                 { how can a record/object/class contain an open array? (JM) }
+{$ifdef cpu16bitaddr}
+                if varsize>$fff then
+                  varsize:=$fff;
+{$else cpu16bitaddr}
                 if varsize>$fffffff then
                   varsize:=$fffffff;
+{$endif cpu16bitaddr}
                 newss:=def_stabstr_evaluate(nil,'$1:$2,$3,$4;',[GetSymName(tfieldvarsym(p)),
                                      spec+def_stab_number(tfieldvarsym(p).vardef),
                                      tostr(TConstExprInt(tfieldvarsym(p).fieldoffset)*8),tostr(varsize*8)])

+ 2 - 2
compiler/fpcdefs.inc

@@ -112,9 +112,9 @@
 {$endif m68k}
 
 {$ifdef avr}
-  {$define cpu16bit}
+  {$define cpu8bit}
   {$define cpu16bitaddr}
-  {$define cpu16bitalu}
+  {$define cpu8bitalu}
   {$define cpuflags}
   {$define cpunofpu}
   {$define cpunodefaultint}

+ 11 - 0
compiler/globtype.pas

@@ -70,11 +70,22 @@ interface
      Const
        AIntBits = 16;
 {$endif cpu16bitalu}
+{$ifdef cpu8bitalu}
+       AWord = Byte;
+       AInt = Shortint;
+
+     Const
+       AIntBits = 8;
+{$endif cpu8bitalu}
 
      Type
        PAWord = ^AWord;
        PAInt = ^AInt;
 
+       { target cpu specific type used to store data sizes }
+       ASizeInt = PInt;
+       ASizeUInt = PUInt;
+
        { This must be an ordinal type with the same size as a pointer
          Note: Must be unsigned! Otherwise, ugly code like
          pointer(-1) will result in a pointer with the value

+ 1 - 1
compiler/link.pas

@@ -703,7 +703,7 @@ Implementation
 
     Function TExternalLinker.MakeStaticLibrary:boolean;
 
-        function GetNextFiles(const maxCmdLength : AInt; var item : TCmdStrListItem) : TCmdStr;
+        function GetNextFiles(const maxCmdLength : Longint; var item : TCmdStrListItem) : TCmdStr;
           begin
             result := '';
             while (assigned(item) and ((length(result) + length(item.str) + 1) < maxCmdLength)) do begin

+ 1 - 1
compiler/ncgmat.pas

@@ -368,7 +368,7 @@ implementation
                   cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_NE,0,hdenom,hl);
                   paraloc1.init;
                   paramanager.getintparaloc(pocall_default,1,paraloc1);
-                  cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_S32,200,paraloc1);
+                  cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_S32,aint(200),paraloc1);
                   paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
                   cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR',false);
                   paraloc1.done;

+ 6 - 2
compiler/ncgutil.pas

@@ -1302,9 +1302,13 @@ implementation
     const
 {$ifdef cpu64bitalu}
       trashintvalues: array[0..nroftrashvalues-1] of aint = ($5555555555555555,aint($AAAAAAAAAAAAAAAA),aint($EFEFEFEFEFEFEFEF),0);
-{$else cpu64bitalu}
-      trashintvalues: array[0..nroftrashvalues-1] of aint = ($55555555,aint($AAAAAAAA),aint($EFEFEFEF),0);
 {$endif cpu64bitalu}
+{$ifdef cpu32bitalu}
+      trashintvalues: array[0..nroftrashvalues-1] of aint = ($55555555,aint($AAAAAAAA),aint($EFEFEFEF),0);
+{$endif cpu32bitalu}
+{$ifdef cpu8bitalu}
+      trashintvalues: array[0..nroftrashvalues-1] of aint = ($55,aint($AA),aint($EF),0);
+{$endif cpu8bitalu}
 
     procedure trash_reference(list: TAsmList; const ref: treference; size: aint);
       var

+ 5 - 0
compiler/ogbase.pas

@@ -1505,8 +1505,13 @@ implementation
         { sections }
         FExeSectionList:=TFPHashObjectList.Create(true);
         FImageBase:=0;
+{$ifdef cpu16bitaddr}
+        SectionMemAlign:=$10;
+        SectionDataAlign:=$10;
+{$else cpu16bitaddr}
         SectionMemAlign:=$1000;
         SectionDataAlign:=$200;
+{$endif cpu16bitaddr}
         FCExeSection:=TExeSection;
         FCObjData:=TObjData;
       end;

+ 11 - 0
compiler/ppu.pas

@@ -256,6 +256,7 @@ type
     function getint64:int64;
     function  getqword:qword;
     function getaint:aint;
+    function getasizeint:asizeint;
     function getaword:aword;
     function  getreal:ppureal;
     function  getstring:string;
@@ -717,6 +718,16 @@ begin
 end;
 
 
+function tppufile.getasizeint:asizeint;
+begin
+{$ifdef cpu64bitaddr}
+  result:=getint64;
+{$else cpu64bitaddr}
+  result:=getlongint;
+{$endif cpu32bitaddr}
+end;
+
+
 function tppufile.getaword:aword;
 begin
 {$ifdef cpu64bitalu}

+ 16 - 8
compiler/psystem.pas

@@ -217,18 +217,26 @@ implementation
         ptruinttype:=u64inttype;
         ptrsinttype:=s64inttype;
 {$endif cpu64bitaddr}
-{$ifdef cpu32bit}
-        uinttype:=u32inttype;
-        sinttype:=s32inttype;
+{$ifdef cpu32bitaddr}
         ptruinttype:=u32inttype;
         ptrsinttype:=s32inttype;
-{$endif cpu32bit}
-{$ifdef cpu16bit}
-        uinttype:=u16inttype;
-        sinttype:=s16inttype;
+{$endif cpu32bitaddr}
+{$ifdef cpu32bitalu}
+        uinttype:=u32inttype;
+        sinttype:=s32inttype;
+{$endif cpu32bitalu}
+{$ifdef cpu16bitaddr}
         ptruinttype:=u16inttype;
         ptrsinttype:=s16inttype;
-{$endif cpu16bit}
+{$endif cpu16bitaddr}
+{$ifdef cpu16bitalu}
+        uinttype:=u16inttype;
+        sinttype:=s16inttype;
+{$endif cpu16bitalu}
+{$ifdef cpu8bitalu}
+        uinttype:=u8inttype;
+        sinttype:=s8inttype;
+{$endif cpu8bitalu}
         { some other definitions }
         voidpointertype:=tpointerdef.create(voidtype);
         charpointertype:=tpointerdef.create(cchartype);

+ 1 - 1
compiler/ptconst.pas

@@ -829,7 +829,7 @@ implementation
         var
           n : tnode;
           i : longint;
-          len : aint;
+          len : asizeint;
           ch  : array[0..1] of char;
           ca  : pbyte;
           int_const: tai_const;

+ 2 - 2
compiler/ptype.pas

@@ -1186,8 +1186,8 @@ implementation
                                     Message(parser_e_array_lower_less_than_upper_bound);
                                     highval:=lowval;
                                   end
-                                 else if (lowval<int64(low(aint))) or
-                                         (highval > high(aint)) then
+                                 else if (lowval<int64(low(asizeint))) or
+                                         (highval>high(asizeint)) then
                                    begin
                                      Message(parser_e_array_range_out_of_bounds);
                                      lowval :=0;

+ 62 - 52
compiler/symdef.pas

@@ -70,7 +70,7 @@ interface
           procedure buildderefimpl;override;
           procedure deref;override;
           procedure derefimpl;override;
-          function  size:aint;override;
+          function  size:asizeint;override;
           function  getvardef:longint;override;
           function  alignment:shortint;override;
           function  is_publishable : boolean;override;
@@ -83,7 +83,7 @@ interface
           { generics }
           procedure initgeneric;
        private
-          savesize  : aint;
+          savesize  : asizeuint;
        end;
 
        tfiletyp = (ft_text,ft_typed,ft_untyped);
@@ -205,7 +205,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderef;override;
           procedure deref;override;
-          function  size:aint;override;
+          function  size:asizeint;override;
           function  alignment : shortint;override;
           function  padalignment: shortint;
           function  GetTypeName:string;override;
@@ -299,7 +299,7 @@ interface
           procedure resetvmtentries;
           procedure copyvmtentries(objdef:tobjectdef);
           function  getparentdef:tdef;override;
-          function  size : aint;override;
+          function  size : asizeint;override;
           function  alignment:shortint;override;
           function  vmtmethodoffset(index:longint):longint;
           function  members_need_inittable : boolean;
@@ -347,7 +347,7 @@ interface
 
        tarraydef = class(tstoreddef)
           lowrange,
-          highrange     : aint;
+          highrange     : asizeint;
           rangedef      : tdef;
           rangedefderef : tderef;
           arrayoptions  : tarraydefoptions;
@@ -357,11 +357,11 @@ interface
           _elementdefderef : tderef;
           procedure setelementdef(def:tdef);
        public
-          function elesize : aint;
-          function elepackedbitsize : aint;
-          function elecount : aword;
+          function elesize : asizeint;
+          function elepackedbitsize : asizeint;
+          function elecount : asizeuint;
           constructor create_from_pointer(def:tdef);
-          constructor create(l,h:aint;def:tdef);
+          constructor create(l,h:asizeint;def:tdef);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor destroy; override;
           function getcopy : tstoreddef;override;
@@ -370,7 +370,7 @@ interface
           function  getmangledparaname : string;override;
           procedure buildderef;override;
           procedure deref;override;
-          function size : aint;override;
+          function size : asizeint;override;
           function alignment : shortint;override;
           { returns the label of the range check string }
           function needs_inittable : boolean;override;
@@ -389,7 +389,7 @@ interface
           function  GetTypeName:string;override;
           function alignment:shortint;override;
           procedure setsize;
-          function  packedbitsize: aint; override;
+          function  packedbitsize: asizeint; override;
           function getvardef : longint;override;
        end;
 
@@ -452,7 +452,7 @@ interface
           function getcopy : tstoreddef;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           function  GetSymtable(t:tGetSymtable):TSymtable;override;
-          function  size : aint;override;
+          function  size : asizeint;override;
           function  GetTypeName:string;override;
           function  is_publishable : boolean;override;
           function  is_methodpointer:boolean;override;
@@ -580,10 +580,10 @@ interface
 
        tstringdef = class(tstoreddef)
           stringtype : tstringtype;
-          len        : aint;
+          len        : asizeint;
           constructor createshort(l : byte);
           constructor loadshort(ppufile:tcompilerppufile);
-          constructor createlong(l : aint);
+          constructor createlong(l : asizeint);
           constructor loadlong(ppufile:tcompilerppufile);
           constructor createansi;
           constructor loadansi(ppufile:tcompilerppufile);
@@ -606,13 +606,13 @@ interface
 
        tenumdef = class(tstoreddef)
           minval,
-          maxval    : aint;
+          maxval    : asizeint;
           has_jumps : boolean;
           basedef   : tenumdef;
           basedefderef : tderef;
           symtable  : TSymtable;
           constructor create;
-          constructor create_subrange(_basedef:tenumdef;_min,_max:aint);
+          constructor create_subrange(_basedef:tenumdef;_min,_max:asizeint);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor destroy;override;
           function getcopy : tstoreddef;override;
@@ -622,11 +622,11 @@ interface
           function  GetTypeName:string;override;
           function  is_publishable : boolean;override;
           procedure calcsavesize;
-          function  packedbitsize: aint; override;
-          procedure setmax(_max:aint);
-          procedure setmin(_min:aint);
-          function  min:aint;
-          function  max:aint;
+          function  packedbitsize: asizeint; override;
+          procedure setmax(_max:asizeint);
+          procedure setmin(_min:asizeint);
+          function  min:asizeint;
+          function  max:asizeint;
           function  getfirstsym:tsym;
        end;
 
@@ -635,7 +635,7 @@ interface
           elementdefderef : tderef;
           setbase,
           setmax   : aword;
-          constructor create(def:tdef;low, high : aint);
+          constructor create(def:tdef;low, high : asizeint);
           constructor ppuload(ppufile:tcompilerppufile);
           function getcopy : tstoreddef;override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
@@ -1111,7 +1111,7 @@ implementation
       end;
 
 
-    function tstoreddef.size : aint;
+    function tstoreddef.size : asizeint;
       begin
          size:=savesize;
       end;
@@ -1171,7 +1171,7 @@ implementation
               recsize:=size;
               is_intregable:=
                 ispowerof2(recsize,temp) and
-                (recsize <= sizeof(aint));
+                (recsize <= sizeof(asizeint));
             end;
         end;
      end;
@@ -1217,7 +1217,7 @@ implementation
       end;
 
 
-    constructor tstringdef.createlong(l : aint);
+    constructor tstringdef.createlong(l : asizeint);
       begin
          inherited create(stringdef);
          stringtype:=st_longstring;
@@ -1230,7 +1230,7 @@ implementation
       begin
          inherited ppuload(stringdef,ppufile);
          stringtype:=st_longstring;
-         len:=ppufile.getaint;
+         len:=ppufile.getasizeint;
          savesize:=sizeof(pint);
       end;
 
@@ -1405,7 +1405,7 @@ implementation
       end;
 
 
-    constructor tenumdef.create_subrange(_basedef:tenumdef;_min,_max:aint);
+    constructor tenumdef.create_subrange(_basedef:tenumdef;_min,_max:asizeint);
       begin
          inherited create(enumdef);
          minval:=_min;
@@ -1481,7 +1481,7 @@ implementation
       end;
 
 
-    function tenumdef.packedbitsize: aint;
+    function tenumdef.packedbitsize: asizeint;
       var
         sizeval: tconstexprint;
         power: longint;
@@ -1504,27 +1504,27 @@ implementation
       end;
 
 
-    procedure tenumdef.setmax(_max:aint);
+    procedure tenumdef.setmax(_max:asizeint);
       begin
         maxval:=_max;
         calcsavesize;
       end;
 
 
-    procedure tenumdef.setmin(_min:aint);
+    procedure tenumdef.setmin(_min:asizeint);
       begin
         minval:=_min;
         calcsavesize;
       end;
 
 
-    function tenumdef.min:aint;
+    function tenumdef.min:asizeint;
       begin
         min:=minval;
       end;
 
 
-    function tenumdef.max:aint;
+    function tenumdef.max:asizeint;
       begin
         max:=maxval;
       end;
@@ -1651,7 +1651,7 @@ implementation
       end;
 
 
-    function torddef.packedbitsize: aint;
+    function torddef.packedbitsize: asizeint;
       var
         sizeval: tconstexprint;
         power: longint;
@@ -1923,7 +1923,8 @@ implementation
             else
               savesize:=368;
         end;
-{$else cpu64bitaddr}
+{$endif cpu64bitaddr}
+{$ifdef cpu32bitaddr}
         case filetyp of
           ft_text :
             savesize:=592{+4};
@@ -1931,7 +1932,16 @@ implementation
           ft_untyped :
             savesize:=332;
         end;
-{$endif cpu64bitaddr}
+{$endif cpu32bitaddr}
+{$ifdef cpu8bitaddr}
+        case filetyp of
+          ft_text :
+            savesize:=127;
+          ft_typed,
+          ft_untyped :
+            savesize:=127;
+        end;
+{$endif cpu8bitaddr}
       end;
 
 
@@ -2209,7 +2219,7 @@ implementation
                                    TSETDEF
 ***************************************************************************}
 
-    constructor tsetdef.create(def:tdef;low, high : aint);
+    constructor tsetdef.create(def:tdef;low, high : asizeint);
       var
         setallocbits: aint;
         packedsavesize: aint;
@@ -2338,7 +2348,7 @@ implementation
                            TARRAYDEF
 ***************************************************************************}
 
-    constructor tarraydef.create(l,h:aint;def:tdef);
+    constructor tarraydef.create(l,h:asizeint;def:tdef);
       begin
          inherited create(arraydef);
          lowrange:=l;
@@ -2418,7 +2428,7 @@ implementation
       end;
 
 
-    function tarraydef.elesize : aint;
+    function tarraydef.elesize : asizeint;
       begin
         if (ado_IsBitPacked in arrayoptions) then
           internalerror(2006080101);
@@ -2429,7 +2439,7 @@ implementation
       end;
 
 
-    function tarraydef.elepackedbitsize : aint;
+    function tarraydef.elepackedbitsize : asizeint;
       begin
         if not(ado_IsBitPacked in arrayoptions) then
           internalerror(2006080102);
@@ -2440,7 +2450,7 @@ implementation
       end;
 
 
-    function tarraydef.elecount : aword;
+    function tarraydef.elecount : asizeuint;
       var
         qhigh,qlow : qword;
       begin
@@ -2454,7 +2464,7 @@ implementation
             qhigh:=highrange;
             qlow:=qword(-lowrange);
             { prevent overflow, return 0 to indicate overflow }
-            if qhigh+qlow>qword(high(aint)-1) then
+            if qhigh+qlow>qword(high(asizeint)-1) then
               result:=0
             else
               result:=qhigh+qlow+1;
@@ -2464,10 +2474,10 @@ implementation
       end;
 
 
-    function tarraydef.size : aint;
+    function tarraydef.size : asizeint;
       var
-        cachedelecount : aword;
-        cachedelesize : aint;
+        cachedelecount : asizeuint;
+        cachedelesize : asizeint;
       begin
         if ado_IsDynamicArray in arrayoptions then
           begin
@@ -2498,17 +2508,17 @@ implementation
 
         { prevent overflow, return -1 to indicate overflow }
         { also make sure we don't need 64/128 bit arithmetic to calculate offsets }
-        if (cachedelecount > aword(high(aint))) or
-           ((high(aint) div cachedelesize) < aint(cachedelecount)) or
-           { also lowrange*elesize must be < high(aint) to prevent overflow when
+        if (cachedelecount > asizeuint(high(asizeint))) or
+           ((high(asizeint) div cachedelesize) < asizeint(cachedelecount)) or
+           { also lowrange*elesize must be < high(asizeint) to prevent overflow when
              accessing the array, see ncgmem (PFV) }
-           ((high(aint) div cachedelesize) < abs(lowrange)) then
+           ((high(asizeint) div cachedelesize) < abs(lowrange)) then
           begin
             result:=-1;
             exit;
           end;
 
-        result:=cachedelesize*aint(cachedelecount);
+        result:=cachedelesize*asizeint(cachedelecount);
         if (ado_IsBitPacked in arrayoptions) then
           { can't just add 7 and divide by 8, because that may overflow }
           result:=result div 8 + ord((result mod 8)<>0);
@@ -2903,7 +2913,7 @@ implementation
       end;
 
 
-    function trecorddef.size:aint;
+    function trecorddef.size:asizeint;
       begin
         result:=trecordsymtable(symtable).datasize;
       end;
@@ -4060,7 +4070,7 @@ implementation
       end;
 
 
-    function tprocvardef.size : aint;
+    function tprocvardef.size : asizeint;
       begin
          if ((po_methodpointer in procoptions) or
              is_nested_pd(self)) and
@@ -4732,7 +4742,7 @@ implementation
           (assigned(childof) and childof.implements_any_interfaces);
       end;
 
-    function tobjectdef.size : aint;
+    function tobjectdef.size : asizeint;
       begin
         if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface,odt_objcclass,odt_objcprotocol] then
           result:=sizeof(pint)

+ 5 - 5
compiler/symsym.pas

@@ -136,7 +136,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderef;override;
           procedure deref;override;
-          function  getsize : aint;
+          function  getsize : asizeint;
           function  getpackedbitsize : longint;
           function  is_regvar(refpara: boolean):boolean;
           procedure trigger_notifications(what:Tnotification_flag);
@@ -153,7 +153,7 @@ interface
       end;
 
       tfieldvarsym = class(tabstractvarsym)
-          fieldoffset   : aint;   { offset in record/object }
+          fieldoffset   : asizeint;   { offset in record/object }
           objcoffsetmangledname: pshortstring; { mangled name of offset, calculated as needed }
           constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor ppuload(ppufile:tcompilerppufile);
@@ -246,7 +246,7 @@ interface
           constructor create(const n : string);
           destructor  destroy;override;
           constructor ppuload(ppufile:tcompilerppufile);
-          function  getsize : aint;
+          function  getsize : asizeint;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderef;override;
           procedure deref;override;
@@ -950,7 +950,7 @@ implementation
       end;
 
 
-    function tpropertysym.getsize : aint;
+    function tpropertysym.getsize : asizeint;
       begin
          getsize:=0;
       end;
@@ -1043,7 +1043,7 @@ implementation
       end;
 
 
-    function tabstractvarsym.getsize : aint;
+    function tabstractvarsym.getsize : asizeint;
       begin
         if assigned(vardef) and
            ((vardef.typ<>arraydef) or

+ 17 - 17
compiler/symtable.pas

@@ -84,7 +84,7 @@ interface
           constructor create(const n:string;usealign:shortint);
           procedure ppuload(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          procedure alignrecord(fieldoffset:aint;varalign:shortint);
+          procedure alignrecord(fieldoffset:asizeint;varalign:shortint);
           procedure addfield(sym:tfieldvarsym;vis:tvisibility);
           procedure addalignmentpadding;
           procedure insertdef(def:TDefEntry);override;
@@ -92,14 +92,14 @@ interface
           function has_single_field(out sym:tfieldvarsym): boolean;
           function get_unit_symtable: tsymtable;
         protected
-          _datasize       : aint;
+          _datasize       : asizeint;
           { size in bits of the data in case of bitpacked record. Only important during construction, }
           { no need to save in/restore from ppu file. datasize is always (databitsize+7) div 8.       }
-          databitsize    : aint;
-          procedure setdatasize(val: aint);
+          databitsize    : asizeint;
+          procedure setdatasize(val: asizeint);
         public
           function iscurrentunit: boolean; override;
-          property datasize : aint read _datasize write setdatasize;
+          property datasize : asizeint read _datasize write setdatasize;
        end;
 
        trecordsymtable = class(tabstractrecordsymtable)
@@ -833,7 +833,7 @@ implementation
       end;
 
 
-    function field2recordalignment(fieldoffs, fieldalign: aint): aint;
+    function field2recordalignment(fieldoffs, fieldalign: asizeint): asizeint;
       begin
         { optimal alignment of the record when declaring a variable of this }
         { type is independent of the packrecords setting                    }
@@ -859,7 +859,7 @@ implementation
           result:=1;
       end;
 
-    procedure tabstractrecordsymtable.alignrecord(fieldoffset:aint;varalign:shortint);
+    procedure tabstractrecordsymtable.alignrecord(fieldoffset:asizeint;varalign:shortint);
       var
         varalignrecord: shortint;
       begin
@@ -876,7 +876,7 @@ implementation
 
     procedure tabstractrecordsymtable.addfield(sym:tfieldvarsym;vis:tvisibility);
       var
-        l      : aint;
+        l      : asizeint;
         varalignfield,
         varalign : shortint;
         vardef : tdef;
@@ -908,7 +908,7 @@ implementation
                 begin
                   databitsize:=_datasize*8;
                   sym.fieldoffset:=databitsize;
-                  if (l>high(aint) div 8) then
+                  if (l>high(asizeint) div 8) then
                     Message(sym_e_segment_too_large);
                   l:=l*8;
                 end;
@@ -918,11 +918,11 @@ implementation
               { bit packed records are limited to high(aint) bits }
               { instead of bytes to avoid double precision        }
               { arithmetic in offset calculations                 }
-              if int64(l)>high(aint)-sym.fieldoffset then
+              if int64(l)>high(asizeint)-sym.fieldoffset then
                 begin
                   Message(sym_e_segment_too_large);
-                  _datasize:=high(aint);
-                  databitsize:=high(aint);
+                  _datasize:=high(asizeint);
+                  databitsize:=high(asizeint);
                 end
               else
                 begin
@@ -978,7 +978,7 @@ implementation
         varalignfield:=used_align(varalign,current_settings.alignment.recordalignmin,fieldalignment);
 
         sym.fieldoffset:=align(_datasize,varalignfield);
-        if l>high(aint)-sym.fieldoffset then
+        if l>high(asizeint)-sym.fieldoffset then
           begin
             Message(sym_e_segment_too_large);
             _datasize:=high(aint);
@@ -1068,7 +1068,7 @@ implementation
           result:=result.defowner.owner;
       end;
 
-    procedure tabstractrecordsymtable.setdatasize(val: aint);
+    procedure tabstractrecordsymtable.setdatasize(val: asizeint);
       begin
         _datasize:=val;
         if (usefieldalignment=bit_alignment) then
@@ -1144,11 +1144,11 @@ implementation
                 else
                   begin
                     bitsize:=tfieldvarsym(sym).getsize;
-                    if (bitsize>high(aint) div 8) then
+                    if (bitsize>high(asizeint) div 8) then
                       Message(sym_e_segment_too_large);
                     bitsize:=bitsize*8;
                   end;
-                if bitsize>high(aint)-databitsize then
+                if bitsize>high(asizeint)-databitsize then
                   begin
                     Message(sym_e_segment_too_large);
                     _datasize:=high(aint);
@@ -1164,7 +1164,7 @@ implementation
               end
             else
               begin
-                if tfieldvarsym(sym).getsize>high(aint)-_datasize then
+                if tfieldvarsym(sym).getsize>high(asizeint)-_datasize then
                   begin
                     Message(sym_e_segment_too_large);
                     _datasize:=high(aint);

+ 3 - 3
compiler/symtype.pas

@@ -73,8 +73,8 @@ interface
          function  mangledparaname:string;
          function  getmangledparaname:string;virtual;
          function  rtti_mangledname(rt:trttitype):string;virtual;abstract;
-         function  size:aint;virtual;abstract;
-         function  packedbitsize:aint;virtual;
+         function  size:asizeint;virtual;abstract;
+         function  packedbitsize:asizeint;virtual;
          function  alignment:shortint;virtual;abstract;
          function  getvardef:longint;virtual;abstract;
          function  getparentdef:tdef;virtual;
@@ -314,7 +314,7 @@ implementation
       end;
 
 
-    function tdef.packedbitsize:aint;
+    function tdef.packedbitsize:asizeint;
       begin
         result:=size * 8;
       end;