瀏覽代碼

compiler: unified variable names, debug indirect_crc

mattias 2 天之前
父節點
當前提交
df32b4c0cd
共有 4 個文件被更改,包括 47 次插入36 次删除
  1. 21 8
      compiler/fppu.pas
  2. 0 3
      compiler/ppcx64.lpi
  3. 16 15
      compiler/symdef.pas
  4. 10 10
      compiler/symsym.pas

+ 21 - 8
compiler/fppu.pas

@@ -39,7 +39,7 @@ interface
     uses
       cmsgs,verbose,
       cutils,cclasses,cstreams,
-      globtype,globals,finput,fmodule,
+      globtype,globals,fpchash,finput,fmodule,
       symbase,ppu,symtype;
 
     type
@@ -903,7 +903,10 @@ var
       end;
 
     procedure tppumodule.writeusedmacros;
+      var
+        oldcrc : boolean;
       begin
+        oldcrc:=ppufile.do_crc;
         ppufile.do_crc:=false;
         is_initial:= true;
         initialmacrosymtable.foreach(@writeusedmacro,nil);
@@ -912,7 +915,7 @@ var
           globalmacrosymtable.foreach(@writeusedmacro,nil);
         localmacrosymtable.foreach(@writeusedmacro,nil);
         ppufile.writeentry(ibusedmacros);
-        ppufile.do_crc:=true;
+        ppufile.do_crc:=oldcrc;
       end;
 {$ENDIF}
 
@@ -920,8 +923,10 @@ var
       var
         hp  : tinputfile;
         ifile : sizeint;
+        oldcrc : boolean;
       begin
       { write the used source files }
+        oldcrc:=ppufile.do_crc;
         ppufile.do_crc:=false;
       { write source files directly in good order }
         for ifile:=0 to sourcefiles.nfiles-1 do
@@ -931,7 +936,7 @@ var
             ppufile.putlongint(hp.getfiletime);
          end;
         ppufile.writeentry(ibsourcefiles);
-        ppufile.do_crc:=true;
+        ppufile.do_crc:=oldcrc;
       end;
 
 
@@ -945,6 +950,10 @@ var
         {$IFDEF Debug_WaitCRC}
         writeln('tppumodule.writeusedunit START ',realmodulename^,' intf=',intf);
         {$ENDIF}
+        {$IFDEF Debug_IndirectCRC}
+        if intf then
+          writeln('INDIRECT_CRC tppumodule.writeusedunit ',hexstr(ppufile.indirect_crc,8));
+        {$ENDIF}
         hp:=tused_unit(used_units.first);
         while assigned(hp) do
          begin
@@ -965,13 +974,17 @@ var
                ppufile.putlongint(longint(hp.interface_checksum));
                ppufile.putlongint(longint(hp.indirect_checksum));
                ppufile.do_crc:=oldcrc;
-               { combine all indirect checksums from units used by this unit }
+               { Combine all indirect checksums from units used by this unit.
+                 The indirect_crc contains the classes+records of this unit as well. }
                if intf then
-                 ppufile.indirect_crc:=ppufile.indirect_crc xor u.indirect_crc;
+                 ppufile.indirect_crc:=UpdateCrc32(ppufile.indirect_crc,u.indirect_crc,sizeof(u.indirect_crc));
+               {$IFDEF Debug_IndirectCRC}
+               if intf then
+                 writeln('INDIRECT_CRC tppumodule.writeusedunit ',hexstr(ppufile.indirect_crc,8),' ',u.modulename^,' ',hexstr(u.indirect_crc,8),' ');
+               {$ENDIF}
              end;
            hp:=tused_unit(hp.next);
          end;
-        ppufile.do_interface_crc:=true;
         ppufile.writeentry(ibloadunit);
       end;
 
@@ -1986,12 +1999,12 @@ var
          crc:=ppufile.crc;
          if in_interface then
            begin
-             // make sure, the interface_crc is not affected by the implementation
+             // Note: the interface_crc is not affected by the implementation
              interface_crc:=ppufile.interface_crc;
              indirect_crc:=ppufile.indirect_crc;
            end;
          {$IFDEF Debug_WaitCRC}
