From eab699824a21359b16b59ec7ce954e9aade72434 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Mon, 3 Nov 2008 09:52:33 +0100
Subject: [PATCH] Fix a bug in Split where static recursive node and array
 construction (Hat) were handled incorrectly.

---
 src/getEff.ml         |  2 +-
 src/split.ml          | 22 +++++------
 src/test/test.res.exp | 92 +++++++++++++++++++------------------------
 3 files changed, 53 insertions(+), 63 deletions(-)

diff --git a/src/getEff.ml b/src/getEff.ml
index 9a762767..9b89217a 100644
--- a/src/getEff.ml
+++ b/src/getEff.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 24/10/2008 (at 11:00) by Erwan Jahier> *)
+(** Time-stamp: <modified the 31/10/2008 (at 17:05) by Erwan Jahier> *)
 
 
 open Lxm
diff --git a/src/split.ml b/src/split.ml
index 0febfedb..655b35d1 100644
--- a/src/split.ml
+++ b/src/split.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 11/09/2008 (at 16:18) by Erwan Jahier> *)
+(** Time-stamp: <modified the 03/11/2008 (at 09:50) by Erwan Jahier> *)
 
 
 open Lxm
@@ -143,35 +143,35 @@ and (split_val_exp : bool -> Eff.val_exp -> Eff.val_exp * split_acc) =
       | CallByPosEff(by_pos_op_eff, OperEff vel) ->
           (* recursively split the arguments *) 
           let lxm = by_pos_op_eff.src in
-          let (rhs, vel, (eql,vl)) =
+          let (rhs, (eql,vl)) =
             match by_pos_op_eff.it with 
-                (* for with and hat, a particuliar treatment is done because
-                   a val_exp is attached to them *)
-              | Eff.WITH(ve) -> 
+                (* for WITH and HAT, a particular treatment is done because
+                   the val_exp is attached to them *)
+              | Eff.WITH(ve) ->
                   let ve, (eql, vl) = split_val_exp false ve in
                   let by_pos_op_eff = Lxm.flagit (Eff.WITH(ve)) lxm in
                   let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in
-                    rhs, [ve], (eql, vl)
+                    rhs, (eql, vl)
 
               | Eff.HAT(i,ve) ->
                   let ve, (eql, vl) = split_val_exp false ve in
                   let by_pos_op_eff = Lxm.flagit (Eff.HAT(i, ve)) lxm in
                   let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in
-                    rhs, [ve], (eql, vl)
+                    rhs, (eql, vl)
 
-              | Eff.WHEN ve ->
+              | Eff.WHEN ve -> (* should we create a var for the clock ? *)
                   let vel,(eql, vl) = split_val_exp_list false vel in
                   let by_pos_op_eff = Lxm.flagit (Eff.WHEN(ve)) lxm in
                   let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in
-                    rhs, vel, (eql, vl)
+                    rhs, (eql, vl)
                   
               | _ -> 
                   let vel, (eql, vl) = split_val_exp_list false vel in
                   let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in
-                    rhs, vel, (eql, vl)
+                    rhs, (eql, vl)
           in
             if top_level || by_pos_op_eff.it = TUPLE then 
-              CallByPosEff(by_pos_op_eff, OperEff vel), (eql, vl) 
+              rhs, (eql, vl) 
             else
               (* create the var for the current call *)
               let clk_l = EvalClock.get_val_exp_eff ve in
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index c5bd066a..6d42419f 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -7715,7 +7715,7 @@ node consensus::consensus_1(T:A_bool_1) returns (a:bool);
 var
    _v1:bool;
 let
-   a = T[0];
+   a = _v1;
    _v1 = T[0];
 tel
 -- end of node consensus::consensus_1
@@ -7726,7 +7726,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_1(T[1 .. 1]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 1];
    _v3 = consensus::consensus_1(_v2);
@@ -7740,7 +7740,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_2(T[1 .. 2]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 2];
    _v3 = consensus::consensus_2(_v2);
