Project

General

Profile

« Previous | Next » 

Revision 5538b7ac

Added by Xavier Thirioux about 11 years ago

Added declaration/definition of stateless/stateful nodes.
The 'function' keyword is for stateless nodes only,
the 'node' keyword is any kind of node.
Improves compilation and paves the way for more optimizations.

View differences:

src/machine_code.ml
124 124
    (Utils.fprintf_list ~sep:"@ " pp_instr) m.minit
125 125
    pp_step m.mstep
126 126

  
127
(* Returns the declared stateless status and the computed one. *)
128
let get_stateless_status m =
129
 (m.mname.node_dec_stateless, Utils.desome m.mname.node_stateless)
130

  
127 131
let is_output m id =
128 132
  List.exists (fun o -> o.var_id = id.var_id) m.mstep.step_outputs
129 133

  
......
200 204
  fun caller callee tag ->
201 205
    begin
202 206
      let o =
203
	if Corelang.check_stateless_node callee then
207
	if Stateless.check_node callee then
204 208
	  node_name callee
205 209
	else
206 210
	  Printf.sprintf "ni_%d" (incr cpt; !cpt) in
......
364 368
      NodeDep.filter_static_inputs (node_inputs node_f) el in 
365 369
    let o = new_instance node node_f eq.eq_rhs.expr_tag in
366 370
    (m,
367
     (if check_stateless_node node_f then si else MReset o :: si),
371
     (if Stateless.check_node node_f then si else MReset o :: si),
368 372
     (if Basic_library.is_internal_fun f then j else Utils.IMap.add o call_f j),
369 373
     d,
370 374
     reset_instance node args o r eq.eq_rhs.expr_clock @
......
436 440
    mname = nd;
437 441
    mmemory = ISet.elements m;
438 442
    mcalls = mmap;
439
    minstances = List.filter (fun (_, (n,_)) -> not (check_stateless_node n)) mmap;
443
    minstances = List.filter (fun (_, (n,_)) -> not (Stateless.check_node n)) mmap;
440 444
    minit = init;
441 445
    mstatic = List.filter (fun v -> v.var_dec_const) nd.node_inputs;
442 446
    mstep = {
......
461 465
let translate_prog decls = 
462 466
  let nodes = get_nodes decls in 
463 467
   (* What to do with Imported/Sensor/Actuators ? *)
464
   arrow_machine ::  List.map translate_decl nodes
468
   (*arrow_machine ::*)  List.map translate_decl nodes
465 469

  
466 470
let get_machine_opt name machines =  
467 471
  List.fold_left 

Also available in: Unified diff