Просмотр исходного кода

* vs_hidden replaced by is_hidden boolean

peter 22 лет назад
Родитель
Сommit
e2cbae0ff1
8 измененных файлов с 77 добавлено и 54 удалено
  1. 11 8
      compiler/ncal.pas
  2. 7 10
      compiler/ncgcal.pas
  3. 6 2
      compiler/nmem.pas
  4. 10 6
      compiler/pdecobj.pas
  5. 8 5
      compiler/pdecsub.pas
  6. 5 2
      compiler/symconst.pas
  7. 21 15
      compiler/symdef.pas
  8. 9 6
      compiler/symsym.pas

+ 11 - 8
compiler/ncal.pas

@@ -645,7 +645,7 @@ type
              resulttype:=left.resulttype;
            end
          else
-          if (paraitem.paratyp = vs_hidden) then
+          if (paraitem.is_hidden) then
            begin
              set_varstate(left,true);
              resulttype:=left.resulttype;
@@ -1320,7 +1320,7 @@ type
                end;
               while assigned(currpara) do
                begin
-                 if (currpara.paratyp<>vs_hidden) then
+                 if (not currpara.is_hidden) then
                    Comment(lvl,'    - '+currpara.paratype.def.typename+' : '+EqualTypeName[currpara.eqval]);
                  currpara:=tparaitem(currpara.previous);
                end;
@@ -1352,7 +1352,7 @@ type
              were we need to start comparing }
            currparanr:=paralength;
            currpara:=hp^.firstpara;
-           while assigned(currpara) and (currpara.paratyp=vs_hidden) do
+           while assigned(currpara) and (currpara.is_hidden) do
              currpara:=tparaitem(currpara.previous);
            pt:=tcallparanode(left);
            while assigned(pt) and assigned(currpara) do
@@ -1472,7 +1472,7 @@ type
                  { Ignore vs_hidden parameters }
                  repeat
                    currpara:=tparaitem(currpara.previous);
-                 until (not assigned(currpara)) or (currpara.paratyp<>vs_hidden);
+                 until (not assigned(currpara)) or (not currpara.is_hidden);
                end;
               dec(currparanr);
             end;
@@ -1605,7 +1605,7 @@ type
         currpara:=tparaitem(procdefinition.Para.last);
         while assigned(currpara) do
          begin
-           if (currpara.paratyp=vs_hidden) then
+           if currpara.is_hidden then
             begin
               { generate hidden tree }
               used_by_callnode:=false;
@@ -1706,7 +1706,7 @@ type
 
               { Compare parameters from right to left }
               currpara:=tparaitem(procdefinition.Para.last);
-              while assigned(currpara) and (currpara.paratyp=vs_hidden) do
+              while assigned(currpara) and (currpara.is_hidden) do
                 currpara:=tparaitem(currpara.previous);
               pt:=tcallparanode(left);
               lastpara:=paralength;
@@ -1718,7 +1718,7 @@ type
                    begin
                      repeat
                        currpara:=tparaitem(currpara.previous);
-                     until (not assigned(currpara)) or (currpara.paratyp<>vs_hidden);
+                     until (not assigned(currpara)) or (not currpara.is_hidden);
                    end;
                   pt:=tcallparanode(pt.right);
                   dec(lastpara);
@@ -2517,7 +2517,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.147  2003-04-27 11:21:33  peter
+  Revision 1.148  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.147  2003/04/27 11:21:33  peter
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be

+ 7 - 10
compiler/ncgcal.pas

@@ -111,7 +111,6 @@ implementation
          oflabel : tasmlabel;
          tmpreg  : tregister;
          href    : treference;
-         varspez : tvarspez;
       begin
          if not(assigned(paraitem.paratype.def) or
                 assigned(paraitem.parasym)) then
@@ -137,11 +136,6 @@ implementation
          objectlibrary.getlabel(truelabel);
          objectlibrary.getlabel(falselabel);
          secondpass(left);