@@ -7754,7 +7754,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_3(T[1 .. 3]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 3];
    _v3 = consensus::consensus_3(_v2);
@@ -7773,7 +7773,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_4(T[1 .. 4]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 4];
    _v3 = consensus::consensus_4(_v2);
@@ -7787,7 +7787,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_5(T[1 .. 5]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 5];
    _v3 = consensus::consensus_5(_v2);
@@ -7801,7 +7801,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_6(T[1 .. 6]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 6];
    _v3 = consensus::consensus_6(_v2);
@@ -7815,7 +7815,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_7(T[1 .. 7]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 7];
    _v3 = consensus::consensus_7(_v2);
@@ -7829,7 +7829,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_8(T[1 .. 8]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 8];
    _v3 = consensus::consensus_8(_v2);
@@ -7843,7 +7843,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus::consensus_9(T[1 .. 9]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 9];
    _v3 = consensus::consensus_9(_v2);
@@ -7879,7 +7879,7 @@ node consensus2::consensus_1(T:A_bool_1) returns (a:bool);
 var
    _v1:bool;
 let
-   a = T[0];
+   a = _v1;
    _v1 = T[0];
 tel
 -- end of node consensus2::consensus_1
@@ -7890,7 +7890,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_1(T[1 .. 1]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 1];
    _v3 = consensus2::consensus_1(_v2);
@@ -7904,7 +7904,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_2(T[1 .. 2]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 2];
    _v3 = consensus2::consensus_2(_v2);
@@ -7918,7 +7918,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_3(T[1 .. 3]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 3];
    _v3 = consensus2::consensus_3(_v2);
@@ -7932,7 +7932,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_4(T[1 .. 4]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 4];
    _v3 = consensus2::consensus_4(_v2);
@@ -7946,7 +7946,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_5(T[1 .. 5]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 5];
    _v3 = consensus2::consensus_5(_v2);
@@ -7960,7 +7960,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_6(T[1 .. 6]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 6];
    _v3 = consensus2::consensus_6(_v2);
@@ -7974,7 +7974,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and consensus2::consensus_7(T[1 .. 7]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 7];
    _v3 = consensus2::consensus_7(_v2);
@@ -9670,7 +9670,7 @@ node t0::min_n_1(T:A_int_1) returns (mn:int);
 var
    _v1:int;
 let
-   mn = T[0];
+   mn = _v1;
    _v1 = T[0];
 tel
 -- end of node t0::min_n_1
@@ -9689,7 +9689,7 @@ var
    _v3:int;
    _v4:int;
 let
-   mn = t0::min(T[0], t0::min_n_1(T[1 .. 1]));
+   mn = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 1];
    _v3 = t0::min_n_1(_v2);
@@ -9703,7 +9703,7 @@ var
    _v3:int;
    _v4:int;
 let
-   mn = t0::min(T[0], t0::min_n_2(T[1 .. 2]));
+   mn = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 2];
    _v3 = t0::min_n_2(_v2);
@@ -9717,7 +9717,7 @@ var
    _v3:int;
    _v4:int;
 let
-   mn = t0::min(T[0], t0::min_n_3(T[1 .. 3]));
+   mn = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 3];
    _v3 = t0::min_n_3(_v2);
@@ -9748,7 +9748,7 @@ node t1::consensus_1(T:A_bool_1) returns (a:bool);
 var
    _v1:bool;
 let
-   a = T[0];
+   a = _v1;
    _v1 = T[0];
 tel
 -- end of node t1::consensus_1
@@ -9759,7 +9759,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and t1::consensus_1(T[1 .. 1]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 1];
    _v3 = t1::consensus_1(_v2);
@@ -9773,7 +9773,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and t1::consensus_2(T[1 .. 2]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 2];
    _v3 = t1::consensus_2(_v2);
@@ -9787,7 +9787,7 @@ var
    _v3:bool;
    _v4:bool;
 let
