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

SCM Repository

[smlnj] Diff of /sml/trunk/compiler/CodeGen/cpscompile/spill-new.sml
ViewVC logotype

Diff of /sml/trunk/compiler/CodeGen/cpscompile/spill-new.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4953, Mon Apr 8 17:31:53 2019 UTC revision 4960, Tue Apr 16 10:26:22 2019 UTC
# Line 250  Line 250 
250    
251        fun markPure (p, w) = (case p        fun markPure (p, w) = (case p
252              (* these pure operators actually allocate storage! *)              (* these pure operators actually allocate storage! *)
253               of P.wrap(P.INT sz) => if (sz <= Target.defaultIntSz) then () else markrec(w, 0)               of P.WRAP(P.INT sz) => if (sz <= Target.defaultIntSz) then () else markrec(w, 0)
254                | (P.wrap(P.FLOAT _) | P.newarray0 | P.makeref | P.mkspecial | P.rawrecord _) =>                | (P.WRAP(P.FLOAT _) | P.NEWARRAY0 | P.MAKEREF | P.MKSPECIAL | P.RAWRECORD _) =>
255                    markrec(w, 0)                    markrec(w, 0)
256                | _ => ()                | _ => ()
257              (* end case *))              (* end case *))
258    
259        fun markfp e =        fun markfp e = (case e
260           case e of             of CPS.APP _               => ()
            CPS.APP _               => ()  
261           | CPS.SWITCH(_,_,es)      => app markfp es           | CPS.SWITCH(_,_,es)      => app markfp es
262           | CPS.SELECT(_,_,w,t,e)   => (fp(w,t); markfp e)           | CPS.SELECT(_,_,w,t,e)   => (fp(w,t); markfp e)
263           | CPS.RECORD(_,vl,w,e)    => (recUses vl; markrec(w, 0); markfp e)           | CPS.RECORD(_,vl,w,e)    => (recUses vl; markrec(w, 0); markfp e)
# Line 270  Line 269 
269           | CPS.RCC(_,_,_,_,wtl,e)  => (app fp wtl; markfp e)           | CPS.RCC(_,_,_,_,wtl,e)  => (app fp wtl; markfp e)
270           | CPS.BRANCH(_,_,_,e1,e2) => (markfp e1; markfp e2)           | CPS.BRANCH(_,_,_,e1,e2) => (markfp e1; markfp e2)
271           | CPS.FIX _ => error "FIX in Spill.markfp"           | CPS.FIX _ => error "FIX in Spill.markfp"
272              (* end case *))
273    
274        val () = ListPair.app fp (args, argTypes) (* mark function parameters *)        val () = ListPair.app fp (args, argTypes) (* mark function parameters *)
275        val () = markfp body                      (* mark function body *)        val () = markfp body                      (* mark function body *)
# Line 783  Line 783 
783           case findSpill w of           case findSpill w of
784             NONE => e             NONE => e
785           | SOME(spillRecord, off, cty) =>           | SOME(spillRecord, off, cty) =>
786              CPS.SETTER(P.rawupdate cty,              CPS.SETTER(P.RAWUPDATE cty,
787                 [spillRecord, tagInt off,CPS.VAR w], e)                 [spillRecord, tagInt off,CPS.VAR w], e)
788    
789        (*        (*
# Line 793  Line 793 
793          | createSpillRecord(numSpills, e) =          | createSpillRecord(numSpills, e) =
794        let val (spillRecLvar,_) = genSpillRec()        let val (spillRecLvar,_) = genSpillRec()
795            val m = numSpills * itemSize            val m = numSpills * itemSize
796            val e = CPS.PURE(P.rawrecord NONE,[tagInt m],            val e = CPS.PURE(P.RAWRECORD NONE,[tagInt m],
797                             spillRecLvar,U.BOGt,e)                             spillRecLvar,U.BOGt,e)
798        in  currentSpillRecord := NONE; (* clear *)        in  currentSpillRecord := NONE; (* clear *)
799            e            e
# Line 819  Line 819 
819         *)         *)
820        fun initRecordItem(record, rk, offset, v, path, e) =        fun initRecordItem(record, rk, offset, v, path, e) =
821            proj(v, path,            proj(v, path,
822                 fn x => CPS.SETTER(P.rawupdate(rkToCty rk),                 fn x => CPS.SETTER(P.RAWUPDATE(rkToCty rk),
823                           [CPS.VAR record, tagInt offset, CPS.VAR x], e))                           [CPS.VAR record, tagInt offset, CPS.VAR x], e))
824    
825        (*        (*
# Line 827  Line 827 
827         *)         *)
828        fun createRecord(record, rk, len, consts, e) =        fun createRecord(record, rk, len, consts, e) =
829        let val e = emitSpill(record, e)        let val e = emitSpill(record, e)
830            val p = P.rawupdate(rkToCty rk)            val p = P.RAWUPDATE(rkToCty rk)
831            fun init((i, c),e) = CPS.SETTER(p,[CPS.VAR record, tagInt i, c], e)            fun init((i, c),e) = CPS.SETTER(p,[CPS.VAR record, tagInt i, c], e)
832            val e = foldr init e consts            val e = foldr init e consts
833            val e = CPS.PURE(P.rawrecord(SOME rk),[tagInt len],record,U.BOGt,e)            val e = CPS.PURE(P.RAWRECORD(SOME rk),[tagInt len],record,U.BOGt,e)
834        in  e        in  e
835        end        end
836    

Legend:
Removed from v.4953  
changed lines
  Added in v.4960

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