Skip to content

Commit

Permalink
[Fix] seq bug (again) : memoization bug (depth kept used the already
Browse files Browse the repository at this point in the history
generated surf when it was wrong)
  • Loading branch information
remyzorg committed Jul 16, 2015
1 parent e64f547 commit d25cb73
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/basic_mouse_loc/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let%sync m =
input btn_up;
input move;
input ex1;
input ex;

loop begin
present btn_up (
Expand Down
Binary file added generated_trees/test_ppx_m_fg.pdf
Binary file not shown.
Binary file added generated_trees/test_ppx_m_interfg.pdf
Binary file not shown.
Binary file added generated_trees/test_ppx_m_interfg2.pdf
Binary file not shown.
22 changes: 10 additions & 12 deletions src/preproc/grc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,7 @@ module Of_ast = struct

type flow_builder = env -> Tagged.t -> Flowgraph.t -> Flowgraph.t -> Flowgraph.t

let memo_rec :
(int, Flowgraph.t) Hashtbl.t ->
(flow_builder -> flow_builder) ->
flow_builder =
let memo_rec =
fun h f ->
let open Tagged in
let rec g env x p e =
Expand Down Expand Up @@ -329,11 +326,12 @@ module Of_ast = struct
@@ exit_node p endp

| Seq (q,r) ->
enter_node p @@
if env.under_suspend || Ast.Analysis.blocking q then
surface env q pause endp
else
surface env q pause @@ surface env r pause endp

let surf_r = (surface env r pause @@ exit_node p endp) in
Hashtbl.remove h r.id;
enter_node p
@@ surface env q pause
@@ surf_r

| Present (s, q, r) ->
let end_pres = exit_node p endp in
Expand Down Expand Up @@ -684,12 +682,12 @@ module Schedule = struct



(* | Finish, fg2 -> Finish *)
(* | Pause, fg2 -> Pause *)
(* | Finish, fg2 -> fg2 *)
(* | Pause, fg2 -> fg2 *)

| (Finish | Pause), fg
| fg, (Finish | Pause) ->
error ~loc:Ast.dummy_loc (Par_leads_to_finish fg1)
error ~loc:Ast.dummy_loc (Par_leads_to_finish fg2)

| Test (Signal s, t1, t2), fg2 ->
if emits fg2 stop s then
Expand Down
24 changes: 13 additions & 11 deletions tests/ppx/test_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,24 @@ let%sync_ast evenodd =
pause
end

let%to_dot_grc loop_pause_atom = (* Bad grc generation : loop that doesn't loop *)
input click;
input move;
loop begin
pause;
atom (Format.printf "step@\n");
end

let%to_dot_grc m = (* Grc.Error (_, _) *)
input btn_up;
input move;
input ex;

trap ex begin
loop begin
present btn_up (atom ())
end
||
loop begin
present ex (exit ex);
pause
end
end;
atom ()
trap t (
loop (
present ex (exit t);
pause))
; atom (ignore 2)


let par_deps ctx = assert_equal
Expand Down

0 comments on commit d25cb73

Please sign in to comment.