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 216, Fri Feb 26 12:55:26 1999 UTC revision 217, Sun Feb 28 23:41:30 1999 UTC
# Line 563  Line 563 
563                  (* NOTE: we don't want to turn a known function into an                  (* NOTE: we don't want to turn a known function into an
564                   * escaping one.  It's dangerous for optimisations based                   * escaping one.  It's dangerous for optimisations based
565                   * on known functions (elimination of dead args, f.ex)                   * on known functions (elimination of dead args, f.ex)
566                   * and could generate cases where call>use in collect *)                   * and could generate cases where call>use in collect.
567                     * Of course, if g is not a locally defined function (it's
568                     * bound by a LET or as an argument), then knownness is
569                     * irrelevant. *)
570                  in if f = g orelse                  in if f = g orelse
571                      (C.escaping(C.get f)) andalso not(C.escaping(C.get g))                      ((C.escaping(C.get f)) andalso
572                         not(C.escaping(C.get g)) andalso
573                         (case svg of Fun _ => true | _ => false))
574                     (* the default case could ensure the inline *)                     (* the default case could ensure the inline *)
575                     then (m, fdec::fs, hs)                     then (m, fdec::fs, hs)
576                     else let                     else let
# Line 590  Line 595 
595            | fcEta (fdec,(m,fs,hs)) = (m,fdec::fs,hs)            | fcEta (fdec,(m,fs,hs)) = (m,fdec::fs,hs)
596    
597          (* add wrapper for various purposes *)          (* add wrapper for various purposes *)
598          fun wrap (f as ({inline=F.IH_ALWAYS,...},_,_,_):F.fundec,fs) = f::fs          fun wrap (f as (fk as {isrec,inline,...},g,args,body):F.fundec,fs) =
           | wrap (f as (fk as {isrec,...},g,args,body):F.fundec,fs) =  
599              let val gi = C.get g              let val gi = C.get g
600                  fun dropargs filter =                  fun dropargs filter =
601                      let val (nfk,nfk') = OU.fk_wrap(fk, O.map #1 isrec)                      let val (nfk,nfk') = OU.fk_wrap(fk, O.map #1 isrec)
# Line 618  Line 622 
622                   * might turn into calls in the course of fcontract, so                   * might turn into calls in the course of fcontract, so
623                   * by not introducing wrappers here, we avoid useless work                   * by not introducing wrappers here, we avoid useless work
624                   * but we also postpone useful work to later invocations. *)                   * but we also postpone useful work to later invocations. *)
625                  if C.dead gi then fs else                  if C.dead gi then fs
626                    else if inline=F.IH_ALWAYS then f::fs else
627                      let val used = map (used o #1) args                      let val used = map (used o #1) args
628                      in if C.called gi then                      in if C.called gi then
629                          (* if some args are not used, let's drop them *)                          (* if some args are not used, let's drop them *)

Legend:
Removed from v.216  
changed lines
  Added in v.217

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