Pārlūkot izejas kodu

* use sizesinttype instead of ptrsinttype for the index and high parameter of
open arrays/dynarrays/string-like char arrays, etc.

git-svn-id: trunk@34665 -

nickysn 8 gadi atpakaļ
vecāks
revīzija
657685a8b6

+ 2 - 2
compiler/defutil.pas

@@ -696,10 +696,10 @@ implementation
     { true, if p points to an open array def }
     function is_open_array(p : tdef) : boolean;
       begin
-         { check for ptrsinttype is needed, because for unsigned the high
+         { check for sizesinttype is needed, because for unsigned the high
            range is also -1 ! (PFV) }
          result:=(p.typ=arraydef) and
-                 (tarraydef(p).rangedef=ptrsinttype) and
+                 (tarraydef(p).rangedef=sizesinttype) and
                  (tarraydef(p).lowrange=0) and
                  (tarraydef(p).highrange=-1) and
                  ((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]);

+ 8 - 8
compiler/hlcgobj.pas

@@ -3442,20 +3442,20 @@ implementation
 
       { push parameter 3 }
       if highloc.loc=LOC_CONSTANT then
-        a_load_const_cgpara(list,ptrsinttype,highloc.value+1,cgpara3)
+        a_load_const_cgpara(list,sizesinttype,highloc.value+1,cgpara3)
       else
         begin
           if highloc.loc in [LOC_REGISTER,LOC_CREGISTER] then
             hreg:=highloc.register
           else
             begin
-              hreg:=getintregister(list,ptrsinttype);
-              a_load_loc_reg(list,ptrsinttype,ptrsinttype,highloc,hreg);
+              hreg:=getintregister(list,sizesinttype);
+              a_load_loc_reg(list,sizesinttype,sizesinttype,highloc,hreg);
             end;
           { increment, converts high(x) to length(x) }
-          lenreg:=getintregister(list,ptrsinttype);
-          a_op_const_reg_reg(list,OP_ADD,ptrsinttype,1,hreg,lenreg);
-          a_load_reg_cgpara(list,ptrsinttype,lenreg,cgpara3);
+          lenreg:=getintregister(list,sizesinttype);
+          a_op_const_reg_reg(list,OP_ADD,sizesinttype,1,hreg,lenreg);
+          a_load_reg_cgpara(list,sizesinttype,lenreg,cgpara3);
         end;
 
       { if calling convention is right to left, push parameters 2 and 1 }
@@ -3749,12 +3749,12 @@ implementation
           { load destination }
           a_load_reg_cgpara(list,ptrarrdef,destreg,cgpara2);
           { load size }
-          a_load_reg_cgpara(list,ptrsinttype,sizereg,cgpara3);
+          a_load_reg_cgpara(list,sizesinttype,sizereg,cgpara3);
         end
       else
         begin
           { load size }
-          a_load_reg_cgpara(list,ptrsinttype,sizereg,cgpara3);
+          a_load_reg_cgpara(list,sizesinttype,sizereg,cgpara3);
           { load destination }
           a_load_reg_cgpara(list,ptrarrdef,destreg,cgpara2);
           { load source }

+ 3 - 3
compiler/ncal.pas

@@ -2193,7 +2193,7 @@ implementation
                 begin
                   maybe_load_in_temp(p);
                   hightree:=caddnode.create(subn,geninlinenode(in_length_x,false,p.getcopy),
-                                            cordconstnode.create(1,ptrsinttype,false));
+                                            cordconstnode.create(1,sizesinttype,false));
                   loadconst:=false;
                 end;
            end;
@@ -2201,13 +2201,13 @@ implementation
           len:=0;
         end;
         if loadconst then
-          hightree:=cordconstnode.create(len,ptrsinttype,true)
+          hightree:=cordconstnode.create(len,sizesinttype,true)
         else
           begin
             if not assigned(hightree) then
               internalerror(200304071);
             { Need to use explicit, because it can also be a enum }
-            hightree:=ctypeconvnode.create_internal(hightree,ptrsinttype);
+            hightree:=ctypeconvnode.create_internal(hightree,sizesinttype);
           end;
         result:=hightree;
       end;

+ 3 - 3
compiler/nmem.pas

@@ -933,9 +933,9 @@ implementation
                    begin
                      if is_signed(right.resultdef) and
                         not is_constnode(right) then
-                       inserttypeconv(right,ptrsinttype)
+                       inserttypeconv(right,sizesinttype)
                      else
-                       inserttypeconv(right,ptruinttype)
+                       inserttypeconv(right,sizeuinttype)
                    end
                  else if is_special_array(left.resultdef) then
                    {Arrays without a high bound (dynamic arrays, open arrays) are zero based,
@@ -980,7 +980,7 @@ implementation
                         then
                        newordtyp:=Torddef(right.resultdef).ordtype
                      else
-                       newordtyp:=torddef(ptrsinttype).ordtype;
+                       newordtyp:=torddef(sizesinttype).ordtype;
                      inserttypeconv(right,corddef.create(newordtyp,
                                                          int64(Tarraydef(left.resultdef).lowrange),
                                                          int64(Tarraydef(left.resultdef).highrange),

+ 1 - 1
compiler/pdecsub.pas

@@ -410,7 +410,7 @@ implementation
                 consume(_ARRAY);
                 consume(_OF);
                 { define range and type of range }
-                hdef:=carraydef.create(0,-1,ptrsinttype);
+                hdef:=carraydef.create(0,-1,sizesinttype);
                 { array of const ? }
                 if (token=_CONST) and (m_objpas in current_settings.modeswitches) then
                  begin

+ 1 - 1
compiler/pparautl.pas

@@ -353,7 +353,7 @@ implementation
            { needs high parameter ? }
            if paramanager.push_high_param(varspez,vardef,pd.proccalloption) then
              begin
-               hvs:=cparavarsym.create('$high'+name,paranr+1,vs_const,ptrsinttype,[vo_is_high_para,vo_is_hidden_para]);
+               hvs:=cparavarsym.create('$high'+name,paranr+1,vs_const,sizesinttype,[vo_is_high_para,vo_is_hidden_para]);
                hvs.symoptions:=[];
                owner.insert(hvs);
                { don't place to register if it will be accessed from implicit finally block }

+ 1 - 1
compiler/psystem.pas

@@ -370,7 +370,7 @@ implementation
   {$endif i8086}
 {$endif x86}
         set_default_ptr_types;
-        openchararraytype:=carraydef.create(0,-1,ptrsinttype);
+        openchararraytype:=carraydef.create(0,-1,sizesinttype);
         tarraydef(openchararraytype).elementdef:=cansichartype;
         cfiletype:=cfiledef.createuntyped;
         cvarianttype:=cvariantdef.create(vt_normalvariant);

+ 1 - 1
compiler/symdef.pas

@@ -3641,7 +3641,7 @@ implementation
             { do not simply push/pop current_module.localsymtable, because
               that can have side-effects (e.g., it removes helpers) }
             symtablestack:=nil;
-            result:=carraydef.create(0,elems-1,ptrsinttype);
+            result:=carraydef.create(0,elems-1,sizesinttype);
             result.elementdef:=def;
             setup_reusable_def(def,result,res,oldsymtablestack);
             { res^.Data may still be nil -> don't overwrite result }