Skip to content

Commit

Permalink
wip: more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Sep 19, 2023
1 parent 70ec094 commit 0428a69
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 34 deletions.
6 changes: 3 additions & 3 deletions pkg/noun/allocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
10 changes: 1 addition & 9 deletions pkg/noun/v1/jets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions pkg/noun/v1/jets.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions pkg/noun/v1/nock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand All @@ -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);
}
1 change: 1 addition & 0 deletions pkg/noun/v2/jets.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/noun/v2/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/** System management.
**/
/* u3m_v2_migrate: perform pointer compression loom migration if necessary.
ver_w - target version
*/
void
u3m_v2_migrate();
Expand Down
11 changes: 1 addition & 10 deletions pkg/noun/v3/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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");
}
3 changes: 1 addition & 2 deletions pkg/noun/v3/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 1 addition & 5 deletions pkg/noun/v3/vortex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
**/
Expand All @@ -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.
Expand Down

0 comments on commit 0428a69

Please sign in to comment.