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/src/compiler/CodeGen/cpscompile/mkRecord.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/cpscompile/mkRecord.sml

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

revision 590, Sat Apr 1 02:24:08 2000 UTC revision 591, Mon Apr 3 01:19:20 2000 UTC
# Line 31  Line 31 
31      | pi(x,i) = R.PT.pi(x,i)      | pi(x,i) = R.PT.pi(x,i)
32    
33    fun record {desc, fields, mem, hp, emit, markPTR, markComp} = let    fun record {desc, fields, mem, hp, emit, markPTR, markComp} = let
34      fun getfield(r, CPS.SELp(n, CPS.OFFp 0), mem) =      fun getfield(r, CPS.SELp(n, p), mem) =
         let val mem = pi(mem,n)  
         in  markComp(T.LOAD(ity, indexEA(r, n), mem)) end  
       | getfield(r, CPS.SELp(n, CPS.OFFp off), mem) =  
         let val mem = pi(mem,n)  
         in  T.ADD(addrTy,markComp(T.LOAD(ity, indexEA(r, n), mem)),T.LI(off+4))  
         end  
       | getfield(r, CPS.SELp(n, p), mem) =  
35          let val mem = pi(mem,n)          let val mem = pi(mem,n)
36          in  getfield(markPTR(T.LOAD(ity, indexEA(r, n), mem)), p, mem) end          in  getfield(markPTR(T.LOAD(ity, indexEA(r, n), mem)), p, mem) end
37        | getfield(r, CPS.OFFp 0, _) = r        | getfield(r, CPS.OFFp 0, _) = r
# Line 46  Line 39 
39    
40      fun storeFields ([], _, _, _) = ()      fun storeFields ([], _, _, _) = ()
41        | storeFields ((v, p)::rest, n, mem, i) =        | storeFields ((v, p)::rest, n, mem, i) =
42           (emit(T.STORE(ity, T.ADD(addrTy, C.allocptr, T.LI n),          let val elem = pi(mem, i)
43                 getfield(v,p,mem), pi(mem,i)));          in  emit(T.STORE(ity, T.ADD(addrTy, C.allocptr, T.LI n),
44            storeFields(rest, n + 4, mem, i+1))                   getfield(v, p, elem), elem));
45                storeFields(rest, n + 4, mem, i+1)
46            end
47    in    in
48      emit(T.STORE(ity, ea(C.allocptr, hp), desc, pi(mem,~1)));      emit(T.STORE(ity, ea(C.allocptr, hp), desc, pi(mem,~1)));
49      storeFields(fields, hp+4, mem, 0);      storeFields(fields, hp+4, mem, 0);
# Line 72  Line 67 
67    
68      fun fstoreFields ([], _, _, _) = ()      fun fstoreFields ([], _, _, _) = ()
69        | fstoreFields ((v, p)::rest, n, mem, i) =        | fstoreFields ((v, p)::rest, n, mem, i) =
70            (emit(T.FSTORE(fty,          let val elem = pi(mem, i)
71                  T.ADD(addrTy,C.allocptr,T.LI n),fgetfield(v,p,mem), pi(mem,i)));          in  emit(T.FSTORE(fty, T.ADD(addrTy, C.allocptr, T.LI n),
72             fstoreFields(rest, n + 8, mem, i+2))                            fgetfield(v, p, elem), elem));
73                fstoreFields(rest, n + 8, mem, i+2)
74            end
75    in    in
76      emit(T.STORE(ity, ea(C.allocptr, hp), desc, pi(mem,~1)));      emit(T.STORE(ity, ea(C.allocptr, hp), desc, pi(mem,~1)));
77      fstoreFields(fields, hp+4, mem, 0);      fstoreFields(fields, hp+4, mem, 0);

Legend:
Removed from v.590  
changed lines
  Added in v.591

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