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 /MLRISC/releases/release-110.64/gc-safety/gc-cells.sml
ViewVC logotype

Annotation of /MLRISC/releases/release-110.64/gc-safety/gc-cells.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 428 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/gc-safety/gc-cells.sml

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

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