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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/gc-safety/gc-typing.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/gc-safety/gc-typing.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 427 - (view) (download)

1 : monnier 427 (*
2 :     * This module is responsible for propagating gc type information.
3 :     *)
4 :     functor GCTyping
5 :     (structure IR : MLRISC_IR
6 :     structure GCProps : GC_PROPERTIES
7 :     structure Props : INSN_PROPERTIES
8 :     sharing IR.I = GCProps.I = Props.I
9 :     ) : GC_TYPING =
10 :     struct
11 :    
12 :     structure IR = IR
13 :     structure CFG = IR.CFG
14 :     structure GC = GCProps.GC
15 :     structure G = Graph
16 :     structure An = Annotations
17 :    
18 :     fun gcTyping(IR as G.GRAPH cfg) =
19 :     case An.get(fn GC.GCMAP m => SOME m | _ => NONE) (CFG.getAnnotations IR)
20 :     of NONE => IR (* no gc map; do nothing *)
21 :     | SOME gcmap =>
22 :     let val lookup = Intmap.map gcmap
23 :     val add = Intmap.add gcmap
24 :     fun update(dst,ty) =
25 :     (lookup dst; ()) handle _ => add(dst,ty)
26 :     fun move(dst,src) =
27 :     (lookup dst; ()) handle _ =>
28 :     (add(dst,lookup src) handle _ => ())
29 :     val prop = GCProps.propagate {lookup=lookup,update=update}
30 :     fun process(b,CFG.BLOCK{insns,...}) =
31 :     let fun scan [] = ()
32 :     | scan(i::is) =
33 :     (case Props.instrKind i of
34 :     Props.IK_COPY =>
35 :     let val (dst,src) = Props.moveDstSrc i
36 :     fun copy(d::ds,s::ss) = (move(d,s); copy(ds,ss))
37 :     | copy _ = ()
38 :     in copy(dst,src)
39 :     end
40 :     | Props.IK_GROUP => () (* skip *)
41 :     | _ => prop i handle _ => ();
42 :     scan is
43 :     )
44 :     in scan(rev(!insns))
45 :     end
46 :     in #forall_nodes cfg process;
47 :     IR
48 :     end
49 :    
50 :     end

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