-         writeln('tppumodule.getppucrc ',realmodulename^,' in_interface=',in_interface,' crc=',hexstr(crc,8),' interface_crc=',hexstr(interface_crc,8));
+         writeln('tppumodule.getppucrc ',realmodulename^,' in_interface=',in_interface,' crc=',hexstr(crc,8),' interface_crc=',hexstr(interface_crc,8),' indirect_crc=',hexstr(indirect_crc,8));
          {$ENDIF}
 
          { end of implementation, to generate a correct ppufile

+ 0 - 3
compiler/ppcx64.lpi

@@ -22,9 +22,6 @@
       <Version Value="2"/>
     </PublishOptions>
     <RunParams>
-      <local>
-        <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
-      </local>
       <FormatVersion Value="2"/>
       <Modes Count="1">
         <Mode0 Name="default">

+ 16 - 15
compiler/symdef.pas

@@ -915,9 +915,9 @@ interface
           seenmarker : pointer; // used for filtering in tcandidate
 {$endif}
 {$ifdef symansistr}
-         section: ansistring;
+          section: ansistring;
 {$else symansistr}
-         section: pshortstring;
+          section: pshortstring;
 {$endif}
           { only needed when actually compiling a unit, no need to save/load from ppu }
           invoke_helper : tprocdef;
@@ -5918,20 +5918,15 @@ implementation
 
 
     procedure tabstractprocdef.ppuwrite(ppufile:tcompilerppufile);
-      var
-        oldintfcrc : boolean;
       begin
          { released procdef? }
          if not assigned(parast) then
            exit;
          inherited ppuwrite(ppufile);
          ppufile.putderef(returndefderef);
-         oldintfcrc:=ppufile.do_interface_crc;
-         ppufile.do_interface_crc:=false;
          ppufile.putbyte(ord(proctypeoption));
          ppufile.putbyte(ord(proccalloption));
          ppufile.putset(tppuset8(procoptions));
-         ppufile.do_interface_crc:=oldintfcrc;
 
          if (po_explicitparaloc in procoptions) then
            funcretloc[callerside].ppuwrite(ppufile);
@@ -6859,7 +6854,7 @@ implementation
 
     procedure tprocdef.ppuwrite(ppufile:tcompilerppufile);
       var
-        oldintfcrc : boolean;
+        oldcrc : boolean;
         aliasnamescount,i,sizeleft : longint;
         item : TCmdStrListItem;
         buf : array[0..255] of byte;
@@ -6899,7 +6894,7 @@ implementation
          if (po_dispid in procoptions) then
            ppufile.putlongint(dispid);
          { inline stuff }
-         oldintfcrc:=ppufile.do_crc;
+         oldcrc:=ppufile.do_crc;
          ppufile.do_crc:=false;
          ppufile.putset(tppuset1(implprocoptions));
          if has_inlininginfo then
@@ -6926,7 +6921,7 @@ implementation
             item:=TCmdStrListItem(item.next);
           end;
 
-         ppufile.do_crc:=oldintfcrc;
+         ppufile.do_crc:=oldcrc;
 
          { generic tokens for the declaration }
          if assigned(genericdecltokenbuf) and (genericdecltokenbuf.size>0) then
@@ -6958,18 +6953,19 @@ implementation
            browser info is requested, this has no influence on the crc }
          if store_localst and not ppufile.crc_only then
           begin
-            oldintfcrc:=ppufile.do_crc;
+            oldcrc:=ppufile.do_crc;
             ppufile.do_crc:=false;
             tlocalsymtable(localst).ppuwrite(ppufile);
-            ppufile.do_crc:=oldintfcrc;
+            ppufile.do_crc:=oldcrc;
           end;
 
          { node tree for inlining }
-         oldintfcrc:=ppufile.do_crc;
+
+         oldcrc:=ppufile.do_crc;
          ppufile.do_crc:=false;
          if has_inlininginfo then
            ppuwritenodetree(ppufile,inlininginfo^.code);
-         ppufile.do_crc:=oldintfcrc;
+         ppufile.do_crc:=oldcrc;
       end;
 
 
