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 /sml/trunk/src/MLRISC/gc-safety/gc-cells.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/gc-safety/gc-cells.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 428 - (download) (annotate)
Wed Sep 8 09:47:00 1999 UTC (19 years, 10 months ago)
Original Path: sml/branches/SMLNJ/src/MLRISC/gc-safety/gc-cells.sml
File size: 883 byte(s)
This commit was manufactured by cvs2svn to create branch 'SMLNJ'.
(*
 * This makes a new cell module that automatically propagate gc type info.
 *)
functor GCCells(structure C  : CELLS
                structure GC : GC_TYPE) : GC_CELLS =
struct

   structure C  = C
   structure GC = GC

   val gcmap = ref NONE : GC.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,GC.GCTYPE)
   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