X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/blobdiff_plain/b4c0bb4114cdbf12c85b793b158b638a8005992e..6a40cbf5959226bf1e6ec7bdb6c7e03253072c28:/rt/gc/cdgc/opts.d diff --git a/rt/gc/cdgc/opts.d b/rt/gc/cdgc/opts.d index 042cc01..dc2c8de 100644 --- a/rt/gc/cdgc/opts.d +++ b/rt/gc/cdgc/opts.d @@ -53,6 +53,7 @@ struct Options bool mem_stomp = false; bool conservative = false; bool fork = true; + bool eager_alloc = true; } package Options options; @@ -90,6 +91,8 @@ void process_option(char* opt_name, char* opt_value) options.conservative = parse_bool(opt_value); else if (cstr_eq(opt_name, "no_fork")) options.fork = !parse_bool(opt_value); + else if (cstr_eq(opt_name, "eager_alloc")) + options.eager_alloc = parse_bool(opt_value); } @@ -149,6 +152,7 @@ unittest assert (mem_stomp == false); assert (conservative == false); assert (fork == true); + assert (eager_alloc == true); } parse("mem_stomp"); with (options) { @@ -158,8 +162,9 @@ unittest assert (mem_stomp == true); assert (conservative == false); assert (fork == true); + assert (eager_alloc == true); } - parse("mem_stomp=0:verbose=2:conservative:no_fork=10"); + parse("mem_stomp=0:verbose=2:conservative:no_fork=10:eager_alloc=0"); with (options) { assert (verbose == 2); assert (log_file[0] == '\0'); @@ -167,6 +172,7 @@ unittest assert (mem_stomp == false); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } parse("log_file=12345 67890:verbose=1:sentinel=4:mem_stomp=1"); with (options) { @@ -176,6 +182,7 @@ unittest assert (mem_stomp == true); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } parse(null); with (options) { @@ -185,6 +192,7 @@ unittest assert (mem_stomp == true); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } parse(""); with (options) { @@ -194,6 +202,7 @@ unittest assert (mem_stomp == true); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } parse(":"); with (options) { @@ -203,6 +212,7 @@ unittest assert (mem_stomp == true); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } parse("::::"); with (options) { @@ -212,6 +222,7 @@ unittest assert (mem_stomp == true); assert (conservative == true); assert (fork == false); + assert (eager_alloc == false); } }