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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 470 - (view) (download)

1 : monnier 427 (*
2 :     * Abstract interface for GC types.
3 :     *)
4 :     functor GCType(ObjType : OBJ_TYPE) : GC_TYPE =
5 :     struct
6 :    
7 :     structure O = ObjType
8 :    
9 :     type ty = int
10 :    
11 :     datatype gctype =
12 :     CONST of int (* integer constant *)
13 :     | NONREF of O.objtype ref (* non-reference value *)
14 :     | REF of O.objtype ref (* a reference, pointer to a gc object *)
15 :     | ADD of ty * gctype * gctype (* address arithmetic + *)
16 :     | SUB of ty * gctype * gctype (* address arithmetic - *)
17 :     | BOT
18 :     | TOP
19 :    
20 :     type gcmap = gctype Intmap.intmap
21 :    
22 :     exception GCTYPE
23 :    
24 :     fun int i = if i >= 0 then Int.toString i else "-"^Int.toString(~i)
25 :    
26 :     fun toString BOT = "bot"
27 :     | toString TOP = "top"
28 :     | toString (CONST i) = int i
29 :     | toString (NONREF(ref obj)) = "nonref "^O.toString obj
30 :     | toString (REF(ref obj)) = "ref "^O.toString obj
31 :     | toString (ADD(ty,a,b)) = "("^toString a^"+"^toString b^")"
32 :     | toString (SUB(ty,a,b)) = "("^toString a^"-"^toString b^")"
33 :    
34 :     fun mapToString gcmap =
35 :     let val lookup = Intmap.map gcmap
36 :     fun f r = "{"^toString(lookup r)^"}" handle _ => "{?}"
37 :     in f end
38 :    
39 : monnier 469 val GCMAP = Annotations.new NONE : gcmap Annotations.property
40 :     val GCSAFEPOINT = Annotations.newFlag ""
41 : monnier 427
42 :     end

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