-         { retrieve the type of parameter, for hidden parameters
-           the value is stored in the parasym }
-         varspez:=paraitem.paratyp;
-         if varspez=vs_hidden then
-           varspez:=tvarsym(paraitem.parasym).varspez;
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
            begin
@@ -164,7 +158,7 @@ implementation
                  (paraitem.paratype.def.deftype=formaldef) then
            begin
               { allow passing of a constant to a const formaldef }
-              if (varspez=vs_const) and
+              if (tvarsym(paraitem.parasym).varspez=vs_const) and
                  (left.location.loc=LOC_CONSTANT) then
                 location_force_mem(exprasmlist,left.location);
 
@@ -209,7 +203,7 @@ implementation
                 end;
            end
          { handle call by reference parameter }
-         else if (varspez in [vs_var,vs_out]) then
+         else if (paraitem.paratyp in [vs_var,vs_out]) then
            begin
               if (left.location.loc<>LOC_REFERENCE) then
                begin
@@ -219,7 +213,7 @@ implementation
                         (left.nodetype=selfn)) then
                   internalerror(200106041);
                end;
-              if (varspez=vs_out) and
+              if (paraitem.paratyp=vs_out) and
                  assigned(paraitem.paratype.def) and
                  not is_class(paraitem.paratype.def) and
                  paraitem.paratype.def.needs_inittable then
@@ -1443,7 +1437,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.57  2003-04-30 20:53:32  florian
+  Revision 1.58  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.57  2003/04/30 20:53:32  florian
     * error when address of an abstract method is taken
     * fixed some x86-64 problems
     * merged some more x86-64 and i386 code

+ 6 - 2
compiler/nmem.pas

@@ -433,7 +433,8 @@ implementation
                  hp2:=TParaItem(hp3.Para.first);
                  while assigned(hp2) do
                    begin
-                      tprocvardef(resulttype.def).concatpara(nil,hp2.paratype,hp2.parasym,hp2.paratyp,hp2.defaultvalue);
+                      tprocvardef(resulttype.def).concatpara(nil,hp2.paratype,hp2.parasym,
+                          hp2.defaultvalue,hp2.is_hidden);
                       hp2:=TParaItem(hp2.next);
                    end;
               end
@@ -1059,7 +1060,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.51  2003-04-27 11:21:33  peter
+  Revision 1.52  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.51  2003/04/27 11:21:33  peter
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be

+ 10 - 6
compiler/pdecobj.pas

@@ -279,6 +279,7 @@ implementation
                   sc.reset;
                   repeat
                     readvs:=tvarsym.create(orgpattern,generrortype);
+                    readvs.varspez:=varspez;
                     readprocdef.parast.insert(readvs);
                     sc.insert(readvs);
                     consume(_ID);
@@ -304,11 +305,11 @@ implementation
                   readvs:=tvarsym(sc.first);
                   while assigned(readvs) do
                    begin
-                     readprocdef.concatpara(nil,tt,readvs,varspez,nil);
+                     readprocdef.concatpara(nil,tt,readvs,nil,false);
                      { also update the writeprocdef }
                      hvs:=tvarsym.create(readvs.realname,generrortype);
                      writeprocdef.parast.insert(hvs);
-                     writeprocdef.concatpara(nil,tt,hvs,varspez,nil);
+                     writeprocdef.concatpara(nil,tt,hvs,nil,false);
                      readvs:=tvarsym(readvs.listnext);
                    end;
                 until not try_to_consume(_SEMICOLON);
@@ -345,10 +346,10 @@ implementation
                      { concat a longint to the para templates }
                      hvs:=tvarsym.create('$index',p.indextype);
                      readprocdef.parast.insert(hvs);
-                     readprocdef.concatpara(nil,p.indextype,hvs,vs_value,nil);
+                     readprocdef.concatpara(nil,p.indextype,hvs,nil,false);
                      hvs:=tvarsym.create('$index',p.indextype);
                      writeprocdef.parast.insert(hvs);
