summaryrefslogtreecommitdiff
path: root/src/lem_interp/interp_inter_imp.lem
diff options
context:
space:
mode:
authorKathy Gray2014-10-07 15:15:32 +0100
committerKathy Gray2014-10-07 15:15:32 +0100
commit9800a6b05d5a2edc9fc62afdbc127643650666ff (patch)
tree8d6ceffbaca038ce384dab82b56016afc2da348a /src/lem_interp/interp_inter_imp.lem
parentfc6c694210a35c121822cbfd6a8a60501f728309 (diff)
Track dependencies on size of memory access
Diffstat (limited to 'src/lem_interp/interp_inter_imp.lem')
-rw-r--r--src/lem_interp/interp_inter_imp.lem42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/lem_interp/interp_inter_imp.lem b/src/lem_interp/interp_inter_imp.lem
index 27e5e17c..c18f07f7 100644
--- a/src/lem_interp/interp_inter_imp.lem
+++ b/src/lem_interp/interp_inter_imp.lem
@@ -81,14 +81,52 @@ let memory_functions =
match length with
| Interp.V_lit (L_aux (L_num len) _) ->
let (v,regs) = extern_value mode true location in
- (v,len,regs) end end)));
+ (v,len,regs)
+ | Interp.V_track (Interp.V_lit (L_aux (L_num len) _)) size_regs ->
+ let (v,loc_regs) = extern_value mode true location in
+ match loc_regs with
+ | Nothing -> (v,len,Just (List.map (fun r -> extern_reg r Nothing) size_regs))
+ | Just loc_regs -> (v,len,Just (loc_regs++(List.map (fun r -> extern_reg r Nothing) size_regs)))
+ end end end)));
+ ("MEMr_reserve", (Just(Read_reserve),Nothing,
+ (fun mode v -> match v with
+ | Interp.V_tuple [location;length] ->
+ match length with
+ | Interp.V_lit (L_aux (L_num len) _) ->
+ let (v,regs) = extern_value mode true location in
+ (v,len,regs)
+ | Interp.V_track (Interp.V_lit (L_aux (L_num len) _)) size_regs ->
+ let (v,loc_regs) = extern_value mode true location in
+ match loc_regs with
+ | Nothing -> (v,len,Just (List.map (fun r -> extern_reg r Nothing) size_regs))
+ | Just loc_regs -> (v,len,Just (loc_regs++(List.map (fun r -> extern_reg r Nothing) size_regs)))
+ end end end)));
("MEMw", (Nothing, Just(Write_plain),
(fun mode v -> match v with
| Interp.V_tuple [location;length] ->
match length with
| Interp.V_lit (L_aux (L_num len) _) ->
let (v,regs) = extern_value mode true location in
- (v,len,regs) end end)));
+ (v,len,regs)
+ | Interp.V_track (Interp.V_lit (L_aux (L_num len) _)) size_regs ->
+ let (v,loc_regs) = extern_value mode true location in
+ match loc_regs with
+ | Nothing -> (v,len,Just (List.map (fun r -> extern_reg r Nothing) size_regs))
+ | Just loc_regs -> (v,len,Just (loc_regs++(List.map (fun r -> extern_reg r Nothing) size_regs)))
+ end end end)));
+ ("MEMw_conditional", (Nothing, Just(Write_conditional),
+ (fun mode v -> match v with
+ | Interp.V_tuple [location;length] ->
+ match length with
+ | Interp.V_lit (L_aux (L_num len) _) ->
+ let (v,regs) = extern_value mode true location in
+ (v,len,regs)
+ | Interp.V_track (Interp.V_lit (L_aux (L_num len) _)) size_regs ->
+ let (v,loc_regs) = extern_value mode true location in
+ match loc_regs with
+ | Nothing -> (v,len,Just (List.map (fun r -> extern_reg r Nothing) size_regs))
+ | Just loc_regs -> (v,len,Just (loc_regs++(List.map (fun r -> extern_reg r Nothing) size_regs)))
+ end end end)));
]
let rec interp_to_value_helper arg thunk =