Diff for /gforth/prof-inline.fs between versions 1.1 and 1.2

version 1.1, 2004/09/03 14:04:47 version 1.2, 2004/09/05 07:46:08
Line 45  true constant count-calls? \ do some pro Line 45  true constant count-calls? \ do some pro
 \ how many static calls are there to a word?  How many of the dynamic  \ how many static calls are there to a word?  How many of the dynamic
 \ calls call just a single word?  \ calls call just a single word?
   
   \ how much does inlining called-once words help?
   \ how much does inlining words without control flow help?
   \ how much does partial inlining help?
   \ what's the overlap?
   \ optimizing return-to-returns (tail calls), return-to-calls, call-to-calls
   
 struct  struct
     cell%    field profile-next      cell% list-next
   end-struct list%
   
   list%
     cell% 2* field profile-count      cell% 2* field profile-count
     cell% 2* field profile-sourcepos      cell% 2* field profile-sourcepos
     cell%    field profile-char \ character position in line      cell%    field profile-char \ character position in line
     count-calls? [if]      count-calls? [if]
         cell% field profile-colondef? \ is this a colon definition start          cell% field profile-colondef? \ is this a colon definition start
         cell% field profile-calls \ static calls to the colon def          cell% field profile-calls \ static calls to the colon def (calls%)
         cell% field profile-straight-line \ may contain calls, but no other CF          cell% field profile-straight-line \ may contain calls, but no other CF
         cell% field profile-calls-from \ static calls in the colon def          cell% field profile-calls-from \ static calls in the colon def
     [endif]      [endif]
 end-struct profile% \ profile point  end-struct profile% \ profile point
   
   list%
       cell% field calls%-call \ ptr to profile point of bb containing the call
   end-struct calls%
   
 variable profile-points \ linked list of profile%  variable profile-points \ linked list of profile%
 0 profile-points !  0 profile-points !
 variable next-profile-point-p \ the address where the next pp will be stored  variable next-profile-point-p \ the address where the next pp will be stored
Line 65  profile-points next-profile-point-p ! Line 78  profile-points next-profile-point-p !
 count-calls? [if]  count-calls? [if]
     variable last-colondef-profile \ pointer to the pp of last colon definition      variable last-colondef-profile \ pointer to the pp of last colon definition
 [endif]  [endif]
       
   \ list stuff
   
   
   
   \ profile-point stuff   
   
 : new-profile-point ( -- addr )  : new-profile-point ( -- addr )
     profile% %alloc >r      profile% %alloc >r
     0. r@ profile-count 2!      0. r@ profile-count 2!
Line 77  count-calls? [if] Line 96  count-calls? [if]
         r@ profile-straight-line on          r@ profile-straight-line on
         0 r@ profile-calls-from !          0 r@ profile-calls-from !
     [endif]      [endif]
     0 r@ profile-next !      0 r@ list-next !
     r@ next-profile-point-p @ !      r@ next-profile-point-p @ !
     r@ profile-next next-profile-point-p !      r@ list-next next-profile-point-p !
     r> ;      r> ;
   
 : print-profile ( -- )  : print-profile ( -- )
Line 89  count-calls? [if] Line 108  count-calls? [if]
             r@ profile-sourcepos 2@ .sourcepos ." :"              r@ profile-sourcepos 2@ .sourcepos ." :"
             r@ profile-char @ 0 .r ." : "              r@ profile-char @ 0 .r ." : "
             r@ profile-count 2@ 0 d.r cr              r@ profile-count 2@ 0 d.r cr
             r> profile-next @              r> list-next @
     repeat      repeat
     drop ;      drop ;
   
Line 105  count-calls? [if] Line 124  count-calls? [if]
                 r@ profile-calls @ 4 .r                  r@ profile-calls @ 4 .r
                 cr                  cr
             endif              endif
             r> profile-next @              r> list-next @
     repeat      repeat
     drop ;      drop ;
   

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>