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/fcontract.sml
ViewVC logotype

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

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

revision 190, Thu Nov 19 21:01:17 1998 UTC revision 191, Fri Nov 20 02:01:27 1998 UTC
# Line 23  Line 23 
23   * - update counts when selecting a SWITCH alternative   * - update counts when selecting a SWITCH alternative
24   * - contracting RECORD(R.1,R.2) => R  (only if the type is easily available)   * - contracting RECORD(R.1,R.2) => R  (only if the type is easily available)
25   * - dropping of dead arguments   * - dropping of dead arguments
  * - elimination of constant arguments  
26   *)   *)
27    
28  (* things that lcontract.sml does that fcontract doesn't do (yet):  (* things that lcontract.sml does that fcontract doesn't do (yet):
# Line 45  Line 44 
44    
45  (* things that could also be added:  (* things that could also be added:
46   * - elimination of dead vars in let   * - elimination of dead vars in let
47     * - elimination of constant arguments
48   *)   *)
49    
50  (* things that would require some type info:  (* things that would require some type info:
# Line 196  Line 196 
196    
197  (* fun sayexn e = app say (map (fn s => s^" <- ") (SMLofNJ.exnHistory e)) *)  (* fun sayexn e = app say (map (fn s => s^" <- ") (SMLofNJ.exnHistory e)) *)
198    
 fun ASSERT (true,_) = ()  
   | ASSERT (FALSE,msg) = bug ("assertion "^msg^" failed")  
   
199  val cplv = LambdaVar.dupLvar  val cplv = LambdaVar.dupLvar
200    
201  datatype sval  datatype sval
# Line 384  Line 381 
381      fun inline ifs (f,vs) =      fun inline ifs (f,vs) =
382          case ((val2sval m f) handle x => raise x)          case ((val2sval m f) handle x => raise x)
383           of Fun(g,body,args,{inline,...},od) =>           of Fun(g,body,args,{inline,...},od) =>
384              (ASSERT(used g, "used "^(C.LVarString g));              (if d <> od then (NONE, ifs)
              if d <> od then (NONE, ifs)  
385               else if ((C.usenb(C.get g))handle x => raise x) = 1 andalso not(S.member ifs g) then               else if ((C.usenb(C.get g))handle x => raise x) = 1 andalso not(S.member ifs g) then
386    
387                   (* simple inlining:  we should copy the body and then                   (* simple inlining:  we should copy the body and then
# Line 395  Line 391 
391                    * see comments at the begining of this file and in cfun *)                    * see comments at the begining of this file and in cfun *)
392                   (click_simpleinline();                   (click_simpleinline();
393                    ignore(C.unuse true (C.get g));                    ignore(C.unuse true (C.get g));
                   ASSERT(not (used g), "killed");  
394                    (SOME(F.LET(map #1 args, F.RET vs, body), od), ifs))                    (SOME(F.LET(map #1 args, F.RET vs, body), od), ifs))
395    
396               (* aggressive inlining (but hopefully safe).  We allow               (* aggressive inlining (but hopefully safe).  We allow

Legend:
Removed from v.190  
changed lines
  Added in v.191

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