- Timestamp:
- Oct 11, 2011, 5:42:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051-indexed-labels-branch/src/LIN/LINInterpret.ml
r1349 r1357 48 48 let change_trace st trace = { st with trace = trace } 49 49 let add_trace st cost_lbl = change_trace st (cost_lbl :: st.trace) 50 51 let forget_ind st = match st.inds with 52 | _ :: tail -> {st with inds = tail} 53 | _ -> assert false (* indexing list must be non-empty *) 54 let curr_ind st = match st.inds with 55 | ind :: _ -> ind 56 | _ -> assert false (* indexing list must be non-empty *) 57 let allocate_ind st n = { st with inds = Array.make n 0 :: st.inds } 58 59 let max_depth = 60 let f_stmt j = function 61 | LIN.St_ind_0 i | LIN.St_ind_inc i -> max (i + 1) j 62 | _ -> j in 63 List.fold_left f_stmt 0 50 let ev_label st = CostLabel.ev_indexing (CostLabel.curr_const_ind st.inds) 51 let new_ind st = { st with inds = CostLabel.new_const_ind st.inds } 52 let forget_ind st = { st with inds = CostLabel.forget_const_ind st.inds } 53 let enter_loop st = CostLabel.enter_loop st.inds 54 let continue_loop st = CostLabel.continue_loop st.inds 64 55 65 56 let empty_state = … … 91 82 92 83 let init_fun_call st ptr def = 93 let st = allocate_ind st (max_depth def)in84 let st = new_ind st in 94 85 change_pc st (Val.change_address_offset ptr Val.Offset.zero) 95 86 … … 217 208 218 209 | LIN.St_cost cost_lbl -> 219 let cost_lbl = CostLabel.apply_const_indexing (curr_ind st)cost_lbl in210 let cost_lbl = ev_label st cost_lbl in 220 211 let st = add_trace st cost_lbl in 221 212 next_pc st 222 213 223 214 | LIN.St_ind_0 i -> 224 CostLabel.enter_loop (Some i) (curr_ind st);215 enter_loop st i; 225 216 next_pc st 226 217 227 218 | LIN.St_ind_inc i -> 228 CostLabel.continue_loop (Some i) (curr_ind st);219 continue_loop st i; 229 220 next_pc st 230 221
Note: See TracChangeset
for help on using the changeset viewer.