vere: adds --auto-meld for play subcommand

This commit is contained in:
Joe Bryan 2022-12-14 18:30:09 -05:00
parent 3843c6090f
commit a7880717e3
3 changed files with 26 additions and 15 deletions

View File

@ -1788,9 +1788,11 @@ _cw_play(c3_i argc, c3_c* argv[])
c3_i ch_i, lid_i;
c3_w arg_w;
c3_o ful_o = c3n;
c3_o mel_o = c3n;
static struct option lop_u[] = {
{ "loom", required_argument, NULL, c3__loom },
{ "auto-meld", no_argument, NULL, 4 },
{ "no-demand", no_argument, NULL, 6 },
{ "full", required_argument, NULL, 'f' },
{ "replay-to", no_argument, NULL, 'n' },
@ -1801,6 +1803,10 @@ _cw_play(c3_i argc, c3_c* argv[])
while ( -1 != (ch_i=getopt_long(argc, argv, "fn:", lop_u, &lid_i)) ) {
switch ( ch_i ) {
case 4: { // auto-meld
mel_o = c3y;
} break;
case 6: { // no-demand
u3_Host.ops_u.map = c3n;
u3C.wag_w |= u3o_no_demand;
@ -1857,6 +1863,10 @@ _cw_play(c3_i argc, c3_c* argv[])
//
u3_disk* log_u = _cw_disk_init(u3_Host.dir_c); // XX s/b try_aquire lock
if ( c3y == mel_o ) {
u3C.wag_w |= u3o_auto_meld;
}
u3C.wag_w |= u3o_hashless;
u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y);
u3C.slog_f = _cw_play_slog;

View File

@ -22,16 +22,17 @@
** _check flags are set inside u3 and heard outside it.
*/
enum u3o_flag { // execution flags
u3o_debug_ram = 1 << 0, // debug: gc
u3o_debug_cpu = 1 << 1, // debug: profile
u3o_check_corrupt = 1 << 2, // check: gc memory
u3o_check_fatal = 1 << 3, // check: unrecoverable
u3o_verbose = 1 << 4, // be remarkably wordy
u3o_dryrun = 1 << 5, // don't touch checkpoint
u3o_quiet = 1 << 6, // disable ~&
u3o_hashless = 1 << 7, // disable hashboard
u3o_trace = 1 << 8, // enables trace dumping
u3o_no_demand = 1 << 9 // disables demand paging
u3o_debug_ram = 1 << 0, // debug: gc
u3o_debug_cpu = 1 << 1, // debug: profile
u3o_check_corrupt = 1 << 2, // check: gc memory
u3o_check_fatal = 1 << 3, // check: unrecoverable
u3o_verbose = 1 << 4, // be remarkably wordy
u3o_dryrun = 1 << 5, // don't touch checkpoint
u3o_quiet = 1 << 6, // disable ~&
u3o_hashless = 1 << 7, // disable hashboard
u3o_trace = 1 << 8, // enables trace dumping
u3o_auto_meld = 1 << 9, // enables meld under pressure
u3o_no_demand = 1 << 10 // disables demand paging
};
/** Globals.

View File

@ -235,12 +235,12 @@ u3_mars_play(u3_mars* mar_u, c3_d eve_d)
// XX pack before meld?
//
// if ( u3C.wag_w & u3o_auto_meld ) {
// u3a_print_memory(stderr, "mars: meld: gained", u3u_meld());
// }
// else {
if ( u3C.wag_w & u3o_auto_meld ) {
u3a_print_memory(stderr, "mars: meld: gained", u3u_meld());
}
else {
u3a_print_memory(stderr, "mars: pack: gained", u3m_pack());
// }
}
} break;
// XX handle any specifically?