@@ -8150,6 +8146,9 @@ implementation
            indirect crc keeps track of such changes. }
          old_do_indirect_crc:=ppufile.do_indirect_crc;
          ppufile.do_indirect_crc:=true;
+         {$IFDEF Debug_IndirectCRC}
+         writeln('INDIRECT_CRC tobjectdef.ppuwrite START ',hexstr(ppufile.indirect_crc,8));
+         {$ENDIF}
          inherited ppuwrite(ppufile);
          ppufile.putbyte(byte(objecttype));
          ppufile.putbyte(byte(helpertype));
@@ -8181,7 +8180,6 @@ implementation
              ppufile.putbyte(byte(vmtentry^.visibility));
            end;
 
-
          if assigned(ImplementedInterfaces) then
            begin
              ppufile.putlongint(ImplementedInterfaces.Count);
@@ -8206,6 +8204,9 @@ implementation
          if not(df_copied_def in defoptions) then
            tObjectSymtable(symtable).ppuwrite(ppufile);
 
+         {$IFDEF Debug_IndirectCRC}
+         writeln('INDIRECT_CRC tobjectdef.ppuwrite END ',hexstr(ppufile.indirect_crc,8));
+         {$ENDIF}
          ppufile.do_indirect_crc:=old_do_indirect_crc;
       end;
 

+ 10 - 10
compiler/symsym.pas

@@ -658,7 +658,7 @@ implementation
 
     procedure tstoredsym.ppuwrite(ppufile:tcompilerppufile);
       var
-        oldintfcrc : boolean;
+        oldcrc : boolean;
       begin
 {$ifdef symansistr}
          ppufile.putansistring(realname);
@@ -675,12 +675,12 @@ implementation
            This does mean that changing e.g. the "deprecated" state of a symbol
            by itself will not trigger a recompilation of dependent units.
          }
-         oldintfcrc:=ppufile.do_interface_crc;
-         ppufile.do_interface_crc:=false;
+         oldcrc:=ppufile.do_crc;
+         ppufile.do_crc:=false;
          ppufile.putset(tppuset2(symoptions));
          if sp_has_deprecated_msg in symoptions then
            ppufile.putstring(deprecatedmsg^);
-         ppufile.do_interface_crc:=oldintfcrc;
+         ppufile.do_crc:=oldcrc;
          trtti_attribute_list.ppuwrite(rtti_attribute_list,ppufile);
       end;
 
@@ -1901,15 +1901,15 @@ implementation
 
     procedure tabstractvarsym.ppuwrite(ppufile:tcompilerppufile);
       var
-        oldintfcrc : boolean;
+        oldcrc : boolean;
       begin
          inherited ppuwrite(ppufile);
          ppufile.putbyte(byte(varspez));
-         oldintfcrc:=ppufile.do_crc;
+         oldcrc:=ppufile.do_crc;
          ppufile.do_crc:=false;
          ppufile.putbyte(byte(varregable));
          ppufile.putset(tppuset1(varsymaccess));
-         ppufile.do_crc:=oldintfcrc;
+         ppufile.do_crc:=oldcrc;
          ppufile.putderef(vardefderef);
          ppufile.putset(tppuset4(varoptions));
       end;
@@ -2496,7 +2496,7 @@ implementation
 
     procedure tparavarsym.ppuwrite(ppufile:tcompilerppufile);
       var
-        oldintfcrc : boolean;
+        oldcrc : boolean;
       begin
          inherited ppuwrite(ppufile);
          ppufile.putword(paranr);
@@ -2506,13 +2506,13 @@ implementation
            we write them to the unit file.
            This enables constant folding for inline procedures loaded from units
          }
-         oldintfcrc:=ppufile.do_crc;
+         oldcrc:=ppufile.do_crc;
          ppufile.do_crc:=false;
          ppufile.putbyte(ord(varstate));
          { write also info about the usage of parameters,
            the absolute usage does not matter }
          ppufile.putbyte(min(1,refs));
-         ppufile.do_crc:=oldintfcrc;
+         ppufile.do_crc:=oldcrc;
 
          if vo_has_explicit_paraloc in varoptions then
            begin