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

Diff of /sml/trunk/compiler/FLINT/clos/closure.sml

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

revision 4149, Mon Sep 28 22:40:45 2015 UTC revision 4153, Tue Sep 29 13:30:46 2015 UTC
# Line 417  Line 417 
417   * Environment Access (whereIs, returning object access path)               *   * Environment Access (whereIs, returning object access path)               *
418   ****************************************************************************)   ****************************************************************************)
419    
420  fun whereIs(env as Env(valueL,closureL,_,whatMap),target) =  fun whereIs (env as Env(valueL,closureL,_,whatMap), target) = let
421    let fun bfs(nil,nil) = raise Lookup("whereIs",target,env)        fun bfs (nil, nil) = raise Lookup("whereIs",target,env)
422          | bfs(nil,next) = bfs(next,nil)          | bfs(nil,next) = bfs(next,nil)
423          | bfs((h, ox as (_, CR(off, {functions,values,          | bfs ((h, ox as (_, CR(off, {functions,values, closures,stamp,...})))::m, next) = let
424                                       closures,stamp,...})))::m, next) =              fun cls(nil, _, next) = bfs(m,next)
             let fun cls(nil, _, next) = bfs(m,next)  
425                    | cls((u as (v,cr))::t, i, next) =                    | cls((u as (v,cr))::t, i, next) =
426                          if target=v then h(SELp(i, OFFp 0), [])                          if target=v then h(SELp(i, OFFp 0), [])
427                       else let val nh = fn (p,z) => h(SELp(i, p), u::z)                       else let val nh = fn (p,z) => h(SELp(i, p), u::z)
# Line 443  Line 442 
442                       else h(OFFp(~off), [ox])                       else h(OFFp(~off), [ox])
443                  else fns(functions, 0)                  else fns(functions, 0)
444              end              end
445        fun search closures =        fun search closures = let
446          let val s = map (fn x => (fn (p,z) => (#1 x,p,z), x)) closures              val s = map (fn x => (fn (p,z) => (#1 x,p,z), x)) closures
447           in Path (bfs(s,nil))              in
448                  Path (bfs(s,nil))
449          end          end
450        fun withTgt(v,CR(_,{free,...})) = member free target        fun withTgt(v,CR(_,{free,...})) = member free target
451        fun lookC ((v,cr)::tl) =        fun lookC ((v,cr)::tl) =
# Line 469  Line 469 
469    end    end
470    
471    
472    
473  (****************************************************************************  (****************************************************************************
474   * Environment Filtering (get the set of current reusable closures)         *   * Environment Filtering (get the set of current reusable closures)         *
475   ****************************************************************************)   ****************************************************************************)

Legend:
Removed from v.4149  
changed lines
  Added in v.4153

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