 Timestamp:
 Oct 11, 2011, 5:42:20 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D2.2/8051indexedlabelsbranch/src/RTL/RTLInterpret.ml
r1345 r1357 62 62 63 63 let print_state = function 64  State (_, _, lbl, sp, lenv, carry, mem, ind ::_, _) >64  State (_, _, lbl, sp, lenv, carry, mem, ind, _) > 65 65 Printf.printf "Stack pointer: %s\n\nCarry: %s\n\nLocal environment:\n%s\n\nMemory:%s\nIndexing:" 66 66 (Val.string_of_address sp) … … 68 68 (string_of_local_env lenv) 69 69 (Mem.to_string mem); 70 Array.iter (fun a > Printf.printf "%d, " a) ind; 70 let i = CostLabel.curr_const_ind ind in 71 CostLabel.const_ind_iter (fun a > Printf.printf "%d, " a) i; 71 72 Printf.printf "Regular state: %s\n\n%!" 72 73 lbl 73  State (_, _, _, _, _, _, _, [], _) > assert false (* indexings nonempty *)74 74  CallState (_, _, args, mem, _, _) > 75 75 Printf.printf "Memory:%s\nCall state: %s\n\n%!" … … 116 116 State (sfrs, graph, next_lbl, sp, lenv, carry, mem, inds, trace) 117 117 118 let curr_ind : indexing list > indexing = function 119  ind :: _ > ind 120  _ > assert false (* indexing list must be nonempty *) 121 122 let forget_ind : indexing list > indexing list = function 123  _ :: tail > tail 124  _ > assert false (* indexing list must be nonempty *) 125 126 let max_depth graph = 127 let f_stmt _ = function 128  RTL.St_ind_0(i,_)  RTL.St_ind_inc(i,_) > max (i + 1) 129  _ > fun x > x in 130 Label.Map.fold f_stmt graph 0 118 let curr_ind = CostLabel.curr_const_ind 119 120 let forget_ind = CostLabel.forget_const_ind 121 122 let new_ind = CostLabel.new_const_ind 131 123 132 124 … … 149 141 150 142  RTL.St_cost (cost_lbl, lbl) > 151 let cost_lbl = CostLabel. apply_const_indexing (curr_ind inds) cost_lbl in143 let cost_lbl = CostLabel.ev_indexing (curr_ind inds) cost_lbl in 152 144 State (sfrs, graph, lbl, sp, lenv, carry, mem, inds, cost_lbl :: trace) 153 145 154 146  RTL.St_ind_0 (i, lbl) > 155 CostLabel.enter_loop (Some i) (curr_ind inds);147 CostLabel.enter_loop inds i; 156 148 State (sfrs, graph, lbl, sp, lenv, carry, mem, inds, trace) 157 149 158 150  RTL.St_ind_inc (i, lbl) > 159 CostLabel.continue_loop (Some i) (curr_ind inds);151 CostLabel.continue_loop inds i; 160 152 State (sfrs, graph, lbl, sp, lenv, carry, mem, inds, trace) 161 153 … … 275 267 match f_def with 276 268  RTL.F_int def > 277 let ind = Array.make (max_depth def.RTL.f_graph) 0in269 let inds = new_ind inds in 278 270 let (mem', sp) = Mem.alloc mem def.RTL.f_stacksize in 279 271 State (sfrs, def.RTL.f_graph, def.RTL.f_entry, sp, 280 272 init_locals def.RTL.f_locals def.RTL.f_params args, 281 Val.undef, mem', ind ::inds, trace)273 Val.undef, mem', inds, trace) 282 274  RTL.F_ext def > 283 275 let (mem', vs) = interpret_external mem def.AST.ef_tag args in
Note: See TracChangeset
for help on using the changeset viewer.