From 5f3d50f1d6bf7b5c27c600ad97e10b4805be6878 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Fri, 13 Feb 2015 17:46:48 +0100 Subject: [PATCH] --2c--stack: fix a bug in code generated for array concat. Now all the tests that were ok in the heap mode are also ok in the stack mode ! However the code generated for programs that use fillred and co is weird. For instance, in should_work.pipeline.lus, in fillred_oneStep_pipe_10_step, accu_in is used both as an input and an output, which seems wrong in the stack mode as no copy is performed. Is it working by chance ? --- src/lv6MainArgs.ml | 4 ++-- src/socPredef2cHeap.ml | 4 ++-- src/socPredef2cStack.ml | 6 +++--- test/lus2lic.sum | 26 ++++++++++++++------------ test/lus2lic.time | 16 +++++++++------- test/should_work/array_concat.lus | 4 ++-- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml index 583b83fb..16a64dc5 100644 --- a/src/lv6MainArgs.ml +++ b/src/lv6MainArgs.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/02/2015 (at 15:50) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2015 (at 17:04) by Erwan Jahier> *) (* Le manager d'argument adapté de celui de lutin, plus joli N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global, @@ -71,7 +71,7 @@ let (global_opt:global_opt) = current_file = ""; expand_enums = AsInt; soc2c_no_switch = false; - io_transmit_mode = Heap; + io_transmit_mode = Stack; } let (make_opt : unit -> t) = fun () -> diff --git a/src/socPredef2cHeap.ml b/src/socPredef2cHeap.ml index 2bcbd65e..a1549a53 100644 --- a/src/socPredef2cHeap.ml +++ b/src/socPredef2cHeap.ml @@ -1,5 +1,5 @@ -(* Time-stamp: <modified the 13/02/2015 (at 16:09) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2015 (at 17:24) by Erwan Jahier> *) open Data open Soc @@ -85,7 +85,7 @@ let (lustre_concat: Soc.key -> string) = and t2_type = Soc2cUtil.data_type_to_c (Data.Array(t,s2)) "" in (Printf.sprintf " memcpy(&%s, &%s, sizeof(%s));\n" t12 t1 t1_type)^ - (Printf.sprintf " memcpy(&%s[%d], &%s, sizeof(%s));\n" t12 s1 t2 t2_type) + (Printf.sprintf " memcpy(&%s+%d, &%s, sizeof(%s));\n" t12 s1 t2 t2_type) (* Both seems to work *) (* let buff = ref "" in *) (* for j=0 to s1-1 do *) diff --git a/src/socPredef2cStack.ml b/src/socPredef2cStack.ml index d3c2569a..8e3c856c 100644 --- a/src/socPredef2cStack.ml +++ b/src/socPredef2cStack.ml @@ -1,5 +1,5 @@ -(* Time-stamp: <modified the 13/02/2015 (at 16:10) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/02/2015 (at 17:24) by Erwan Jahier> *) open Data open Soc @@ -83,8 +83,8 @@ let (lustre_concat: Soc.key -> string) = and t1_type = Soc2cUtil.data_type_to_c (Data.Array(t,s1)) "" and t2_type = Soc2cUtil.data_type_to_c (Data.Array(t,s2)) "" in - (Printf.sprintf " memcpy(%s, &%s, sizeof(%s));\n" t12 t1 t1_type)^ - (Printf.sprintf " memcpy(%s[%d], &%s, sizeof(%s));\n" t12 s1 t2 t2_type) + (Printf.sprintf " memcpy(%s, %s, sizeof(%s));\n" t12 t1 t1_type)^ + (Printf.sprintf " memcpy(%s+%d, %s, sizeof(%s));\n" t12 s1 t2 t2_type) (* Both seems to work *) (* let buff = ref "" in *) (* for j=0 to s1-1 do *) diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 4417d58c..d8fb9eba 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,5 +1,5 @@ ==> lus2lic0.sum <== -Test Run By jahier on Fri Feb 13 16:11:32 +Test Run By jahier on Fri Feb 13 17:28:15 Native configuration is x86_64-unknown-linux-gnu === lus2lic0 tests === @@ -63,7 +63,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus ==> lus2lic1.sum <== -Test Run By jahier on Fri Feb 13 16:11:34 +Test Run By jahier on Fri Feb 13 17:28:22 Native configuration is x86_64-unknown-linux-gnu === lus2lic1 tests === @@ -397,7 +397,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} ==> lus2lic2.sum <== -Test Run By jahier on Fri Feb 13 16:11:26 +Test Run By jahier on Fri Feb 13 17:29:49 Native configuration is x86_64-unknown-linux-gnu === lus2lic2 tests === @@ -727,7 +727,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} ==> lus2lic3.sum <== -Test Run By jahier on Fri Feb 13 16:11:30 +Test Run By jahier on Fri Feb 13 17:30:51 Native configuration is x86_64-unknown-linux-gnu === lus2lic3 tests === @@ -1230,7 +1230,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ==> lus2lic4.sum <== -Test Run By jahier on Fri Feb 13 16:11:28 +Test Run By jahier on Fri Feb 13 17:31:28 Native configuration is x86_64-unknown-linux-gnu === lus2lic4 tests === @@ -1726,12 +1726,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} # of unexpected failures 3 =============================== # Total number of failures: 14 -lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 7 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 53 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 77 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 57 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 90 seconds +lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 6 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 36 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 62 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 37 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 71 seconds * Ref time: +0.07user 0.02system 4:23.87elapsed 0%CPU (0avgtext+0avgdata 5132maxresident)k +160inputs+0outputs (0major+5542minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.01system 1:32.86elapsed 0%CPU (0avgtext+0avgdata 5080maxresident)k -160inputs+0outputs (0major+5541minor)pagefaults 0swaps +0.04user 0.02system 1:24.98elapsed 0%CPU (0avgtext+0avgdata 5116maxresident)k +160inputs+0outputs (0major+5581minor)pagefaults 0swaps diff --git a/test/lus2lic.time b/test/lus2lic.time index 52f0b050..728e2238 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,9 +1,11 @@ -lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 7 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 53 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 77 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 57 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 90 seconds +lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 6 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 36 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 62 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 37 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 71 seconds * Ref time: +0.07user 0.02system 4:23.87elapsed 0%CPU (0avgtext+0avgdata 5132maxresident)k +160inputs+0outputs (0major+5542minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.01system 1:32.86elapsed 0%CPU (0avgtext+0avgdata 5080maxresident)k -160inputs+0outputs (0major+5541minor)pagefaults 0swaps +0.04user 0.02system 1:24.98elapsed 0%CPU (0avgtext+0avgdata 5116maxresident)k +160inputs+0outputs (0major+5581minor)pagefaults 0swaps diff --git a/test/should_work/array_concat.lus b/test/should_work/array_concat.lus index 4ebaf3c4..ba201957 100644 --- a/test/should_work/array_concat.lus +++ b/test/should_work/array_concat.lus @@ -1,8 +1,8 @@ -node array_concat(x:bool) returns (y: bool^2); +function array_concat(x:bool) returns (y: bool^2); let y = [x]|[x]; tel -node array_concat_bis(x:bool^1) returns (y: bool^2); +function array_concat_bis(x:bool^1) returns (y: bool^2); let y = x|x; tel -- GitLab