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 2656 - (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 : george 889 structure CB = CellsBasis
12 : leunga 586
13 : monnier 427 (*
14 : leunga 775 * Generate a new virtual register and update the gc information
15 :     * at the same time.
16 : monnier 427 *)
17 :     fun newCell k =
18 :     let val new = C.newCell k
19 : leunga 775 val set = #set GC.GC_TYPE
20 : monnier 427 fun genVar gc =
21 : george 889 let val r as CB.CELL{an, ...} = new()
22 : leunga 775 in an := set(gc,!an); r end
23 : monnier 427 in genVar
24 :     end
25 :    
26 : george 889 fun getGCType(CB.CELL{an, ...}) = #lookup GC.GC_TYPE (!an)
27 :     fun setGCType(CB.CELL{an, ...}, gc) = an := #set GC.GC_TYPE (gc, !an)
28 : monnier 427
29 : george 889 fun printType(CB.CELL{an, ...}) =
30 : leunga 775 case #get GC.GC_TYPE (!an) of
31 :     SOME ty => ":"^GC.toString ty
32 :     | NONE => ":?"
33 :    
34 :     val GCLIVEOUT = Annotations.new(SOME(fn _ => "GCLIVEOUT"))
35 : george 889 : (CB.cell * GC.gctype) list Annotations.property
36 : monnier 427 end

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