-                     writeprocdef.concatpara(nil,p.indextype,hvs,vs_value,nil);
+                     writeprocdef.concatpara(nil,p.indextype,hvs,nil,false);
                      pt.free;
                   end;
              end
@@ -423,7 +424,7 @@ implementation
                        writeprocdef.rettype:=voidtype;
                        hvs:=tvarsym.create('$value',p.proptype);
                        writeprocdef.parast.insert(hvs);
-                       writeprocdef.concatpara(nil,p.proptype,hvs,vs_value,nil);
+                       writeprocdef.concatpara(nil,p.proptype,hvs,nil,false);
                        { Insert hidden parameters }
                        calc_parast(writeprocdef);
                        { search procdefs matching writeprocdef }
@@ -1144,7 +1145,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.63  2003-04-27 11:21:33  peter
+  Revision 1.64  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.63  2003/04/27 11:21:33  peter
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be

+ 8 - 5
compiler/pdecsub.pas

@@ -119,7 +119,7 @@ implementation
            vs.varspez:=vs_var;
            pd.parast.insert(vs);
            { Also insert a hidden parameter as first }
-           pd.insertpara(vs.vartype,vs,vs_hidden,nil);
+           pd.insertpara(vs.vartype,vs,nil,true);
 
            akttokenpos:=storepos;
          end;
@@ -162,7 +162,7 @@ implementation
 
                 pd.parast.insert(vs);
                 { Also insert a hidden parameter as first }
-                pd.insertpara(vs.vartype,vs,vs_hidden,nil);
+                pd.insertpara(vs.vartype,vs,nil,true);
 
                 akttokenpos:=storepos;
               end;
@@ -240,7 +240,7 @@ implementation
                end
               else
                hvs:=nil;
-              pd.concatpara(currpara,s32bittype,hvs,vs_hidden,nil);
+              pd.concatpara(currpara,s32bittype,hvs,nil,true);
             end
            else
             begin
@@ -492,7 +492,7 @@ implementation
                    paramanager.push_addr_param(tt.def,pd.proccalloption) then
                   include(vs.varoptions,vo_regable);
               end;
-             hpara:=pd.concatpara(nil,tt,vs,varspez,tdefaultvalue);
+             hpara:=pd.concatpara(nil,tt,vs,tdefaultvalue,false);
              { save position of self parameter }
              if vs.name='SELF' then
               pd.selfpara:=hpara;
@@ -2170,7 +2170,10 @@ const
 end.
 {
   $Log$
-  Revision 1.120  2003-04-30 09:42:42  florian
+  Revision 1.121  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.120  2003/04/30 09:42:42  florian
     + first changes to make self a hidden parameter
 
   Revision 1.119  2003/04/27 11:21:33  peter

+ 5 - 2
compiler/symconst.pas

@@ -280,7 +280,7 @@ type
     vs_set_but_first_not_passed,vs_assigned,vs_used
   );
 
-  tvarspez = (vs_value,vs_const,vs_var,vs_out,vs_hidden);
+  tvarspez = (vs_value,vs_const,vs_var,vs_out);
 
   absolutetyp = (tovar,toasm,toaddr);
 
@@ -350,7 +350,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.52  2003-04-27 11:21:34  peter
+  Revision 1.53  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.52  2003/04/27 11:21:34  peter
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be

+ 21 - 15
compiler/symdef.pas

@@ -103,6 +103,7 @@ interface
           defaultvalue : tsym; { tconstsym }
           paratyp      : tvarspez; { required for procvar }
           paraloc      : tparalocation;
+          is_hidden    : boolean; { is this a hidden (implicit) parameter }
 {$ifdef EXTDEBUG}
           eqval        : tequaltype;
 {$endif EXTDEBUG}
@@ -428,8 +429,8 @@ interface
           procedure  ppuwrite(ppufile:tcompilerppufile);override;
           procedure deref;override;
           procedure releasemem;