-   a = T[0] and t1::consensus_3(T[1 .. 3]);
+   a = _v4;
    _v1 = T[0];
    _v2 = T[1 .. 3];
    _v3 = t1::consensus_3(_v2);
@@ -9830,8 +9830,7 @@ var
    _v3:A_bool_1;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_1_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 1]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 1];
@@ -9850,8 +9849,7 @@ var
    _v3:A_bool_2;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_2_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 2]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 2];
@@ -9870,8 +9868,7 @@ var
    _v3:A_bool_3;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_3_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 3]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 3];
@@ -9890,8 +9887,7 @@ var
    _v3:A_bool_4;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_4_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 4]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 4];
@@ -9910,8 +9906,7 @@ var
    _v3:A_bool_5;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_5_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 5]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 5];
@@ -9950,8 +9945,7 @@ var
    _v3:A_bool_1;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_1_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 1]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 1];
@@ -9970,8 +9964,7 @@ var
    _v3:A_bool_2;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_2_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 2]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 2];
@@ -9990,8 +9983,7 @@ var
    _v3:A_bool_3;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_3_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 3]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 3];
@@ -10010,8 +10002,7 @@ var
    _v3:A_bool_4;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_4_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 4]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 4];
@@ -10030,8 +10021,7 @@ var
    _v3:A_bool_5;
    _v4:bool;
 let
-    c = t2::fold_left_bool_bool_5_Lustre::and(Lustre::and(a, X[0]), X[1 ..
-	 5]);
+   c = _v4;
    _v1 = X[0];
    _v2 = Lustre::and(a, _v1);
    _v3 = X[1 .. 5];
@@ -16162,7 +16152,7 @@ returns (
 var
    _v1:A_bool_20;
 let
-   matrice = true^20^10;
+   matrice = _v1^10;
    _v1 = true^20;
 tel
 -- end of node produitBool::produitBool
@@ -17127,7 +17117,7 @@ var
    _v1:_normal::T_InfoChgGlob;
 let
    TabInfoChgIndiv = normal::extract_tab_info_chg_indiv(EntreeGlob);
-   TabInfoChgGlob = normal::extract_info_chg_glob(EntreeGlob)^20;
+   TabInfoChgGlob = _v1^20;
    _v1 = normal::extract_info_chg_glob(EntreeGlob);
 tel
 -- end of node normal::extrCharge
@@ -17238,7 +17228,7 @@ var
    _v1:_normal::T_InfoGenGlob;
 let
    TabInfoGenIndiv = normal::extract_tab_info_gen_indiv(EntreeGlob);
-   TabInfoGenGlob = normal::extract_info_gen_glob(EntreeGlob)^4;
+   TabInfoGenGlob = _v1^4;
    _v1 = normal::extract_info_gen_glob(EntreeGlob);
    (bid, TabIndiceGen) = fill<<normal::incr_acc, 4>>(0);
 tel
@@ -17694,7 +17684,7 @@ var
    _v1:_testSilus::T_InfoChgGlob;
 let
    TabInfoChgIndiv = testSilus::extract_tab_info_chg_indiv(EntreeGlob);
-   TabInfoChgGlob = testSilus::extract_info_chg_glob(EntreeGlob)^20;
+   TabInfoChgGlob = _v1^20;
    _v1 = testSilus::extract_info_chg_glob(EntreeGlob);
 tel
 -- end of node testSilus::extrCharge
@@ -17800,7 +17790,7 @@ var
    _v1:_testSilus::T_InfoGenGlob;
 let
    TabInfoGenIndiv = testSilus::extract_tab_info_gen_indiv(EntreeGlob);
-   TabInfoGenGlob = testSilus::extract_info_gen_glob(EntreeGlob)^4;
+   TabInfoGenGlob = _v1^4;
    _v1 = testSilus::extract_info_gen_glob(EntreeGlob);
    (bidon, TabIndiceGen) = fill<<testSilus::incr_acc, 4>>(0);
 tel
-- 
GitLab