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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 476 - (view) (download)

1 : monnier 427 (*
2 :     * This makes a new cell module that automatically propagate gc type info.
3 :     *)
4 :     functor GCCells(structure C : CELLS
5 : monnier 475 structure GCMap : GC_MAP) : GC_CELLS =
6 : monnier 427 struct
7 :    
8 :     structure C = C
9 : monnier 475 structure GC = GCMap.GC
10 :     structure GCMap = GCMap
11 : monnier 427
12 : monnier 475 val gcmap = ref NONE : GCMap.gcmap option ref
13 : monnier 427
14 :     fun setGCMap map = gcmap := SOME map
15 :     fun getGCMap() = Option.valOf(!gcmap)
16 :    
17 :     (*
18 :     * Generate a new virtual register and update the gc map at the same time.
19 :     *)
20 :     fun newCell k =
21 :     let val new = C.newCell k
22 :     val gcmap = getGCMap()
23 :     val add = Intmap.add gcmap
24 :     fun genVar gc =
25 :     let val r = new()
26 :     in add(r,gc); r end
27 :     in genVar
28 :     end
29 :    
30 :     (*
31 :     * Create a new GC map
32 :     *)
33 :     fun newGCMap() =
34 : monnier 475 let val gcmap = Intmap.new(129,GCMap.GCMap)
35 : monnier 427 in case C.zeroReg C.GP of
36 :     SOME r => Intmap.add gcmap (r,GC.CONST 0)
37 :     | _ => ();
38 :     gcmap
39 :     end
40 :    
41 :     end

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