Project

General

Profile

Revision 8f89eba8 src/causality.ml

View differences:

src/causality.ml
379 379

  
380 380
end
381 381

  
382
(* Module used to compute static disjunction of variables based upon their clocks. *)
383
module Disjunction =
384
struct
385
  (* map: var |-> list of disjoint vars, sorted in increasing branch length,
386
     maybe removing shorter branches *)
387
  type clock_map = (ident, ident list) Hashtbl.t
388

  
389
  let rec add_vdecl map vdecls =
390
    match vdecls with
391
    | []         -> ()
392
    | vdecl :: q -> begin
393
		      Hashtbl.add map vdecl.var_id (List.fold_left (fun r v -> if Clocks.disjoint v.var_clock vdecl.var_clock then v::r else r) [] q);
394
                      add_vdecl map q
395
		    end
396

  
397
  let build_clock_map vdecls =
398
    let root_branch vdecl = Clocks.root vdecl.var_clock, Clocks.branch vdecl.var_clock in
399
    let map = Hashtbl.create 23 in
400
    begin
401
      add_vdecl map (List.sort (fun v1 v2 -> compare (root_branch v1) (root_branch v2)) vdecls);
402
      map
403
    end
404
end
405

  
382 406
let pp_dep_graph fmt g =
383 407
  begin
384 408
    Format.fprintf fmt "{ /* graph */@.";

Also available in: Unified diff