From 0428a69f62433fc0f7868e426fa09702f924f5f1 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Tue, 19 Sep 2023 11:40:11 -0400 Subject: [PATCH] wip: more cleanup --- pkg/noun/allocate.c | 6 +++--- pkg/noun/v1/jets.c | 10 +--------- pkg/noun/v1/jets.h | 1 + pkg/noun/v1/nock.c | 7 +++---- pkg/noun/v2/jets.h | 1 + pkg/noun/v2/manage.h | 1 - pkg/noun/v3/manage.c | 11 +---------- pkg/noun/v3/manage.h | 3 +-- pkg/noun/v3/vortex.h | 6 +----- 9 files changed, 12 insertions(+), 34 deletions(-) diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 8194ca59e3..b905ce5912 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -2270,9 +2270,9 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws) u3a_print_memory(stderr, " size", box_u->siz_w); { - // c3_c* dat_c = _ca_print_box(box_u); - // fprintf(stderr, " data: %s\r\n", dat_c); - // c3_free(dat_c); + c3_c* dat_c = _ca_print_box(box_u); + fprintf(stderr, " data: %s\r\n", dat_c); + c3_free(dat_c); } } diff --git a/pkg/noun/v1/jets.c b/pkg/noun/v1/jets.c index 401a0ff9f9..272930e11d 100644 --- a/pkg/noun/v1/jets.c +++ b/pkg/noun/v1/jets.c @@ -9,13 +9,6 @@ #include "pkg/noun/v1/allocate.h" #include "pkg/noun/v1/hashtable.h" -/* _cj_v1_hank: cached hook information. -** NB: copy of _cj_hank from pkg/noun/jets.c - */ -typedef struct { - u3_weak hax; // axis of hooked inner core - u3j_v1_site sit_u; // call-site data -} _cj_v1_hank; /* _cj_fink_free(): lose and free everything in a u3j_v1_fink. */ @@ -69,13 +62,12 @@ u3j_v1_site_lose(u3j_v1_site* sit_u) } /* _cj_v1_free_hank(): free an entry from the hank cache. -** NB: copy of _cj_v1_free_hank() from pkg/noun/jets.c */ static void _cj_v1_free_hank(u3_noun kev) { u3a_v1_cell* cel_u = (u3a_v1_cell*) u3a_v1_to_ptr(kev); - _cj_v1_hank* han_u = u3to(_cj_v1_hank, cel_u->tel); + u3j_v1_hank* han_u = u3to(u3j_v1_hank, cel_u->tel); if ( u3_none != han_u->hax ) { u3a_v1_lose(han_u->hax); u3j_v1_site_lose(&(han_u->sit_u)); diff --git a/pkg/noun/v1/jets.h b/pkg/noun/v1/jets.h index f11fa59329..bf3dfe6afe 100644 --- a/pkg/noun/v1/jets.h +++ b/pkg/noun/v1/jets.h @@ -10,6 +10,7 @@ **/ # define u3j_v1_fink u3j_v2_fink # define u3j_v1_fist u3j_v2_fist +# define u3j_v1_hank u3j_v2_hank # define u3j_v1_rite u3j_v2_rite # define u3j_v1_site u3j_v2_site diff --git a/pkg/noun/v1/nock.c b/pkg/noun/v1/nock.c index 67bf3afbc3..cce00b28b6 100644 --- a/pkg/noun/v1/nock.c +++ b/pkg/noun/v1/nock.c @@ -22,7 +22,6 @@ u3n_v1_reclaim(void) } /* _cn_v1_prog_free(): free memory retained by program pog_u -** NB: copy of _cn_prog_free in pkg/noun/nock.c */ static void _cn_v1_prog_free(u3n_v1_prog* pog_u) @@ -52,10 +51,10 @@ _cn_v1_prog_free(u3n_v1_prog* pog_u) u3a_v1_free(pog_u); } -/* _n_feb(): u3h_v1_walk helper for u3n_v1_free +/* _n_v1_feb(): u3h_v1_walk helper for u3n_v1_free */ static void -_n_feb(u3_noun kev) +_n_v1_feb(u3_noun kev) { u3a_v1_cell *cel_u = (u3a_v1_cell*) u3a_v1_to_ptr(kev); _cn_v1_prog_free(u3to(u3n_v1_prog, cel_u->tel)); @@ -67,6 +66,6 @@ void u3n_v1_free() { u3p(u3h_v1_root) har_p = u3R_v1->byc.har_p; - u3h_v1_walk(har_p, _n_feb); + u3h_v1_walk(har_p, _n_v1_feb); u3h_v1_free_nodes(har_p); } diff --git a/pkg/noun/v2/jets.h b/pkg/noun/v2/jets.h index 9d7a4c8dc9..281c5d62be 100644 --- a/pkg/noun/v2/jets.h +++ b/pkg/noun/v2/jets.h @@ -12,6 +12,7 @@ # define u3j_v2_core u3j_core # define u3j_v2_fink u3j_fink # define u3j_v2_fist u3j_fist +# define u3j_v2_hank u3j_hank # define u3j_v2_free_hank u3j_free_hank # define u3j_v2_harm u3j_harm # define u3j_v2_rite u3j_rite diff --git a/pkg/noun/v2/manage.h b/pkg/noun/v2/manage.h index 0ca2f059f9..1d03b97809 100644 --- a/pkg/noun/v2/manage.h +++ b/pkg/noun/v2/manage.h @@ -6,7 +6,6 @@ /** System management. **/ /* u3m_v2_migrate: perform pointer compression loom migration if necessary. - ver_w - target version */ void u3m_v2_migrate(); diff --git a/pkg/noun/v3/manage.c b/pkg/noun/v3/manage.c index 8efe8b2fbc..a9236ffa80 100644 --- a/pkg/noun/v3/manage.c +++ b/pkg/noun/v3/manage.c @@ -58,12 +58,10 @@ u3m_v3_migrate() rod_u.ear_p = rud_u->ear_p; // no need to zero-out fut_w - // no need to do anything with esc rod_u.how.fag_w = rud_u->how.fag_w; - // XX destination buffer is size 196; is that because of padding? memcpy(rod_u.all.fre_p, rud_u->all.fre_p, sizeof(rud_u->all.fre_p)); rod_u.all.cel_p = rud_u->all.cel_p; rod_u.all.fre_w = rud_u->all.fre_w; @@ -90,7 +88,7 @@ u3m_v3_migrate() rod_u.cax.har_p = rud_u->cax.har_p; - // prepare the new home + // prepare the new home, update the version hom_u.arv_u = hum_u->arv_u; hom_u.rod_u = rod_u; hom_u.ver_w = U3V_VER3; @@ -109,12 +107,5 @@ u3m_v3_migrate() // initialize persistent cache u3R_v3->cax.per_p = u3h_v3_new_cache(u3C.per_w); - // update the loom version - u3H_v3->ver_w = U3V_VER3; - - // XX remove later (unnecessary) - u3m_mark(stderr); - u3a_sweep(); - fprintf(stderr, "loom: memoization migration done\r\n"); } diff --git a/pkg/noun/v3/manage.h b/pkg/noun/v3/manage.h index 792bfb92b5..5745a6316b 100644 --- a/pkg/noun/v3/manage.h +++ b/pkg/noun/v3/manage.h @@ -5,8 +5,7 @@ /** System management. **/ - /* u3m_v3_migrate: perform pointer compression loom migration if necessary. - ver_w - target version + /* u3m_v3_migrate: perform memoization loom migration if necessary. */ void u3m_v3_migrate(); diff --git a/pkg/noun/v3/vortex.h b/pkg/noun/v3/vortex.h index 32ada5d807..58443a79a3 100644 --- a/pkg/noun/v3/vortex.h +++ b/pkg/noun/v3/vortex.h @@ -12,7 +12,7 @@ **/ # define u3v_v3_arvo u3v_arvo # define u3H_v3 u3v_Home -# define u3A_v3 (&(u3H_v3)->arv_u) +# define u3A_v3 (&(u3H_v3)->arv_u) /** Data structures. **/ @@ -25,10 +25,6 @@ u3v_version ver_w; // version number } u3v_v3_home; - /** Globals. - **/ - /// Arvo internal state. - /** Functions. **/ /* u3v_v3_rewrite_compact(): rewrite arvo kernel for compaction.