Skip to content

Commit 7363dc6

Browse files
toC, pipeline merge
2 parents 57aa77d + bc92124 commit 7363dc6

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

lib/pipeline.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,12 @@ let build_run_bench ~log_dir ~file ~mode_str ~itr ~mutants_length ~config =
360360
close_out oc;
361361
(* .c 生成 *)
362362
let oc = open_out (asprintf "%s/bench/%s%s.c" log_dir file mode_str) in
363-
Printf.fprintf oc "%s\n%s\n%s\n%s"
364-
(asprintf "#include <stdio.h>\n#include <sys/time.h>\n#include <sys/resource.h>\n#include \"../../../libC/types.h\"\n#include \"../../../benchC/bench_json.h\"\n#include \"%s%s_mutants.h\"\n#ifdef HASH\n#include \"../../../libC/crc.h\"\n#endif\n" file mode_str)
363+
Printf.fprintf oc "%s\n%s\n%s\n%s\n%s"
364+
(asprintf "#include <stdio.h>\n#include <gc.h>\n#include <sys/time.h>\n#include <sys/resource.h>\n#include \"../../../libC/types.h\"\n#include \"../../../benchC/bench_json.h\"\n#include \"%s%s_mutants.h\"\n#ifdef HASH\n#include \"../../../libC/crc.h\"\n#endif\n" file mode_str)
365+
"#define GC_INITIAL_HEAP_SIZE 1048576\n"
365366
(asprintf "#define MUTANTS_LENGTH %d\n#define ITR %d\n" mutants_length itr)
366367
"#ifndef STATIC\nrange *range_list;\n#endif\nstatic double times[MUTANTS_LENGTH][ITR];\nint i;\nstruct rusage start_usage, end_usage;\n"
367-
"int main(){\n";
368+
"int main(){\nGC_INIT();\n";
368369
let rec print_itr n =
369370
if n = mutants_length + 1 then ()
370371
else begin
@@ -381,7 +382,7 @@ let build_run_bench ~log_dir ~file ~mode_str ~itr ~mutants_length ~config =
381382
(asprintf "#include <stdio.h>\n#include <gc.h>\n#include \"../../../libC/types.h\"\n#include \"../../../benchC/bench_json.h\"\n#include \"%s%s_mutants.h\"\n#ifdef HASH\n#include \"../../../libC/crc.h\"\n#endif\n" file mode_str)
382383
(asprintf "#define MUTANTS_LENGTH %d\n" mutants_length)
383384
"#ifndef STATIC\nrange *range_list;\n#endif\nstatic int gc_counts[MUTANTS_LENGTH], cast_counts[MUTANTS_LENGTH], inference_counts[MUTANTS_LENGTH], longest[MUTANTS_LENGTH];\nint i;\nint gc_num, gc_tmp, current_cast, current_inference, current_longest;\n"
384-
"int main(){\n";
385+
"int main(){\nGC_INIT();\n";
385386
let rec print_itr n =
386387
if n = mutants_length + 1 then ()
387388
else begin

lib/toC.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,15 +695,16 @@ let toC_program ?(bench=0) ~config ppf (Prog (toplevel, f)) =
695695
let ranges = RangeManager.get_definitions () in
696696
let crcs = CrcManager.get_definitions () in
697697
let init_crcs = if !is_static then "" else "#ifdef HASH\ninit_crcs();\n#endif\n" in
698-
fprintf ppf "%s\n%a%a%a%a%s%s%s%a%s"
698+
fprintf ppf "%s\n%s\n%a%a%a%a%s%s%s%a%s"
699699
(asprintf "#include <gc.h>\n#include \"../%slibC/runtime.h\"\n"
700700
(if bench = 0 then "" else "../../"))
701+
(if bench = 0 then "#define GC_INITIAL_HEAP_SIZE 1048576\n" else "")
701702
toC_tys tys
702703
toC_ranges ranges
703704
toC_crcs crcs
704705
toC_fundefs toplevel
705706
(if bench = 0 && not !is_static then "range *range_list;\n\n" else "")
706-
(if bench = 0 then asprintf "int main() {\n%s" init_crcs else asprintf "int mutant%d() {\n%s" bench init_crcs)
707+
(if bench = 0 then asprintf "int main() {\nGC_INIT();\n%s" init_crcs else asprintf "int mutant%d() {\n%s" bench init_crcs)
707708
(if List.length ranges != 0 then "range_list = local_range_list;\n" else "")
708709
toC_exp f
709710
"}"

libC/types.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ typedef enum ground_ty : uint8_t {
3030

3131
typedef struct ty ty;
3232

33-
typedef intptr_t dyn;
34-
35-
#ifndef CAST
36-
typedef struct v_d v_d;
37-
#endif //CAST
38-
3933
#endif //not STATIC
4034

4135
typedef intptr_t value;

0 commit comments

Comments
 (0)