Generate calls to async stub (with a dummy _async)

async
jeltz 4 years ago
parent 9687050f25
commit 2bd04ed02d
Signed by: jeltz
GPG Key ID: 800882B66C0C3326

@ -473,7 +473,7 @@ let out_var_name_of_objn o =
(** Creates the list of arguments to call a node. [targeting] is the targeting
of the called node, [mem] represents the node context and [args] the
argument list.*)
let step_fun_call vr var_env sig_info objn out args =
let step_fun_call vr var_env sig_info objn out args async =
let rec add_targeting l ads = match l, ads with
| [], [] -> []
| e::l, ad::ads ->
@ -496,9 +496,13 @@ let step_fun_call vr var_env sig_info objn out args =
in
mk_idx l
) in
args@[Caddrof out; Caddrof mem]
match async with
| Some async -> args @ [Caddrof out; Caddrof async]
| None -> args @ [Caddrof out; Caddrof mem]
) else
args@[Caddrof out]
match async with
| Some async -> args @ [Caddrof out; Caddrof async]
| None -> args @ [Caddrof out]
(** Generate the statement to call [objn].
[outvl] is a list of lhs where to put the results.
@ -516,18 +520,21 @@ let generate_function_call vr var_env obj_env outvl objn args =
if is_op classln then
cop_of_op_aux classln args
else
let async = match od.o_ack with
| Some _ -> Some (Cvar "GlobalValueToChange")
| None -> None
in
(* The step function takes scalar arguments and its own internal
memory holding structure. *)
let args =
step_fun_call vr var_env sig_info objn out args
step_fun_call vr var_env sig_info objn out args async
in
(* Our C expression for the function call. *)
Cfun_call (classn ^ "_step", args)
(* TODO(Arduino):
1. pack arguments in local variable
2. "send" arguments to global variable
3. "retrieve" outputs from global variable
*)
let suffix = match od.o_ack with
| Some _ -> "_step_async_stub"
| None -> "_step"
in
Cfun_call (classn ^ suffix, args)
in
(* Act according to the length of our list. Step functions with
@ -671,8 +678,6 @@ let rec cstm_of_act vr var_env obj_env act =
local structure to hold the results, before allocating to our
variables. *)
| Acall (outvl, objn, Mstep, el) ->
(* 1. Atomic copy of the inputs *)
(* 2. Atomic copy of the outputs *)
let args = cexprs_of_exps vr var_env el in
let outvl = clhs_list_of_pattern_list vr var_env outvl in
generate_function_call vr var_env obj_env outvl objn args

Loading…
Cancel
Save