Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/FLINT/opt/collect.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/opt/collect.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 159, Mon Oct 12 02:45:03 1998 UTC revision 163, Thu Oct 29 21:00:27 1998 UTC
# Line 9  Line 9 
9      val collect : FLINT.fundec -> unit      val collect : FLINT.fundec -> unit
10    
11      (* query functions *)      (* query functions *)
     val recursive : FLINT.lvar -> bool  
12      val escaping  : FLINT.lvar -> bool  (* non-call uses *)      val escaping  : FLINT.lvar -> bool  (* non-call uses *)
13      val usenb     : FLINT.lvar -> int   (* nb of non-recursive uses *)      val usenb     : FLINT.lvar -> int   (* nb of non-recursive uses *)
14      (* val callnb    : FLINT.lvar -> int *)      val called    : FLINT.lvar -> bool  (* known call uses *)
15        val insidep   : FLINT.lvar -> bool  (* are we inside f right now ? *)
16        val recursive : FLINT.lvar -> bool  (* self-recursion test *)
17    
18      (* inc the "true=call,false=use" count *)      (* inc the "true=call,false=use" count *)
19      val use    : bool -> FLINT.lvar -> unit      val use    : bool -> FLINT.lvar -> unit
# Line 26  Line 27 
27      val kill   : FLINT.lvar -> unit      val kill   : FLINT.lvar -> unit
28      (* create a new var entry (true=fun, false=other) initialized to zero *)      (* create a new var entry (true=fun, false=other) initialized to zero *)
29      val new    : bool -> FLINT.lvar -> unit      val new    : bool -> FLINT.lvar -> unit
30        (* move all the internal counts to external *)
31        val extcounts : FLINT.lvar -> unit
32    
33      (* when creating a new var.  Used when alpha-renaming *)      (* when creating a new var.  Used when alpha-renaming *)
34      (* val copy   : FLINT.lvar * FLINT.lvar -> unit *)      (* val copy   : FLINT.lvar * FLINT.lvar -> unit *)
# Line 158  Line 161 
161           | Transfer lv => unuse undertaker call lv           | Transfer lv => unuse undertaker call lv
162      end      end
163    
164    fun insidep lv =
165        case get lv
166         of Fun{inside=ref x,...} => x
167          | Var us => false
168          | Transfer lv => (say "\nCollect insidep on transfer"; insidep lv)
169    
170    (* move internal counts to external *)
171    fun extcounts lv =
172        case get lv
173         of Fun{iuses,euses,icalls,ecalls,...}
174            => (euses := !euses + !iuses; iuses := 0;
175                ecalls := !ecalls + !icalls; icalls := 0)
176          | Var us => ()
177          | Transfer lv => (say "\nCollect extcounts on transfer"; extcounts lv)
178    
179  fun usenb lv     = case get lv of (Fun{euses=uses,...} | Var uses) => !uses  fun usenb lv     = case get lv of (Fun{euses=uses,...} | Var uses) => !uses
180                                  | Transfer _ => 0                                  | Transfer _ => 0
181  fun used lv      = usenb lv > 0  fun used lv      = usenb lv > 0
# Line 171  Line 189 
189        | Var us => !us > 0 (* arbitrary, but I opted for the "safe" choice *)        | Var us => !us > 0 (* arbitrary, but I opted for the "safe" choice *)
190        | Transfer lv => (say "\nCollect escaping on transfer"; escaping lv)        | Transfer lv => (say "\nCollect escaping on transfer"; escaping lv)
191    
192    fun called lv =
193        case get lv
194         of Fun{icalls,ecalls,...} => !ecalls + !icalls > 0
195          | Var us => false (* arbitrary, but consistent with escaping *)
196          | Transfer lv => (say "\nCollect escaping on transfer"; called lv)
197    
198  (* census of the internal part *)  (* census of the internal part *)
199  fun inside f thunk =  fun inside f thunk =
200      case get f      case get f

Legend:
Removed from v.159  
changed lines
  Added in v.163

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0