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 775 - (view) (download)

1 : monnier 427 (*
2 : leunga 775 * This makes a new cell function that automatically propagate gc type info.
3 : monnier 427 *)
4 : leunga 775 functor GCCells(structure C : CELLS
5 :     structure GC : GC_TYPE
6 : leunga 744 ) : GC_CELLS =
7 : monnier 427 struct
8 :    
9 :     structure C = C
10 : leunga 775 structure GC = GC
11 : leunga 586
12 : monnier 427 (*
13 : leunga 775 * Generate a new virtual register and update the gc information
14 :     * at the same time.
15 : monnier 427 *)
16 :     fun newCell k =
17 :     let val new = C.newCell k
18 : leunga 775 val set = #set GC.GC_TYPE
19 : monnier 427 fun genVar gc =
20 : leunga 775 let val r as C.CELL{an, ...} = new()
21 :     in an := set(gc,!an); r end
22 : monnier 427 in genVar
23 :     end
24 :    
25 : leunga 775 fun getGCType(C.CELL{an, ...}) = #lookup GC.GC_TYPE (!an)
26 :     fun setGCType(C.CELL{an, ...}, gc) = an := #set GC.GC_TYPE (gc, !an)
27 : monnier 427
28 : leunga 775 fun printType(C.CELL{an, ...}) =
29 :     case #get GC.GC_TYPE (!an) of
30 :     SOME ty => ":"^GC.toString ty
31 :     | NONE => ":?"
32 :    
33 :     val GCLIVEOUT = Annotations.new(SOME(fn _ => "GCLIVEOUT"))
34 :     : (C.cell * GC.gctype) list Annotations.property
35 : monnier 427 end

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