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/compiler/FLINT/cpsopt/expand.sml
ViewVC logotype

Diff of /sml/trunk/compiler/FLINT/cpsopt/expand.sml

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

revision 4812, Wed Sep 12 21:56:57 2018 UTC revision 4813, Wed Sep 12 23:55:25 2018 UTC
# Line 4  Line 4 
4   * All rights reserved.   * All rights reserved.
5   *)   *)
6    
7  signature EXPAND = sig  signature EXPAND =
8    val expand : {function: CPS.function,    sig
9        val expand : {
10                function : CPS.function,
11                  bodysize: int,                  bodysize: int,
12                  unroll: bool,                  unroll: bool,
13                  table: LtyDef.lty IntHashTable.hash_table,              afterClosure : bool,
14                  afterClosure: bool, do_headers: bool,              do_headers : bool,
15                  click: string -> unit} -> CPS.function              click : string -> unit
16              } -> CPS.function
17    
18  end (* signature EXPAND *)  end (* signature EXPAND *)
19    
20  functor Expand (MachSpec : MACH_SPEC) : EXPAND =  functor Expand (MachSpec : MACH_SPEC) : EXPAND =
# Line 42  Line 46 
46    
47   datatype mode = ALL | NO_UNROLL | UNROLL of int | HEADERS   datatype mode = ALL | NO_UNROLL | UNROLL of int | HEADERS
48    
49  fun expand{function=(fkind,fvar,fargs,ctyl,cexp),unroll,bodysize,click,  fun expand {function=(fkind,fvar,fargs,ctyl,cexp),unroll,bodysize,click,afterClosure,do_headers} =
            afterClosure,table=typtable,do_headers} =  
50    let    let
51     val clicked_any = ref false     val clicked_any = ref false
52     val click = fn z => (click z; clicked_any := true)     val click = fn z => (click z; clicked_any := true)
# Line 66  Line 69 
69                   | Const                   | Const
70                   | Other                   | Other
71    
72     val rep_flag = MachSpec.representations     fun copyLvar v = LV.dupLvar v
    val type_flag = (!Control.CG.checkcps1) andalso  
                    (!Control.CG.checkcps1) andalso rep_flag  
   
    local  
      exception NEXPAND  
      fun getty v =  
        if type_flag  
        then (IntHashTable.lookup typtable v) handle _ =>  
                   (Control.Print.say ("NEXPAND: Can't find the variable "^  
                             (Int.toString v)^" in the typtable ***** \n");  
                    raise NEXPAND)  
        else LtyExtern.ltc_void  
      fun addty(f,t) = IntHashTable.insert typtable (f,t)  
    in  
   
    fun mkv(t) = let val v = LV.mkLvar()  
                     val _ = if type_flag then addty(v,t) else ()  
                 in  v  
                 end  
   
    fun copyLvar v = let val x = LV.dupLvar(v)  
                         val _ = if type_flag then addty(x,getty v) else ()  
                     in  x  
                     end  
   
    end (* local *)  
   
73    
74   local exception Expand   local exception Expand
75         val m : info IntHashTable.hash_table = IntHashTable.mkTable(128,Expand)         val m : info IntHashTable.hash_table = IntHashTable.mkTable(128,Expand)
# Line 602  Line 578 
578                    val e' = pass2_beta(UNROLL 0,cexp)                    val e' = pass2_beta(UNROLL 0,cexp)
579                in  if !clicked_any                in  if !clicked_any
580                        then expand{function=(fkind,fvar,fargs,ctyl,e'),                        then expand{function=(fkind,fvar,fargs,ctyl,e'),
                                   table=typtable,  
581                                    bodysize=bodysize,click=click,unroll=unroll,                                    bodysize=bodysize,click=click,unroll=unroll,
582                                    afterClosure=afterClosure,                                    afterClosure=afterClosure,
583                                    do_headers=do_headers}                                    do_headers=do_headers}
# Line 616  Line 591 
591                    val e' = if do_headers then gamma cexp else cexp                    val e' = if do_headers then gamma cexp else cexp
592                in  if !clicked_any                in  if !clicked_any
593                    then expand{function=(fkind,fvar,fargs,ctyl,e'),                    then expand{function=(fkind,fvar,fargs,ctyl,e'),
594                                table=typtable,bodysize=bodysize,click=click,                                bodysize=bodysize,click=click,
595                                unroll=unroll,afterClosure=afterClosure,                                unroll=unroll,afterClosure=afterClosure,
596                                do_headers=false}                                do_headers=false}
597                    else (debugprint(" (non-unroll 1)\n"); debugflush();                    else (debugprint(" (non-unroll 1)\n"); debugflush();

Legend:
Removed from v.4812  
changed lines
  Added in v.4813

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