-          function  concatpara(afterpara:tparaitem;const tt:ttype;sym : tsym;vsp : tvarspez;defval:tsym):tparaitem;
-          function  insertpara(const tt:ttype;sym : tsym;vsp : tvarspez;defval:tsym):tparaitem;
+          function  concatpara(afterpara:tparaitem;const tt:ttype;sym : tsym;defval:tsym;vhidden:boolean):tparaitem;
+          function  insertpara(const tt:ttype;sym : tsym;defval:tsym;vhidden:boolean):tparaitem;
           procedure removepara(currpara:tparaitem);
           function  para_size(alignsize:longint) : longint;
           function  typename_paras(showhidden:boolean): string;
@@ -3097,14 +3098,15 @@ implementation
       end;
 
 
-    function tabstractprocdef.concatpara(afterpara:tparaitem;const tt:ttype;sym : tsym;vsp : tvarspez;defval:tsym):tparaitem;
+    function tabstractprocdef.concatpara(afterpara:tparaitem;const tt:ttype;sym : tsym;defval:tsym;vhidden:boolean):tparaitem;
       var
         hp : TParaItem;
       begin
         hp:=TParaItem.Create;
-        hp.paratyp:=vsp;
+        hp.paratyp:=tvarsym(sym).varspez;
         hp.parasym:=sym;
         hp.paratype:=tt;
+        hp.is_hidden:=vhidden;
         hp.defaultvalue:=defval;
         { Parameters are stored from left to right }
         if assigned(afterpara) then
