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 586 - (download) (annotate)
Thu Mar 30 05:08:07 2000 UTC (19 years, 3 months ago) by leunga
File size: 1086 byte(s)

   Fixed a slight problem with gc types annotations.

   To turn on gc types, do this:

       CM.autoload "sml/compiler.cm";
       Compiler.Control.MLRISC.getFlag "mlrisc-gc-types" := true;
 * This makes a new cell module that automatically propagate gc type info.
functor GCCells(structure C : CELLS
                structure GCMap : GC_MAP) : GC_CELLS =

   structure C  = C
   structure GC = GCMap.GC
   structure GCMap = GCMap
   fun error msg = MLRiscErrorMsg.error("GCCells",msg)

   val gcmap = ref NONE : GCMap.gcmap option ref

   fun setGCMap map = gcmap := SOME map

   fun getGCMap() = 
        case !gcmap of
          NONE => error "no gc map"
        | SOME gcmap => gcmap

   fun clearGCMap() = gcmap := NONE

    * 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

    * 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)
       | _ => ();


ViewVC Help
Powered by ViewVC 1.0.0