diff --git a/lib/l2lSplit.ml b/lib/l2lSplit.ml index 07f2869dc90f0ddba4576c0c1b058ae56d527fe6..ebae9082f93372338f7313c9be5ecf586c836a62 100644 --- a/lib/l2lSplit.ml +++ b/lib/l2lSplit.ml @@ -384,8 +384,9 @@ and (split_val_exp_list : LicPrg.t -> bool -> bool -> Lic.val_exp list -> and split_node (lic_prg:LicPrg.t) (opt:Lv6MainArgs.t) (n: Lic.node_exp) : Lic.node_exp = Lv6Verbose.exe ~flag:dbg (fun () -> + let no_prefix = Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix in Printf.eprintf "*** Splitting node %s\n" - (LicDump.string_of_node_key_iter false n.node_key_eff); + (LicDump.string_of_node_key_iter false no_prefix n.node_key_eff); flush stderr); let res = match n.def_eff with | ExternLic diff --git a/lib/lic2soc.ml b/lib/lic2soc.ml index 94c14b155ae9429eeba130a803a8c933e302485e..768ea518b97f0d463c2aa44e8f93179af4190033 100644 --- a/lib/lic2soc.ml +++ b/lib/lic2soc.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 28/11/2024 (at 11:29) by Erwan Jahier> *) +(** Time-stamp: <modified the 13/12/2024 (at 16:51) by Erwan Jahier> *) (* XXX ce module est mal écrit. A reprendre. (R1) *) @@ -863,14 +863,15 @@ let f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = let node = match LicPrg.find_node prog nk with | None -> + let no_prefix = Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix in prerr_string ( - "*** "^ (LicDump.string_of_node_key_rec false false nk) ^ + "*** "^ (LicDump.string_of_node_key_rec false no_prefix nk) ^ " not defined (as lic).\n" ^ "*** Defined nodes are:"^ (String.concat ",\n" (List.map (fun (nk,_) -> - "\""^LicDump.string_of_node_key_rec false false nk ^"\"") + "\""^LicDump.string_of_node_key_rec false no_prefix nk ^"\"") (LicPrg.list_nodes prog))) ); assert false diff --git a/lib/licDump.ml b/lib/licDump.ml index ef597cb8492b82b44475d31c4c9630f6b872f106..cba3a3c2f66b16752c60529008afaee1974514fe 100644 --- a/lib/licDump.ml +++ b/lib/licDump.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 12/12/2024 (at 16:47) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/01/2025 (at 10:58) by Erwan Jahier> *) (* This module is used both for @@ -75,17 +75,19 @@ let op2string op = let string_of_ident forprint x = - if global_opt.gen_lic then ( - try op2string (AstPredef.string_to_op (snd x)) - with Not_found -> Lv6Id.no_pack_string_of_long x - ) - else if global_opt.kcg then - Lv6Id.no_pack_string_of_long x - else - if global_opt.no_prefix - then Lv6Id.no_pack_string_of_long x - else Lv6Id.string_of_long forprint x - + let res = + if global_opt.gen_lic then ( + try op2string (AstPredef.string_to_op (snd x)) + with Not_found -> Lv6Id.no_pack_string_of_long x + ) + else if global_opt.kcg then + Lv6Id.no_pack_string_of_long x + else + if global_opt.no_prefix + then Lv6Id.no_pack_string_of_long x + else Lv6Id.string_of_long forprint x + in + res let (machine_int: string -> bool) = function | "int8" | "int16" | "int32" | "int64" -> true @@ -301,12 +303,12 @@ and string_of_node_key forprint = function | (ik, []) -> (string_of_ident forprint ik) | (ik, sargs) -> - let astrings = List.map (static_arg2string_bis forprint) sargs in - let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) - (String.concat "_" astrings) in - Printf.sprintf "%s" (FreshName.node_key (ik, sargs) name) - (* Printf.sprintf "%s<<%s>>" *) - (* (string_of_ident forprint ik) *) + let astrings = List.map (static_arg2string_bis forprint) sargs in + let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) + (String.concat "_" astrings) in + Printf.sprintf "%s" (FreshName.node_key (ik, sargs) name) +(* Printf.sprintf "%s<<%s>>" *) +(* (string_of_ident forprint ik) *) (* (String.concat ", " (List.map (string_of_static_arg forprint) sargs)) *) and string_of_static_arg forprint = function @@ -330,11 +332,15 @@ and string_of_type_matches forprint pm = and string_of_node_key_rec forprint (no_prefix:bool) (nkey: node_key) = match nkey with | (ik, []) -> - if global_opt.kcg || global_opt.gen_lic then - Lv6Id.no_pack_string_of_long ik - else if no_prefix - then Lv6Id.no_pack_string_of_long ik - else Lv6Id.string_of_long forprint ik + let str = (* similar to string_of_ident, but takes no_prefix into account *) + if global_opt.kcg || global_opt.gen_lic then + Lv6Id.no_pack_string_of_long ik + else + if no_prefix + then Lv6Id.no_pack_string_of_long ik + else Lv6Id.string_of_long forprint ik + in + str | (ik, salst) -> if global_opt.kcg then ((* recursive nodes have been unfold *) (*assert (List.mem ik ["map"]);*) @@ -363,19 +369,21 @@ and string_of_node_key_rec forprint (no_prefix:bool) (nkey: node_key) = ) else - string_of_node_key_name forprint nkey + string_of_node_key_name forprint no_prefix nkey -and string_of_node_key_name forprint (ik,sargs) = - let astrings = List.map (static_arg2string_bis forprint) sargs in - let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) - (String.concat "_" astrings) in - Printf.sprintf "%s" (FreshName.node_key (ik,sargs) name) +and string_of_node_key_name forprint no_prefix (ik,sargs) = + let astrings = List.map (static_arg2string_bis forprint) sargs in + let name = sprintf "%s_%s" + (string_of_node_key_rec forprint no_prefix (ik,[])) + (* (Lv6Id.no_pack_string_of_long ik) *) + (String.concat "_" astrings) in + Printf.sprintf "%s" (FreshName.node_key (ik,sargs) name) (* for printing iterators *) -and string_of_node_key_iter forprint (nkey: node_key) = +and string_of_node_key_iter forprint no_prefix (nkey: node_key) = match nkey with | (ik, []) -> dump_long forprint ik - | (_ik, _s_alst) -> string_of_node_key_name forprint nkey + | (_ik, _s_alst) -> string_of_node_key_name forprint no_prefix nkey (* pour ecrire UN NIVEAU d'arg statique (cf. LicMetaOp *) and string_of_node_key_def forprint (nkey: node_key) = match nkey with @@ -401,17 +409,6 @@ and static_arg2string_kcg forprint (sa : Lic.static_arg) = (* | NodeStaticArgLic (id, ((long, _sargs), _, _), _) -> *) | NodeStaticArgLic (_, (_long,_)) -> assert false (* should not occur *) - -(* for printing recursive node and iterators *) -and static_arg2string forprint (sa : Lic.static_arg) = - match sa with - | ConstStaticArgLic (_, ceff) -> sprintf "%s" (string_ident_of_const_eff forprint ceff) - | TypeStaticArgLic (_, teff) -> sprintf "%s" (string_of_type_eff forprint teff) - (* | NodeStaticArgLic (id, ((long,sargs), _, _), _) -> *) - | NodeStaticArgLic (_, (long,sargs)) -> - string_of_node_key_iter forprint (long,sargs) -(* sprintf "%s" (dump_long forprint long) *) - and static_arg2string_rec forprint (sa : Lic.static_arg) = match sa with | ConstStaticArgLic (_, ceff) -> sprintf "%s" (string_ident_of_const_eff forprint ceff) @@ -945,7 +942,7 @@ and node_of_node_exp_eff is_main_node forprint (neff: Lic.node_exp): string = ) ^ "\ntel\n-- end of node " ^ (string_of_node_key_rec forprint - (not global_opt.no_prefix) neff.node_key_eff) ^ "\n") + (global_opt.no_prefix) neff.node_key_eff) ^ "\n") ) ) @@ -1000,7 +997,7 @@ and string_of_clock (ck : Lic.clock) = Formatage standard des erreurs de compil ----------------------------------------------------------------------*) let node_error_string _lxm nkey = ( - Printf.sprintf "While checking %s" (string_of_node_key_iter false nkey) + Printf.sprintf "While checking %s" (string_of_node_key_iter false global_opt.no_prefix nkey) ) (*--------------------------------------------------------------------- diff --git a/lib/licPrg.ml b/lib/licPrg.ml index 7e09a05e58009ae3b86c58bfbacceb2b275ac930..7addc351d0b579c938b5bd3a5a0375b6a775380c 100644 --- a/lib/licPrg.ml +++ b/lib/licPrg.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 27/02/2024 (at 15:56) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/12/2024 (at 14:52) by Erwan Jahier> *) open Lv6MainArgs module ItemKeyMap = struct @@ -108,13 +108,13 @@ let add_const (k:Lic.item_key) (v:Lic.const) (prg:t) : t = let add_node (k:Lic.node_key) (v:Lic.node_exp) (prg:t) : t = Lv6Verbose.exe ~level:3 (fun () -> Printf.printf "## LicPrg.add_node %s\n" - (LicDump.string_of_node_key_rec false false k)); + (LicDump.string_of_node_key_rec false global_opt.no_prefix k)); { prg with nodes = NodeKeyMap.add k v prg.nodes } let del_node (k:Lic.node_key) (prg:t) : t = Lv6Verbose.exe ~level:3 (fun () -> Printf.printf "## LicPrg.del_node %s\n" - (LicDump.string_of_node_key_rec false false k)); + (LicDump.string_of_node_key_rec false global_opt.no_prefix k)); { prg with nodes = NodeKeyMap.remove k prg.nodes } diff --git a/lib/licTab.ml b/lib/licTab.ml index 415b01ace59045f45390707e8a9576c6eb3eb8ce..44e85906038fb1e5d3bf6a1d846a7c7b2a47bab1 100644 --- a/lib/licTab.ml +++ b/lib/licTab.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 23/01/2024 (at 17:11) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/12/2024 (at 14:56) by Erwan Jahier> *) open Lxm @@ -1380,8 +1380,9 @@ let compile_all_nodes pack_name this id ni_f = let sp = get_static_params ni_f in if sp <> [] then () (* we need static arg to compile such kind of things *) else + let no_prefix = Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix in compile_all_item this "node" node_check_interface - (LicDump.string_of_node_key_rec true false) + (LicDump.string_of_node_key_rec true no_prefix) Lic.profile_of_node_exp (fun id -> (Lv6Id.make_long pack_name id, [])) id ni_f @@ -1446,13 +1447,15 @@ let compile_all (this:t) : t = let msg = msg ^ "\n*****" ^ (String.concat "\n*****" stack) in raise (Compile_error (Lxm.dummy "", msg)) + let compile_node (this:t) (main_node:Lv6Id.idref) : t = (* la clée "absolue" du main node (pas d'args statiques) *) - let main_node_key = node_key_of_idref main_node in + let main_node_key = node_key_of_idref main_node in + let no_prefix = Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix in profile_info "LicTab.compile_node\n"; Lv6Verbose.printf "-- MAIN NODE: \"%s\"\n" - (LicDump.string_of_node_key_rec true false main_node_key); + (LicDump.string_of_node_key_rec true no_prefix main_node_key); let lxm = match Lv6Id.pack_of_idref main_node with | None -> Lxm.dummy "" diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 381e211053c6855f429dbea608de58400e6c692b..d71deee9ab62c2d85061bed4b450ee5ed7c8a9ee 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,6 +1,6 @@ -Linux malaval 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux +Linux malaval 6.8.0-51-generic #52~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Dec 9 15:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux ==> lus2lic0.sum <== -Test run by jahiere on Thu Nov 28 10:17:57 +Test run by jahiere on Tue Jan 14 10:52:46 Native configuration is x86_64-pc-linux-gnu === lus2lic0 tests === @@ -67,7 +67,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.1.sum <== -Test run by jahiere on Thu Nov 28 10:17:59 +Test run by jahiere on Tue Jan 14 10:52:47 Native configuration is x86_64-pc-linux-gnu === lus2lic1.1 tests === @@ -494,7 +494,7 @@ PASS: ../../../utils/compare_gcc_and_clang fresh_name.lus {} PASS: ../../../utils/compare_2ch_and_2cs fresh_name.lus {} ==> lus2lic1.2.sum <== -Test run by jahiere on Thu Nov 28 10:19:55 +Test run by jahiere on Tue Jan 14 11:03:42 Native configuration is x86_64-pc-linux-gnu === lus2lic1.2 tests === @@ -768,7 +768,7 @@ PASS: ../../../utils/compare_lv6_and_lv6_en multitask.lus { --expand-iterators - PASS: ../../../utils/compare_gcc_and_clang multitask.lus { --expand-iterators --do-not-expand-static-nodes --remove-nested-calls} ==> lus2lic1.4.sum <== -Test run by jahiere on Thu Nov 28 10:22:22 +Test run by jahiere on Tue Jan 14 11:15:08 Native configuration is x86_64-pc-linux-gnu === lus2lic1.4 tests === @@ -1169,7 +1169,7 @@ PASS: ../../../utils/compare_gcc_and_clang struct_with.lus {} PASS: ../../../utils/compare_2ch_and_2cs struct_with.lus {} ==> lus2lic1.3.sum <== -Test run by jahiere on Thu Nov 28 10:21:14 +Test run by jahiere on Tue Jan 14 11:10:27 Native configuration is x86_64-pc-linux-gnu === lus2lic1.3 tests === @@ -1427,7 +1427,7 @@ PASS: ../../../utils/compare_lv6_and_lv6_en zzz2.lus {} PASS: ../../../utils/compare_gcc_and_clang zzz2.lus {} ==> lus2lic2.1.sum <== -Test run by jahiere on Thu Nov 28 10:24:22 +Test run by jahiere on Tue Jan 14 11:25:27 Native configuration is x86_64-pc-linux-gnu === lus2lic2.1 tests === @@ -1878,7 +1878,7 @@ PASS: /local/jahiere/lus2lic/test/myec2c {-o func_with_body.c func_with_body.ec} ==> lus2lic2.2.sum <== -Test run by jahiere on Thu Nov 28 10:25:57 +Test run by jahiere on Tue Jan 14 11:36:01 Native configuration is x86_64-pc-linux-gnu === lus2lic2.2 tests === @@ -2192,7 +2192,7 @@ PASS: ../../../utils/check_knc multitask.lus { --expand-iterators --do-not-expan PASS: ../../../utils/compare_exec_and_2cmt multitask.lus { --expand-iterators --do-not-expand-static-nodes --remove-nested-calls} ==> lus2lic2.4.sum <== -Test run by jahiere on Thu Nov 28 10:27:36 +Test run by jahiere on Tue Jan 14 11:48:26 Native configuration is x86_64-pc-linux-gnu === lus2lic2.4 tests === @@ -2611,7 +2611,7 @@ PASS: ../../../utils/check_knc struct_with.lus {} PASS: ../../../utils/compare_exec_and_2cmt struct_with.lus {} ==> lus2lic2.3.sum <== -Test run by jahiere on Thu Nov 28 10:27:00 +Test run by jahiere on Tue Jan 14 11:42:51 Native configuration is x86_64-pc-linux-gnu === lus2lic2.3 tests === @@ -2956,15 +2956,15 @@ PASS: ../../../utils/compare_2ch_and_2cs zzz2.lus {} =============================== # Total number of failures: 26 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds -lus2lic1.1.log:testcase ./lus2lic.tests/test1_1.exp completed in 116 seconds -lus2lic1.2.log:testcase ./lus2lic.tests/test1_2.exp completed in 79 seconds -lus2lic1.3.log:testcase ./lus2lic.tests/test1_3.exp completed in 68 seconds -lus2lic1.4.log:testcase ./lus2lic.tests/test1_4.exp completed in 120 seconds -lus2lic2.1.log:testcase ./lus2lic.tests/test2_1.exp completed in 95 seconds -lus2lic2.2.log:testcase ./lus2lic.tests/test2_2.exp completed in 63 seconds -lus2lic2.3.log:testcase ./lus2lic.tests/test2_3.exp completed in 36 seconds -lus2lic2.4.log:testcase ./lus2lic.tests/test2_4.exp completed in 71 seconds +lus2lic1.1.log:testcase ./lus2lic.tests/test1_1.exp completed in 655 seconds +lus2lic1.2.log:testcase ./lus2lic.tests/test1_2.exp completed in 404 seconds +lus2lic1.3.log:testcase ./lus2lic.tests/test1_3.exp completed in 281 seconds +lus2lic1.4.log:testcase ./lus2lic.tests/test1_4.exp completed in 619 seconds +lus2lic2.1.log:testcase ./lus2lic.tests/test2_1.exp completed in 633 seconds +lus2lic2.2.log:testcase ./lus2lic.tests/test2_2.exp completed in 410 seconds +lus2lic2.3.log:testcase ./lus2lic.tests/test2_3.exp completed in 335 seconds +lus2lic2.4.log:testcase ./lus2lic.tests/test2_4.exp completed in 573 seconds * Ref time: -290.48user 164.25system 10:50.24elapsed 69%CPU (0avgtext+0avgdata 105764maxresident)k -0inputs+259232outputs (5major+51220284minor)pagefaults 0swaps +664.92user 564.87system 1:05:13elapsed 31%CPU (0avgtext+0avgdata 209652maxresident)k +201211424inputs+262176outputs (463major+225199025minor)pagefaults 0swaps * Quick time (-j 4):