Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /MLRISC/releases/release-110.64/gc-safety/gc-cells.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 475 - (download) (annotate)
Wed Nov 10 22:59:58 1999 UTC (19 years, 11 months ago) by monnier
Original Path: sml/branches/SMLNJ/src/MLRISC/gc-safety/gc-cells.sml
File size: 923 byte(s)
version 110.24
(*
 * This makes a new cell module that automatically propagate gc type info.
 *)
functor GCCells(structure C  : CELLS
                structure GCMap : GC_MAP) : GC_CELLS =
struct

   structure C  = C
   structure GC = GCMap.GC
   structure GCMap = GCMap

   val gcmap = ref NONE : GCMap.gcmap option ref

   fun setGCMap map = gcmap := SOME map
   fun getGCMap() = Option.valOf(!gcmap) 

   (*
    * Generate a new virtual register and update the gc map at the same time.
    *)
   fun newCell k = 
   let val new = C.newCell k
       val gcmap = getGCMap()
       val add  = Intmap.add gcmap
       fun genVar gc =
       let val r = new()
       in  add(r,gc); r end
   in  genVar
   end

   (*
    * Create a new GC map
    *)
   fun newGCMap() =
   let val gcmap = Intmap.new(129,GCMap.GCMap)
   in  case C.zeroReg C.GP of
         SOME r => Intmap.add gcmap (r,GC.CONST 0)
       | _ => ();
       gcmap
   end

end

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