@@ -3112,7 +3114,7 @@ implementation
         else
           Para.concat(hp);
         { Don't count hidden parameters }
-        if (vsp<>vs_hidden) then
+        if not vhidden then
          begin
            if not assigned(defval) then
             inc(minparacount);
@@ -3122,19 +3124,20 @@ implementation
       end;
 
 
-    function tabstractprocdef.insertpara(const tt:ttype;sym : tsym;vsp : tvarspez;defval:tsym):tparaitem;
+    function tabstractprocdef.insertpara(const tt:ttype;sym : tsym;defval:tsym;vhidden:boolean):tparaitem;
       var
         hp : TParaItem;
       begin
         hp:=TParaItem.Create;
-        hp.paratyp:=vsp;
+        hp.paratyp:=tvarsym(sym).varspez;
         hp.parasym:=sym;
         hp.paratype:=tt;
+        hp.is_hidden:=vhidden;
         hp.defaultvalue:=defval;
         { Parameters are stored from left to right }
         Para.insert(hp);
         { Don't count hidden parameters }
-        if (vsp<>vs_hidden) then
+        if (not vhidden) then
          begin
            if not assigned(defval) then
             inc(minparacount);
@@ -3147,7 +3150,7 @@ implementation
     procedure tabstractprocdef.removepara(currpara:tparaitem);
       begin
         { Don't count hidden parameters }
-        if (currpara.paratyp<>vs_hidden) then
+        if (not currpara.is_hidden) then
          begin
            if not assigned(currpara.defaultvalue) then
             dec(minparacount);
@@ -3221,13 +3224,14 @@ implementation
             ppufile.gettype(hp.paratype);
             hp.defaultvalue:=tsym(ppufile.getderef);
             hp.parasym:=tsym(ppufile.getderef);
+            hp.is_hidden:=boolean(ppufile.getbyte);
             { later, we'll gerate this on the fly (FK) }
             paraloclen:=ppufile.getbyte;
             if paraloclen<>sizeof(tparalocation) then
               internalerror(200304261);
             ppufile.getdata(hp.paraloc,sizeof(tparalocation));
             { Don't count hidden parameters }
-            if (hp.paratyp<>vs_hidden) then
+            if (not hp.is_hidden) then
              begin
                if not assigned(hp.defaultvalue) then
                 inc(minparacount);
@@ -3264,6 +3268,7 @@ implementation
             ppufile.puttype(hp.paratype);
             ppufile.putderef(hp.defaultvalue);
             ppufile.putderef(hp.parasym);
+            ppufile.putbyte(byte(hp.is_hidden));
             { write the length of tparalocation so ppudump can
               parse the .ppu without knowing the tparalocation size }
             ppufile.putbyte(sizeof(tparalocation));
@@ -3309,7 +3314,7 @@ implementation
         first:=true;
         while assigned(hp) do
          begin
-           if (hp.paratyp<>vs_hidden) or
+           if (not hp.is_hidden) or
               (showhidden) then
             begin
                if first then
@@ -3326,8 +3331,6 @@ implementation
                    s:=s+'const';
                  vs_out :
                    s:=s+'out';
-                 vs_hidden :
-                   s:=s+'hidden';
                end;
                if assigned(hp.paratype.def.typesym) then
                  begin
@@ -4010,7 +4013,7 @@ implementation
         hp:=TParaItem(Para.first);
         while assigned(hp) do
          begin
-           if hp.paratyp<>vs_hidden then
+           if not hp.is_hidden then
              s:=s+'$'+hp.paratype.def.mangledparaname;
            hp:=TParaItem(hp.next);
          end;
@@ -5748,7 +5751,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.139  2003-05-01 07:59:43  florian
+  Revision 1.140  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.139  2003/05/01 07:59:43  florian
     * introduced defaultordconsttype to decribe the default size of ordinal constants
       on 64 bit CPUs it's equal to cs64bitdef while on 32 bit CPUs it's equal to s32bitdef
     + added defines CPU32 and CPU64 for 32 bit and 64 bit CPUs

+ 9 - 6
compiler/symsym.pas

@@ -1085,7 +1085,7 @@ implementation
           begin
             currpara:=tparaitem(pd^.def.para.first);
             { ignore vs_hidden parameters }
-            while assigned(currpara) and (currpara.paratyp=vs_hidden) do
+            while assigned(currpara) and (currpara.is_hidden) do
              currpara:=tparaitem(currpara.next);
             if assigned(currpara) then
              begin
@@ -1121,7 +1121,7 @@ implementation
              begin
                currpara:=Tparaitem(pd^.def.para.first);
                { ignore vs_hidden parameters }
-               while assigned(currpara) and (currpara.paratyp=vs_hidden) do
+               while assigned(currpara) and (currpara.is_hidden) do
                 currpara:=tparaitem(currpara.next);
                if assigned(currpara) then
                 begin
@@ -1165,7 +1165,7 @@ implementation
           begin
             currpara:=Tparaitem(pd^.def.para.first);
             { ignore vs_hidden parameters }
-            while assigned(currpara) and (currpara.paratyp=vs_hidden) do
+            while assigned(currpara) and (currpara.is_hidden) do
              currpara:=tparaitem(currpara.next);
             if assigned(currpara) then
              begin
@@ -1177,14 +1177,14 @@ implementation
                   { Ignore vs_hidden parameters }
                   repeat
                     currpara:=tparaitem(currpara.next);
-                  until (not assigned(currpara)) or (currpara.paratyp<>vs_hidden);
+                  until (not assigned(currpara)) or (not currpara.is_hidden);
                   if assigned(currpara) then
                    begin
                      { Ignore vs_hidden parameters }
                      nextpara:=currpara;
                      repeat
                        nextpara:=tparaitem(nextpara.next);
-                     until (not assigned(nextpara)) or (nextpara.paratyp<>vs_hidden);
+                     until (not assigned(nextpara)) or (not nextpara.is_hidden);
                      { There should be no other parameters left }
                      if not assigned(nextpara) then
                       begin
@@ -2557,7 +2557,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.100  2003-04-27 11:21:34  peter
+  Revision 1.101  2003-05-05 14:53:16  peter
+    * vs_hidden replaced by is_hidden boolean
+
+  Revision 1.100  2003/04/27 11:21:34  peter
     * aktprocdef renamed to current_procdef
     * procinfo renamed to current_procinfo
     * procinfo will now be stored in current_module so it can be