From 101ed854fe9c9fa30694d692d091e074d8ac00db Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 17:39:10 -0400 Subject: [PATCH 1/9] wip raw poke, no now --- pkg/vere/serf.c | 137 ++++++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 92 deletions(-) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 3a59005e00..575fa6300d 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -65,7 +65,7 @@ _serf_grab(u3_noun sac) #ifdef U3_MEMORY_LOG { - u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); + u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); // XX now c3_c* wen_c = u3r_string(wen); c3_c nam_c[2048]; @@ -349,70 +349,6 @@ _serf_make_crud(u3_noun job, u3_noun dud) return new; } -/* _serf_poke(): RETAIN -*/ -static u3_noun -_serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job) -{ - u3_noun now, ovo, wen, gon; - u3x_cell(job, &now, &ovo); - - wen = u3A->now; - u3A->now = u3k(now); - -#ifdef U3_EVENT_TIME_DEBUG - struct timeval b4; - c3_c* txt_c; - - gettimeofday(&b4, 0); - - { - u3_noun tag = u3h(u3t(ovo)); - txt_c = u3r_string(tag); - - if ( (c3__belt != tag) - && (c3__crud != tag) ) - { - u3l_log("serf: %s (%" PRIu64 ") %s", cap_c, sef_u->sen_d, txt_c); - } - } -#endif - - gon = u3m_soft(mil_w, u3v_poke, u3k(ovo)); - -#ifdef U3_EVENT_TIME_DEBUG - { - struct timeval f2, d0; - c3_w ms_w; - c3_w clr_w; - - gettimeofday(&f2, 0); - timersub(&f2, &b4, &d0); - - ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000); - clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow - - if ( clr_w != 2 ) { - u3l_log("\x1b[3%dm%%%s (%" PRIu64 ") %4d.%02dms\x1b[0m", - clr_w, txt_c, sef_u->sen_d, ms_w, - (int) (d0.tv_usec % 1000) / 10); - } - - c3_free(txt_c); - } -#endif - - if ( u3_blip != u3h(gon) ) { - u3z(u3A->now); - u3A->now = wen; - } - else { - u3z(wen); - } - - return gon; -} - /* _serf_work(): apply event, capture effects. */ static u3_noun @@ -426,7 +362,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) u3_assert( sef_u->sen_d == sef_u->dun_d); sef_u->sen_d++; - gon = _serf_poke(sef_u, "work", mil_w, job); // retain + gon = u3m_soft(mil_w, u3v_poke_raw, u3k(job)); // event accepted // @@ -457,7 +393,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) // job = _serf_make_crud(job, dud); - gon = _serf_poke(sef_u, "crud", mil_w, job); // retain + gon = u3m_soft(mil_w, u3v_poke_raw, u3k(job)); // error notification accepted // @@ -510,12 +446,52 @@ u3_serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) u3t_event_trace(lab_c, 'B'); } +#ifdef U3_EVENT_TIME_DEBUG + struct timeval b4; + c3_c* txt_c; + + gettimeofday(&b4, 0); + + { + u3_noun tag = u3h(u3t(u3t(job))); + txt_c = u3r_string(tag); + + if ( (c3__belt != tag) + && (c3__crud != tag) ) + { + u3l_log("serf: (%" PRIu64 ") %s", sef_u->sen_d, txt_c); + } + } +#endif + // %work must be performed against an extant kernel // u3_assert( 0 != sef_u->mug_l); pro = u3nc(c3__work, _serf_work(sef_u, mil_w, job)); +#ifdef U3_EVENT_TIME_DEBUG + { + struct timeval f2, d0; + c3_w ms_w; + c3_w clr_w; + + gettimeofday(&f2, 0); + timersub(&f2, &b4, &d0); + + ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000); + clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow + + if ( clr_w != 2 ) { + u3l_log("\x1b[3%dm%%%s (%" PRIu64 ") %4d.%02dms\x1b[0m", + clr_w, txt_c, sef_u->sen_d, ms_w, + (int) (d0.tv_usec % 1000) / 10); + } + + c3_free(txt_c); + } +#endif + if ( tac_t ) { u3t_event_trace(lab_c, 'E'); } @@ -567,29 +543,6 @@ _serf_play_life(u3_serf* sef_u, u3_noun eve) } } -/* _serf_play_poke(): RETAIN -*/ -static u3_noun -_serf_play_poke(u3_noun job) -{ - u3_noun now, ovo, wen, gon; - u3x_cell(job, &now, &ovo); - - wen = u3A->now; - u3A->now = u3k(now); - gon = u3m_soft(0, u3v_poke, u3k(ovo)); - - if ( u3_blip != u3h(gon) ) { - u3z(u3A->now); - u3A->now = wen; - } - else { - u3z(wen); - } - - return gon; -} - /* _serf_play_list(): */ static u3_noun @@ -606,7 +559,7 @@ _serf_play_list(u3_serf* sef_u, u3_noun eve) // sef_u->sen_d++; - gon = _serf_play_poke(job); + gon = u3m_soft(0, u3v_poke_raw, u3k(job)); // event succeeded, save and continue // @@ -708,7 +661,7 @@ _serf_writ_live_exit(u3_serf* sef_u, c3_w cod_w) FILE* fil_u; { - u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); + u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); // XX now c3_c* wen_c = u3r_string(wen); c3_c nam_c[2048]; From 4f79a17153a6d1d0b2d6910a5955aa0da23b8e80 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 18:02:00 -0400 Subject: [PATCH 2/9] wip replaces loobeans with bitmap --- pkg/vere/serf.c | 50 +++++++++++++++++++++---------------------------- pkg/vere/serf.h | 12 +++++++++--- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 575fa6300d..bdaa23072e 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -172,23 +172,23 @@ u3_serf_grab(void) void u3_serf_post(u3_serf* sef_u) { - if ( c3y == sef_u->rec_o ) { + if ( sef_u->fag_e & u3_serf_rec_e ) { u3m_reclaim(); - sef_u->rec_o = c3n; + sef_u->fag_e &= ~u3_serf_rec_e; } // XX this runs on replay too, |mass s/b elsewhere // - if ( c3y == sef_u->mut_o ) { + if ( sef_u->fag_e & u3_serf_mut_e ) { _serf_grab(sef_u->sac); - sef_u->sac = u3_nul; - sef_u->mut_o = c3n; + sef_u->sac = u3_nul; + sef_u->fag_e &= ~u3_serf_mut_e; } - if ( c3y == sef_u->pac_o ) { + if ( sef_u->fag_e & u3_serf_pac_e ) { u3a_print_memory(stderr, "serf: pack: gained", u3m_pack()); u3l_log(""); - sef_u->pac_o = c3n; + sef_u->fag_e &= ~u3_serf_pac_e; } if ( u3C.wag_w & u3o_toss ) { @@ -201,9 +201,6 @@ u3_serf_post(u3_serf* sef_u) static u3_noun _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) { - c3_o rec_o = c3n; - c3_o pac_o = c3n; - // intercept |mass, observe |reset // { @@ -234,7 +231,7 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) // reclaim memory from persistent caches on |reset // if ( c3__vega == u3h(fec) ) { - rec_o = c3y; + sef_u->fag_e |= u3_serf_rec_e; } riv = u3t(riv); @@ -251,9 +248,9 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) // For future flexibility, the urgency of the notification is represented // by a *decreasing* number: 0 is maximally urgent, 1 less so, &c. // - // high-priority: 2^22 contiguous words remaining (~8 MB) + // high-priority: 2^22 contiguous words remaining (~16 MB) // low-priority: 2^27 contiguous words remaining (~536 MB) - // XX maybe use 2^23 (~16 MB) and 2^26 (~268 MB? + // XX maybe use 2^23 (~32 MB) and 2^26 (~268 MB)? // // XX these thresholds should trigger notifications sent to the king // instead of directly triggering these remedial actions. @@ -267,13 +264,13 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) if ( (pre_w > low_w) && !(pos_w > low_w) ) { // XX set flag(s) in u3V so we don't repeat endlessly? // - pac_o = c3y; - rec_o = c3y; + sef_u->fag_e |= u3_serf_pac_e; + sef_u->fag_e |= u3_serf_rec_e; pri = 1; } else if ( (pre_w > hig_w) && !(pos_w > hig_w) ) { - pac_o = c3y; - rec_o = c3y; + sef_u->fag_e |= u3_serf_pac_e; + sef_u->fag_e |= u3_serf_rec_e; pri = 0; } // reclaim memory from persistent caches periodically @@ -283,7 +280,7 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) // - we don't make very effective use of our free lists // else if ( 0 == (sef_u->dun_d % 1000ULL) ) { - rec_o = c3y; + sef_u->fag_e |= u3_serf_rec_e; } // notify daemon of memory pressure via "fake" effect @@ -295,9 +292,6 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) } } - sef_u->rec_o = c3o(sef_u->rec_o, rec_o); - sef_u->pac_o = c3o(sef_u->pac_o, pac_o); - return vir; } @@ -306,13 +300,13 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) static void _serf_sure_core(u3_serf* sef_u, u3_noun cor) { - sef_u->dun_d = sef_u->sen_d; + sef_u->dun_d = sef_u->sen_d; u3z(u3A->roc); - u3A->roc = cor; - u3A->eve_d = sef_u->dun_d; - sef_u->mug_l = u3r_mug(u3A->roc); - sef_u->mut_o = c3y; + u3A->roc = cor; + u3A->eve_d = sef_u->dun_d; + sef_u->mug_l = u3r_mug(u3A->roc); + sef_u->fag_e |= u3_serf_mut_e; } /* _serf_sure(): event succeeded, save state and process effects. @@ -950,9 +944,7 @@ u3_serf_init(u3_serf* sef_u) // } // } - sef_u->pac_o = c3n; - sef_u->rec_o = c3n; - sef_u->mut_o = c3n; + sef_u->fag_e = 0; sef_u->sac = u3_nul; return rip; diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 5808f362e7..a6984fbc51 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -3,6 +3,14 @@ /** Data types. **/ + /* u3_serf_flag_e: process/system flags. + */ + typedef enum { // execution flags + u3_serf_mut_e = 1 << 0, // state changed + u3_serf_pac_e = 1 << 1, // pack requested + u3_serf_rec_e = 1 << 2 // reclaim requested + } u3_serf_flag_e; + /* u3_serf: worker-process state */ typedef struct _u3_serf { @@ -11,10 +19,8 @@ c3_d sen_d; // last event requested c3_d dun_d; // last event processed c3_l mug_l; // hash of state - c3_o pac_o; // pack kernel - c3_o rec_o; // reclaim cache - c3_o mut_o; // mutated kerne u3_noun sac; // space measurementl + u3_serf_flag_e fag_e; void (*xit_f)(void); // exit callback } u3_serf; From 90856e2779267eb202af6a56fbf88170f9881da4 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 18:29:12 -0400 Subject: [PATCH 3/9] wip moves %live writs to serf_post --- pkg/noun/manage.c | 1 + pkg/vere/serf.c | 167 +++++++++++++++++++++++----------------------- pkg/vere/serf.h | 7 +- 3 files changed, 89 insertions(+), 86 deletions(-) diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 5ff7d7b129..ece9cc10af 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -2088,6 +2088,7 @@ u3m_stop() { u3e_stop(); u3je_secp_stop(); + c3_free(u3D.ray_u); } /* u3m_boot(): start the u3 system. return next event, starting from 1. diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index bdaa23072e..720c1b98b2 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -191,6 +191,74 @@ u3_serf_post(u3_serf* sef_u) sef_u->fag_e &= ~u3_serf_pac_e; } + if ( sef_u->fag_e & u3_serf_mel_e ) { + u3a_print_memory(stderr, "serf: meld: gained", u3u_meld()); + u3l_log(""); + sef_u->fag_e &= ~u3_serf_mel_e; + } + + if ( sef_u->fag_e & u3_serf_ram_e ) { + u3l_log("serf (%" PRIu64 "): saving rock", sef_u->dun_d); + + if ( c3n == u3u_cram(sef_u->dir_c, sef_u->dun_d) ) { + fprintf(stderr, "serf (%" PRIu64 "): unable to jam state\r\n", sef_u->dun_d); + exit(1); + } + + if ( u3r_mug(u3A->roc) != sef_u->mug_l ) { + fprintf(stderr, "serf (%" PRIu64 "): mug mismatch 0x%08x 0x%08x\r\n", + sef_u->dun_d, sef_u->mug_l, u3r_mug(u3A->roc)); + exit(1); + } + + u3m_save(); + u3_serf_grab(); + sef_u->fag_e &= ~u3_serf_ram_e; + } + + + if ( sef_u->fag_e & u3_serf_sav_e ) { + u3m_save(); + sef_u->fag_e &= ~u3_serf_sav_e; + } + + if ( sef_u->fag_e & u3_serf_xit_e ) { + if ( u3C.wag_w & u3o_debug_cpu ) { + FILE* fil_u; + + { + u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); // XX now + c3_c* wen_c = u3r_string(wen); + + c3_c nam_c[2048]; + snprintf(nam_c, 2048, "%s/.urb/put/profile", u3C.dir_c); + + struct stat st; + if ( -1 == stat(nam_c, &st) ) { + c3_mkdir(nam_c, 0700); + } + + c3_c man_c[2054]; + snprintf(man_c, 2053, "%s/%s.txt", nam_c, wen_c); + + fil_u = c3_fopen(man_c, "w"); + + c3_free(wen_c); + u3z(wen); + } + + u3t_damp(fil_u); + + { + fclose(fil_u); + } + } + + sef_u->fag_e &= ~u3_serf_xit_e; + sef_u->xit_f(); + exit(sef_u->xit_y); + } + if ( u3C.wag_w & u3o_toss ) { u3m_toss(); } @@ -646,66 +714,6 @@ u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) return u3nc(c3__peek, pro); } -/* _serf_writ_live_exit(): exit on command. -*/ -static void -_serf_writ_live_exit(u3_serf* sef_u, c3_w cod_w) -{ - if ( u3C.wag_w & u3o_debug_cpu ) { - FILE* fil_u; - - { - u3_noun wen = u3dc("scot", c3__da, u3k(u3A->now)); // XX now - c3_c* wen_c = u3r_string(wen); - - c3_c nam_c[2048]; - snprintf(nam_c, 2048, "%s/.urb/put/profile", u3C.dir_c); - - struct stat st; - if ( -1 == stat(nam_c, &st) ) { - c3_mkdir(nam_c, 0700); - } - - c3_c man_c[2054]; - snprintf(man_c, 2053, "%s/%s.txt", nam_c, wen_c); - - fil_u = c3_fopen(man_c, "w"); - - c3_free(wen_c); - u3z(wen); - } - - u3t_damp(fil_u); - - { - fclose(fil_u); - } - } - - // XX move to jets.c - // - c3_free(u3D.ray_u); - - sef_u->xit_f(); - - exit(cod_w); -} - -/* _serf_writ_live_save(): save snapshot. -*/ -static void -_serf_writ_live_save(u3_serf* sef_u, c3_d eve_d) -{ - if( eve_d != sef_u->dun_d ) { - fprintf(stderr, "serf (%" PRIu64 "): save failed: %" PRIu64 "\r\n", - sef_u->dun_d, - eve_d); - exit(1); - } - - u3m_save(); -} - /* u3_serf_live(): apply %live command [com], producing *ret on c3y. */ c3_o @@ -727,17 +735,14 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) } case c3__exit: { - c3_y cod_y; - - if ( c3n == u3r_safe_byte(dat, &cod_y) ) { + if ( c3n == u3r_safe_byte(dat, &sef_u->xit_y) ) { u3z(com); return c3n; } u3z(com); - // NB, doesn't return - // - _serf_writ_live_exit(sef_u, cod_y); + + sef_u->fag_e |= u3_serf_xit_e; *ret = u3nc(c3__live, u3_nul); return c3y; } @@ -761,22 +766,7 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) return c3n; } - u3l_log("serf (%" PRIu64 "): saving rock", sef_u->dun_d); - - if ( c3n == u3u_cram(sef_u->dir_c, eve_d) ) { - fprintf(stderr, "serf (%" PRIu64 "): unable to jam state\r\n", eve_d); - return c3n; - } - - if ( u3r_mug(u3A->roc) != sef_u->mug_l ) { - fprintf(stderr, "serf (%" PRIu64 "): mug mismatch 0x%08x 0x%08x\r\n", - eve_d, sef_u->mug_l, u3r_mug(u3A->roc)); - return c3n; - } - - u3m_save(); - u3_serf_grab(); - + sef_u->fag_e |= u3_serf_ram_e; *ret = u3nc(c3__live, u3_nul); return c3y; } @@ -788,7 +778,7 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) } else { u3z(com); - u3a_print_memory(stderr, "serf: pack: gained", u3m_pack()); + sef_u->fag_e |= u3_serf_pac_e; *ret = u3nc(c3__live, u3_nul); return c3y; } @@ -801,7 +791,7 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) } else { u3z(com); - u3a_print_memory(stderr, "serf: meld: gained", u3u_meld()); + sef_u->fag_e |= u3_serf_mel_e; *ret = u3nc(c3__live, u3_nul); return c3y; } @@ -816,7 +806,14 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) } u3z(com); - _serf_writ_live_save(sef_u, eve_d); + if( eve_d != sef_u->dun_d ) { + fprintf(stderr, "serf (%" PRIu64 "): save failed: %" PRIu64 "\r\n", + sef_u->dun_d, + eve_d); + return c3n; + } + + sef_u->fag_e |= u3_serf_sav_e; *ret = u3nc(c3__live, u3_nul); return c3y; } diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index a6984fbc51..4066cc7f25 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -8,7 +8,11 @@ typedef enum { // execution flags u3_serf_mut_e = 1 << 0, // state changed u3_serf_pac_e = 1 << 1, // pack requested - u3_serf_rec_e = 1 << 2 // reclaim requested + u3_serf_rec_e = 1 << 2, // reclaim requested + u3_serf_sav_e = 1 << 3, // snapshot requested + u3_serf_mel_e = 1 << 4, // meld requested + u3_serf_ram_e = 1 << 5, // cram requested + u3_serf_xit_e = 1 << 6 // exit requested } u3_serf_flag_e; /* u3_serf: worker-process state @@ -21,6 +25,7 @@ c3_l mug_l; // hash of state u3_noun sac; // space measurementl u3_serf_flag_e fag_e; + c3_y xit_y; void (*xit_f)(void); // exit callback } u3_serf; From 8a2464db4c182e17f0725dbb58f1cba22f046604 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 18:49:49 -0400 Subject: [PATCH 4/9] wip refactors gc --- pkg/vere/serf.c | 142 ++++++++++++++++++++++-------------------------- pkg/vere/serf.h | 4 +- 2 files changed, 68 insertions(+), 78 deletions(-) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 720c1b98b2..68dc9881da 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -49,19 +49,52 @@ :: next steps: -- */ -/* _serf_grab(): garbage collect, checking for profiling. RETAIN. +/* u3_serf_grab(): garbage collect. */ -static void -_serf_grab(u3_noun sac) +void +u3_serf_grab(void) { - if ( u3_nul == sac) { - if ( u3C.wag_w & (u3o_debug_ram | u3o_check_corrupt) ) { - u3m_grab(sac, u3_none); + FILE* fil_u = stderr; + u3_noun sac = u3_nul; + + u3_assert( u3R == &(u3H->rod_u) ); + + { + u3_noun sam, gon; + + { + u3_noun pax = u3nc(c3__whey, u3_nul); + u3_noun lyc = u3nc(u3_nul, u3_nul); + sam = u3nt(lyc, c3n, u3nq(c3__once, u3_blip, u3_blip, pax)); } + + gon = u3m_soft(0, u3v_peek, sam); + + { + u3_noun tag, dat, val; + u3x_cell(gon, &tag, &dat); + + if ( (u3_blip == tag) + && (u3_nul != dat) + && (c3y == u3r_pq(u3t(dat), c3__omen, 0, &val)) + && (c3y == u3r_p(val, c3__mass, &sac)) ) + { + u3k(sac); + } + } + + u3z(gon); + } + + fprintf(stderr, "serf: measuring memory:\r\n"); + + if ( u3_nul == sac ) { + u3a_print_memory(fil_u, "total marked", u3m_mark(stderr)); + u3a_print_memory(fil_u, "free lists", u3a_idle(u3R)); + u3a_print_memory(fil_u, "sweep", u3a_sweep()); } else { c3_w tot_w = 0; - FILE* fil_u; #ifdef U3_MEMORY_LOG { @@ -85,10 +118,6 @@ _serf_grab(u3_noun sac) c3_free(wen_c); u3z(wen); } -#else - { - fil_u = stderr; - } #endif u3_assert( u3R == &(u3H->rod_u) ); @@ -102,69 +131,19 @@ _serf_grab(u3_noun sac) u3a_print_memory(fil_u, "free lists", u3a_idle(u3R)); u3a_print_memory(fil_u, "sweep", u3a_sweep()); - fflush(fil_u); - #ifdef U3_MEMORY_LOG { fclose(fil_u); } #endif - u3z(sac); - - u3l_log(""); } -} -/* u3_serf_grab(): garbage collect. -*/ -void -u3_serf_grab(void) -{ - u3_noun sac = u3_nul; - - u3_assert( u3R == &(u3H->rod_u) ); - - { - u3_noun sam, gon; - - { - u3_noun pax = u3nc(c3__whey, u3_nul); - u3_noun lyc = u3nc(u3_nul, u3_nul); - sam = u3nt(lyc, c3n, u3nq(c3__once, u3_blip, u3_blip, pax)); - } - - gon = u3m_soft(0, u3v_peek, sam); - - { - u3_noun tag, dat, val; - u3x_cell(gon, &tag, &dat); - - if ( (u3_blip == tag) - && (u3_nul != dat) - && (c3y == u3r_pq(u3t(dat), c3__omen, 0, &val)) - && (c3y == u3r_p(val, c3__mass, &sac)) ) - { - u3k(sac); - } - } - - u3z(gon); - } - - fprintf(stderr, "serf: measuring memory:\r\n"); - - if ( u3_nul != sac ) { - _serf_grab(sac); - } - else { - u3a_print_memory(stderr, "total marked", u3m_mark(stderr)); - u3a_print_memory(stderr, "free lists", u3a_idle(u3R)); - u3a_print_memory(stderr, "sweep", u3a_sweep()); - fprintf(stderr, "\r\n"); - } + u3z(sac); - fflush(stderr); + fprintf(fil_u, "\r\n"); + fflush(fil_u); + u3l_log(""); } /* u3_serf_post(): update serf state post-writ. @@ -177,14 +156,25 @@ u3_serf_post(u3_serf* sef_u) sef_u->fag_e &= ~u3_serf_rec_e; } - // XX this runs on replay too, |mass s/b elsewhere - // if ( sef_u->fag_e & u3_serf_mut_e ) { - _serf_grab(sef_u->sac); - sef_u->sac = u3_nul; + // XX wat do sef_u->fag_e &= ~u3_serf_mut_e; } + // XX won't work, requires non-asserting u3a_sweep() + // + if ( u3C.wag_w & u3o_check_corrupt ) { + u3m_grab(u3_none); + } + + if ( sef_u->fag_e & u3_serf_gab_e ) { + u3_serf_grab(); + sef_u->fag_e &= ~u3_serf_gab_e; + } + else if ( u3C.wag_w & u3o_debug_ram ) { + u3m_grab(u3_none); + } + if ( sef_u->fag_e & u3_serf_pac_e ) { u3a_print_memory(stderr, "serf: pack: gained", u3m_pack()); u3l_log(""); @@ -281,16 +271,18 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) // assumes a max of one %mass effect per event // if ( c3__mass == u3h(fec) ) { - // save a copy of the %mass data - // - sef_u->sac = u3k(u3t(fec)); - // replace the %mass data with ~ + sef_u->fag_e |= u3_serf_gab_e; + + // replace %mass payload with ~ // // For efficient transmission to daemon. // riv = u3kb_weld(u3qb_scag(i_w, vir), u3nc(u3nt(u3k(u3h(u3h(riv))), c3__mass, u3_nul), u3qb_slag(1 + i_w, vir))); + + // discard original %mass effect, will be retrieved via +peek + // u3z(vir); vir = riv; break; @@ -642,8 +634,7 @@ _serf_play_list(u3_serf* sef_u, u3_noun eve) // skip |mass on replay // - u3z(sef_u->sac); - sef_u->sac = u3_nul; + sef_u->fag_e &= ~u3_serf_gab_e; eve = u3t(eve); } @@ -942,7 +933,6 @@ u3_serf_init(u3_serf* sef_u) // } sef_u->fag_e = 0; - sef_u->sac = u3_nul; return rip; } diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 4066cc7f25..4b3fc79d53 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -12,7 +12,8 @@ u3_serf_sav_e = 1 << 3, // snapshot requested u3_serf_mel_e = 1 << 4, // meld requested u3_serf_ram_e = 1 << 5, // cram requested - u3_serf_xit_e = 1 << 6 // exit requested + u3_serf_gab_e = 1 << 6, // grab requested + u3_serf_xit_e = 1 << 7 // exit requested } u3_serf_flag_e; /* u3_serf: worker-process state @@ -23,7 +24,6 @@ c3_d sen_d; // last event requested c3_d dun_d; // last event processed c3_l mug_l; // hash of state - u3_noun sac; // space measurementl u3_serf_flag_e fag_e; c3_y xit_y; void (*xit_f)(void); // exit callback From 9063792fad2d500f4051275cd075a09fe5a69391 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 20:29:10 -0400 Subject: [PATCH 5/9] wip adds raw +peek and +poke interfaces --- pkg/noun/vortex.c | 34 ++++++++++++++++++++++++++++++++++ pkg/noun/vortex.h | 10 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/pkg/noun/vortex.c b/pkg/noun/vortex.c index 5981068b87..42fbdcd1f7 100644 --- a/pkg/noun/vortex.c +++ b/pkg/noun/vortex.c @@ -255,6 +255,16 @@ u3v_lily(u3_noun fot, u3_noun txt, c3_l* tid_l) } } +/* u3v_peek_raw2(): raw +peek +*/ +u3_noun +u3v_peek_raw2(u3_noun roc, u3_noun sam) +{ + u3_noun fol = u3k(u3x_at(_CVX_PEEK, roc)); + u3_noun fun = u3n_nock_on(roc, fol); + return u3n_slam_on(fun, sam); +} + /* u3v_peek(): query the reck namespace (protected). */ u3_noun @@ -321,6 +331,30 @@ u3v_poke_raw(u3_noun sam) return pro; } +/* u3v_poke_raw2(): raw +poke +*/ +u3_noun +u3v_poke_raw2(u3_noun roc, u3_noun sam) +{ + u3_noun fol = u3k(u3x_at(_CVX_POKE, roc)); + u3_noun fun = u3n_nock_on(roc, fol); + u3_noun pro; + + { +# ifdef U3_MEMORY_DEBUG + c3_w cod_w = u3a_lush(u3h(u3t(u3t(sam)))); +# endif + + pro = u3n_slam_on(fun, sam); + +# ifdef U3_MEMORY_DEBUG + u3a_lop(cod_w); +# endif + } + + return pro; +} + /* u3v_poke_sure(): inject an event, saving new state if successful. */ c3_o diff --git a/pkg/noun/vortex.h b/pkg/noun/vortex.h index cbd0f295ff..8c316e8cb4 100644 --- a/pkg/noun/vortex.h +++ b/pkg/noun/vortex.h @@ -86,6 +86,11 @@ c3_o u3v_lily(u3_noun fot, u3_noun txt, c3_l* tid_l); + /* u3v_peek_raw2(): raw +peek + */ + u3_noun + u3v_peek_raw2(u3_noun roc, u3_noun sam); + /* u3v_peek(): query the reck namespace. */ u3_noun @@ -96,6 +101,11 @@ u3_noun u3v_soft_peek(c3_w mil_w, u3_noun sam); + /* u3v_poke_raw2(): raw +poke + */ + u3_noun + u3v_poke_raw2(u3_noun roc, u3_noun sam); + /* u3v_poke(): insert and apply an input ovum (protected). */ u3_noun From acead2e8a0799467276f452d5abe8b5581a8c9ca Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 20:34:13 -0400 Subject: [PATCH 6/9] wip track arvo state in u3_serf struct --- pkg/vere/main.c | 2 +- pkg/vere/serf.c | 131 ++++++++++++++++++++++++++++++++---------------- pkg/vere/serf.h | 19 +++---- 3 files changed, 100 insertions(+), 52 deletions(-) diff --git a/pkg/vere/main.c b/pkg/vere/main.c index f83d656e98..30459369a8 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -1645,7 +1645,7 @@ _cw_grab(c3_i argc, c3_c* argv[]) u3m_boot(u3_Host.dir_c, (size_t)1 << u3_Host.ops_u.lom_y); u3C.wag_w |= u3o_hashless; - u3_serf_grab(); + u3_serf_grab(0); u3m_stop(); } diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 68dc9881da..8371285a23 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -49,13 +49,33 @@ :: next steps: -- */ +static u3_noun +_serf_peek_in(u3_cell dat) +{ + u3a_cell* dat_u = u3a_to_ptr(dat); + return u3v_peek_raw2(dat_u->hed, dat_u->tel); +} + +static u3_noun +_serf_peek_soft(u3_serf* sef_u, c3_w mil_w, u3_noun sam) +{ + u3_cell dat = u3nc(u3k(sef_u->roc), sam); + return u3m_soft(mil_w, _serf_peek_in, dat); +} + /* u3_serf_grab(): garbage collect. */ void -u3_serf_grab(void) +u3_serf_grab(u3_serf* sef_u) { - FILE* fil_u = stderr; - u3_noun sac = u3_nul; + FILE* fil_u = stderr; + u3_noun sac = u3_nul; + u3_serf fes_u = {0}; + + if ( !sef_u ) { + fes_u.roc = u3k(u3A->roc); + sef_u = &fes_u; + } u3_assert( u3R == &(u3H->rod_u) ); @@ -68,7 +88,7 @@ u3_serf_grab(void) sam = u3nt(lyc, c3n, u3nq(c3__once, u3_blip, u3_blip, pax)); } - gon = u3m_soft(0, u3v_peek, sam); + gon = _serf_peek_soft(sef_u, 0, sam); { u3_noun tag, dat, val; @@ -88,6 +108,8 @@ u3_serf_grab(void) fprintf(stderr, "serf: measuring memory:\r\n"); + u3a_mark_noun(sef_u->roc); + if ( u3_nul == sac ) { u3a_print_memory(fil_u, "total marked", u3m_mark(stderr)); u3a_print_memory(fil_u, "free lists", u3a_idle(u3R)); @@ -141,6 +163,11 @@ u3_serf_grab(void) u3z(sac); + if ( fes_u.roc ) { + u3z(fes_u.roc); + fes_u.roc = 0; + } + fprintf(fil_u, "\r\n"); fflush(fil_u); u3l_log(""); @@ -151,64 +178,77 @@ u3_serf_grab(void) void u3_serf_post(u3_serf* sef_u) { + if ( sef_u->fag_e & u3_serf_mut_e ) { + // sef_u->roc = u3m_love(sef_u->roc); + u3z(u3A->roc); + u3A->roc = u3k(sef_u->roc); + u3A->eve_d = sef_u->dun_d; + sef_u->fag_e &= ~u3_serf_mut_e; + } + if ( sef_u->fag_e & u3_serf_rec_e ) { u3m_reclaim(); sef_u->fag_e &= ~u3_serf_rec_e; } - if ( sef_u->fag_e & u3_serf_mut_e ) { - // XX wat do - sef_u->fag_e &= ~u3_serf_mut_e; - } - // XX won't work, requires non-asserting u3a_sweep() // if ( u3C.wag_w & u3o_check_corrupt ) { - u3m_grab(u3_none); + u3m_grab(sef_u->roc, u3_none); } if ( sef_u->fag_e & u3_serf_gab_e ) { - u3_serf_grab(); + u3_serf_grab(sef_u); sef_u->fag_e &= ~u3_serf_gab_e; } else if ( u3C.wag_w & u3o_debug_ram ) { - u3m_grab(u3_none); + u3m_grab(sef_u->roc, u3_none); } if ( sef_u->fag_e & u3_serf_pac_e ) { + u3z(sef_u->roc); u3a_print_memory(stderr, "serf: pack: gained", u3m_pack()); u3l_log(""); + sef_u->roc = u3k(u3A->roc); sef_u->fag_e &= ~u3_serf_pac_e; } if ( sef_u->fag_e & u3_serf_mel_e ) { + u3z(sef_u->roc); u3a_print_memory(stderr, "serf: meld: gained", u3u_meld()); u3l_log(""); + sef_u->roc = u3k(u3A->roc); sef_u->fag_e &= ~u3_serf_mel_e; } if ( sef_u->fag_e & u3_serf_ram_e ) { u3l_log("serf (%" PRIu64 "): saving rock", sef_u->dun_d); + u3z(sef_u->roc); + if ( c3n == u3u_cram(sef_u->dir_c, sef_u->dun_d) ) { fprintf(stderr, "serf (%" PRIu64 "): unable to jam state\r\n", sef_u->dun_d); exit(1); } - if ( u3r_mug(u3A->roc) != sef_u->mug_l ) { + sef_u->roc = u3k(u3A->roc); + + if ( u3r_mug(sef_u->roc) != sef_u->mug_l ) { fprintf(stderr, "serf (%" PRIu64 "): mug mismatch 0x%08x 0x%08x\r\n", - sef_u->dun_d, sef_u->mug_l, u3r_mug(u3A->roc)); + sef_u->dun_d, sef_u->mug_l, u3r_mug(sef_u->roc)); exit(1); } u3m_save(); - u3_serf_grab(); + u3_serf_grab(sef_u); sef_u->fag_e &= ~u3_serf_ram_e; } if ( sef_u->fag_e & u3_serf_sav_e ) { + u3z(sef_u->roc); u3m_save(); + sef_u->roc = u3k(u3A->roc); sef_u->fag_e &= ~u3_serf_sav_e; } @@ -360,12 +400,10 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) static void _serf_sure_core(u3_serf* sef_u, u3_noun cor) { + u3z(sef_u->roc); sef_u->dun_d = sef_u->sen_d; - - u3z(u3A->roc); - u3A->roc = cor; - u3A->eve_d = sef_u->dun_d; - sef_u->mug_l = u3r_mug(u3A->roc); + sef_u->roc = cor; + sef_u->mug_l = u3r_mug(sef_u->roc); sef_u->fag_e |= u3_serf_mut_e; } @@ -403,6 +441,20 @@ _serf_make_crud(u3_noun job, u3_noun dud) return new; } +static u3_noun +_serf_poke_in(u3_cell dat) +{ + u3a_cell* dat_u = u3a_to_ptr(dat); + return u3v_poke_raw2(dat_u->hed, dat_u->tel); +} + +static u3_noun +_serf_poke_soft(u3_serf* sef_u, c3_w mil_w, u3_noun sam) +{ + u3_cell dat = u3nc(u3k(sef_u->roc), sam); + return u3m_soft(mil_w, _serf_poke_in, dat); +} + /* _serf_work(): apply event, capture effects. */ static u3_noun @@ -416,7 +468,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) u3_assert( sef_u->sen_d == sef_u->dun_d); sef_u->sen_d++; - gon = u3m_soft(mil_w, u3v_poke_raw, u3k(job)); + gon = _serf_poke_soft(sef_u, mil_w, u3k(job)); // event accepted // @@ -447,7 +499,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) // job = _serf_make_crud(job, dud); - gon = u3m_soft(mil_w, u3v_poke_raw, u3k(job)); + gon = _serf_poke_soft(sef_u, mil_w, u3k(job)); // error notification accepted // @@ -570,9 +622,9 @@ _serf_play_life(u3_serf* sef_u, u3_noun eve) // ensure zero-initialized kernel // - // XX assert? + // XX wat do? // - u3A->roc = 0; + // u3A->roc = 0; gon = u3m_soft(0, u3v_life, eve); @@ -613,7 +665,7 @@ _serf_play_list(u3_serf* sef_u, u3_noun eve) // sef_u->sen_d++; - gon = u3m_soft(0, u3v_poke_raw, u3k(job)); + gon = _serf_poke_soft(sef_u, 0, u3k(job)); // event succeeded, save and continue // @@ -680,7 +732,7 @@ u3_serf_play(u3_serf* sef_u, c3_d eve_d, u3_noun lit) u3_noun u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) { - u3_noun gon = u3m_soft(mil_w, u3v_peek, sam); + u3_noun gon = _serf_peek_soft(sef_u, mil_w, sam); u3_noun pro; { @@ -888,20 +940,6 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) return ret_o; } -/* _serf_ripe(): produce initial serf state as [eve=@ mug=@] -*/ -static u3_noun -_serf_ripe(u3_serf* sef_u) -{ - // u3l_log("serf: ripe %" PRIu64, sef_u->dun_d); - - sef_u->mug_l = ( 0 == sef_u->dun_d ) - ? 0 - : u3r_mug(u3A->roc); - - return u3nc(u3i_chubs(1, &sef_u->dun_d), sef_u->mug_l); -} - /* u3_serf_init(): init or restore, producing status. */ u3_noun @@ -915,7 +953,16 @@ u3_serf_init(u3_serf* sef_u) c3_y noc_y = 4; u3_noun ver = u3nt(pro_w, hon_y, noc_y); - rip = u3nt(c3__ripe, ver, _serf_ripe(sef_u)); + u3_assert( sef_u->dun_d == sef_u->sen_d ); + u3_assert( sef_u->dun_d == u3A->eve_d ); + + sef_u->roc = u3k(u3A->roc); + sef_u->mug_l = ( 0 == sef_u->dun_d ) + ? 0 + : u3r_mug(sef_u->roc); + + rip = u3nt(c3__ripe, ver, + u3nc(u3i_chubs(1, &sef_u->dun_d), sef_u->mug_l)); } // XX move to u3_serf_post() @@ -928,7 +975,7 @@ u3_serf_init(u3_serf* sef_u) // if ( !(pen_w > (1 << 28)) ) { // fprintf(stderr, "\r\n"); // u3a_print_memory(stderr, "serf: contiguous free space", pen_w); - // u3_serf_grab(); + // u3_serf_grab(sef_u); // } // } diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 4b3fc79d53..44612f519c 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -19,14 +19,15 @@ /* u3_serf: worker-process state */ typedef struct _u3_serf { - c3_d key_d[4]; // disk key - c3_c* dir_c; // execution directory (pier) - c3_d sen_d; // last event requested - c3_d dun_d; // last event processed - c3_l mug_l; // hash of state - u3_serf_flag_e fag_e; - c3_y xit_y; - void (*xit_f)(void); // exit callback + c3_d key_d[4]; // disk key + c3_c* dir_c; // execution directory (pier) + c3_d sen_d; // last event requested + c3_d dun_d; // last event processed + u3_noun roc; // arvo kernel at [dun_d] + c3_l mug_l; // hash of state + u3_serf_flag_e fag_e; // flags + c3_y xit_y; // exit code + void (*xit_f)(void); // exit callback } u3_serf; /** Functions. @@ -69,6 +70,6 @@ /* u3_serf_grab(): garbage collect. */ void - u3_serf_grab(void); + u3_serf_grab(u3_serf* sef_u); #endif /* ifndef U3_VERE_SERF_H */ From 4aa3874d115fb8fd157a35510b0c820303f4859b Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 21:44:54 -0400 Subject: [PATCH 7/9] wip inner serf --- pkg/noun/serial.c | 4 ++-- pkg/vere/main.c | 4 ++++ pkg/vere/serf.c | 10 ++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 698a959d66..ece3134967 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -620,7 +620,7 @@ u3s_cue_xeno_init_with(c3_d pre_d, c3_d siz_d) { u3_cue_xeno* sil_u; - u3_assert( &(u3H->rod_u) == u3R ); + // u3_assert( &(u3H->rod_u) == u3R ); sil_u = c3_calloc(sizeof(*sil_u)); ur_dict32_grow((ur_root_t*)0, &sil_u->dic_u, pre_d, siz_d); @@ -645,7 +645,7 @@ u3s_cue_xeno_with(u3_cue_xeno* sil_u, { u3_weak som; - u3_assert( &(u3H->rod_u) == u3R ); + // u3_assert( &(u3H->rod_u) == u3R ); som = _cs_cue_xeno(sil_u, len_d, byt_y); ur_dict32_wipe(&sil_u->dic_u); diff --git a/pkg/vere/main.c b/pkg/vere/main.c index 30459369a8..275321d8de 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -959,6 +959,10 @@ _cw_serf_writ(void* vod_p, c3_d len_d, c3_y* byt_y) u3t_event_trace("serf ipc cue", 'B'); #endif + // u3_assert( &(u3H->rod_u) == u3R ); + u3m_hate(1 << 18); + // u3_assert( &(u3H->rod_u) != u3R ); + jar = u3s_cue_xeno_with(sil_u, len_d, byt_y); #ifdef SERF_TRACE_CUE diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 8371285a23..eaad50853d 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -178,13 +178,19 @@ u3_serf_grab(u3_serf* sef_u) void u3_serf_post(u3_serf* sef_u) { - if ( sef_u->fag_e & u3_serf_mut_e ) { - // sef_u->roc = u3m_love(sef_u->roc); + // if ( sef_u->fag_e & u3_serf_mut_e ) + { + // u3_assert( &(u3H->rod_u) != u3R ); + sef_u->roc = u3m_love(sef_u->roc); + // u3_assert( &(u3H->rod_u) == u3R ); u3z(u3A->roc); + u3z(u3A->roc); // XX really groace u3A->roc = u3k(sef_u->roc); u3A->eve_d = sef_u->dun_d; sef_u->fag_e &= ~u3_serf_mut_e; } + // XX wat do? + // else if u3_serf_inn_e ? if ( sef_u->fag_e & u3_serf_rec_e ) { u3m_reclaim(); From 4ba3321a99fa26d01d33079d8931fdd1fc37a4f2 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 21:53:06 -0400 Subject: [PATCH 8/9] wip serf stay inner --- pkg/vere/main.c | 9 ++++++--- pkg/vere/serf.c | 7 ++++++- pkg/vere/serf.h | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/vere/main.c b/pkg/vere/main.c index 275321d8de..a47774c5fb 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -959,9 +959,12 @@ _cw_serf_writ(void* vod_p, c3_d len_d, c3_y* byt_y) u3t_event_trace("serf ipc cue", 'B'); #endif - // u3_assert( &(u3H->rod_u) == u3R ); - u3m_hate(1 << 18); - // u3_assert( &(u3H->rod_u) != u3R ); + if ( !(u3V.fag_e & u3_serf_inn_e) ) { + // u3_assert( &(u3H->rod_u) == u3R ); + u3m_hate(1 << 18); + u3V.fag_e |= u3_serf_inn_e; + // u3_assert( &(u3H->rod_u) != u3R ); + } jar = u3s_cue_xeno_with(sil_u, len_d, byt_y); diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index eaad50853d..cbd3e0b29c 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -179,6 +179,9 @@ void u3_serf_post(u3_serf* sef_u) { // if ( sef_u->fag_e & u3_serf_mut_e ) + + if ( (sef_u->fag_e & u3_serf_inn_e) + && (sef_u->fag_e & ~(u3_serf_mut_e|u3_serf_inn_e)) ) { // u3_assert( &(u3H->rod_u) != u3R ); sef_u->roc = u3m_love(sef_u->roc); @@ -187,11 +190,13 @@ u3_serf_post(u3_serf* sef_u) u3z(u3A->roc); // XX really groace u3A->roc = u3k(sef_u->roc); u3A->eve_d = sef_u->dun_d; - sef_u->fag_e &= ~u3_serf_mut_e; + sef_u->fag_e &= ~u3_serf_inn_e; } // XX wat do? // else if u3_serf_inn_e ? + sef_u->fag_e &= ~u3_serf_mut_e; + if ( sef_u->fag_e & u3_serf_rec_e ) { u3m_reclaim(); sef_u->fag_e &= ~u3_serf_rec_e; diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 44612f519c..adb3ea7ccf 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -13,7 +13,8 @@ u3_serf_mel_e = 1 << 4, // meld requested u3_serf_ram_e = 1 << 5, // cram requested u3_serf_gab_e = 1 << 6, // grab requested - u3_serf_xit_e = 1 << 7 // exit requested + u3_serf_inn_e = 1 << 7, // in an inner road + u3_serf_xit_e = 1 << 8 // exit requested } u3_serf_flag_e; /* u3_serf: worker-process state From edafb3cb78cd7710580a7c5412903f00127316ac Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Mon, 9 Oct 2023 21:54:20 -0400 Subject: [PATCH 9/9] wip unify arvo before take --- pkg/vere/serf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index cbd3e0b29c..9b9dd2419d 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -184,6 +184,7 @@ u3_serf_post(u3_serf* sef_u) && (sef_u->fag_e & ~(u3_serf_mut_e|u3_serf_inn_e)) ) { // u3_assert( &(u3H->rod_u) != u3R ); + u3r_sing(u3A->roc, sef_u->roc); // try to unify sef_u->roc = u3m_love(sef_u->roc); // u3_assert( &(u3H->rod_u) == u3R ); u3z(u3A->roc);