浏览代码

* removed repetitive pass counting
* display heapsize also for extdebug

peter 23 年之前
父节点
当前提交
8b5e92cb3c
共有 3 个文件被更改,包括 37 次插入60 次删除
  1. 16 28
      compiler/compiler.pas
  2. 7 5
      compiler/globals.pas
  3. 14 27
      compiler/pass_1.pas

+ 16 - 28
compiler/compiler.pas

@@ -179,6 +179,13 @@ implementation
 uses
   aasmcpu;
 
+{$ifdef EXTDEBUG}
+  {$define SHOWUSEDMEM}
+{$endif}
+{$ifdef MEMDEBUG}
+  {$define SHOWUSEDMEM}
+{$endif}
+
 var
   CompilerInitedAfterArgs,
   CompilerInited : boolean;
@@ -194,22 +201,7 @@ begin
 end;
 {$endif USEEXCEPT}
 
-{$ifdef EXTDEBUG}
-{$ifdef FPC}
-  Var
-    LostMemory : longint;
-  Procedure CheckMemory(LostMemory : longint);
-  begin
-    if LostMemory<>0 then
-      begin
-        Writeln('Memory Lost = '+tostr(LostMemory));
-{$ifdef DEBUG}
-        def_gdb_stop(V_Warning);
-{$endif DEBUG}
-      end;
-  end;
-{$endif FPC}
-{$endif EXTDEBUG}
+
 {****************************************************************************
                                 Compiler
 ****************************************************************************}
@@ -374,17 +366,9 @@ begin
    Compile:=1;
 
   DoneVerbose;
-{$ifdef EXTDEBUG}
-  {$ifdef FPC}
-    LostMemory:=system.HeapSize-MemAvail-EntryMemUsed;
-    CheckMemory(LostMemory);
-  {$endif FPC}
-  Writeln('Repetitive firstpass = '+tostr(firstpass_several)+'/'+tostr(total_of_firstpass));
-  Writeln('Repetitive resulttypepass = ',multiresulttypepasscnt,'/',resulttypepasscnt);
-{$endif EXTDEBUG}
-{$ifdef MEMDEBUG}
-  Writeln('Memory used: ',system.Heapsize);
-{$endif}
+{$ifdef SHOWUSEDMEM}
+  Writeln('Memory used (heapsize): ',DStr(system.Heapsize shr 10),' Kb');
+{$endif SHOWUSEDMEM}
 {$ifdef fixLeaksOnError}
   do_stop{$ifdef FPCPROCVAR}(){$endif};
 {$endif fixLeaksOnError}
@@ -393,7 +377,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.34  2002-08-17 09:23:34  florian
+  Revision 1.35  2002-09-05 19:28:31  peter
+    * removed repetitive pass counting
+    * display heapsize also for extdebug
+
+  Revision 1.34  2002/08/17 09:23:34  florian
     * first part of procinfo rewrite
 
   Revision 1.33  2002/07/26 21:15:37  florian

+ 7 - 5
compiler/globals.pas

@@ -200,11 +200,9 @@ interface
        stacksize    : longint;
 
 {$Ifdef EXTDEBUG}
-       total_of_firstpass,
-       firstpass_several : longint;
-{$ifdef FPC}
+  {$ifdef FPC}
        EntryMemUsed : longint;
-{$endif FPC}
+  {$endif FPC}
      { parameter switches }
        debugstop : boolean;
 {$EndIf EXTDEBUG}
@@ -1479,7 +1477,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.65  2002-08-19 19:36:42  peter
+  Revision 1.66  2002-09-05 19:28:29  peter
+    * removed repetitive pass counting
+    * display heapsize also for extdebug
+
+  Revision 1.65  2002/08/19 19:36:42  peter
     * More fixes for cross unit inlining, all tnodes are now implemented
     * Moved pocall_internconst to po_internconst because it is not a
       calling type at all and it conflicted when inlining of these small

+ 14 - 27
compiler/pass_1.pas

@@ -29,10 +29,6 @@ interface
     uses
        node;
 
-    var
-      resulttypepasscnt,
-      multiresulttypepasscnt : longint;
-
     procedure resulttypepass(var p : tnode);
     function  do_resulttypepass(var p : tnode) : boolean;
 
@@ -69,7 +65,6 @@ implementation
          oldpos    : tfileposinfo;
          hp        : tnode;
       begin
-        inc(resulttypepasscnt);
         if (p.resulttype.def=nil) then
          begin
            oldcodegenerror:=codegenerror;
@@ -104,7 +99,6 @@ implementation
            { update the codegenerror boolean with the previous result of this node }
            if (nf_error in p.flags) then
             codegenerror:=true;
-           inc(multiresulttypepasscnt);
          end;
       end;
 
@@ -124,18 +118,11 @@ implementation
          oldpos    : tfileposinfo;
          hp : tnode;
       begin
-{$ifdef extdebug}
-{         inc(total_of_firstpass);}
-{$endif extdebug}
-         oldcodegenerror:=codegenerror;
-         oldpos:=aktfilepos;
-         oldlocalswitches:=aktlocalswitches;
-{$ifdef extdebug}
-{         if p.firstpasscount>0 then
-          inc(firstpass_several);}
-{$endif extdebug}
          if not(nf_error in p.flags) then
            begin
+              oldcodegenerror:=codegenerror;
+              oldpos:=aktfilepos;
+              oldlocalswitches:=aktlocalswitches;
               codegenerror:=false;
               aktfilepos:=p.fileinfo;
               aktlocalswitches:=p.localswitches;
@@ -186,10 +173,6 @@ implementation
            end
          else
            codegenerror:=true;
-{$ifdef extdebug}
-{         if count_ref then
-           inc(p.firstpasscount);}
-{$endif extdebug}
       end;
 
 
@@ -199,30 +182,34 @@ implementation
          firstpass(p);
 {$ifdef state_tracking}
          writeln('TRACKSTART');
-	 writeln('before');
+         writeln('before');
          writenode(p);
          do_track_state_pass(p);
          writeln('after');
-	 writenode(p);
-	 writeln('TRACKDONE');
+         writenode(p);
+         writeln('TRACKDONE');
 {$endif}
          do_firstpass:=codegenerror;
       end;
-      
+
 {$ifdef state_tracking}
      procedure do_track_state_pass(p:Tnode);
-     
+
      begin
         aktstate:=Tstate_storage.create;
         p.track_state_pass(true);
-	aktstate.destroy;
+            aktstate.destroy;
      end;
 {$endif}
 
 end.
 {
   $Log$
-  Revision 1.27  2002-07-19 12:55:27  daniel
+  Revision 1.28  2002-09-05 19:28:30  peter
+    * removed repetitive pass counting
+    * display heapsize also for extdebug
+
+  Revision 1.27  2002/07/19 12:55:27  daniel
   * Further developed state tracking in whilerepeatn
 
   Revision 1.26  2002/07/19 11:41:36  daniel