Skip to content

Commit

Permalink
janked
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Aug 29, 2023
1 parent 2adeb71 commit 5b68c5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 8 additions & 3 deletions pkg/noun/allocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ _ca_reclaim_half(void)
u3m_bail(c3__meme);
}
// XX reclaim from persistent cache?
// fprintf(stderr, "allocate: checking if persistent cache is empty\r\n");
// if ( (0 == u3R->cax.per_p) ||
// (0 == u3to(u3h_root, u3R->cax.per_p)->use_w) )
// {
Expand All @@ -443,10 +444,10 @@ _ca_reclaim_half(void)
u3h_trim_to(u3R->cax.har_p, u3to(u3h_root, u3R->cax.har_p)->use_w / 2);

// XX reclaim from persistent cache?
fprintf(stderr, "allocate: reclaim: half of %d entries\r\n",
u3to(u3h_root, u3R->cax.per_p)->use_w);
// fprintf(stderr, "allocate: reclaim: half of %d persistent entries\r\n",
// u3to(u3h_root, u3R->cax.per_p)->use_w);

u3h_trim_to(u3R->cax.per_p, u3to(u3h_root, u3R->cax.per_p)->use_w / 2);
// u3h_trim_to(u3R->cax.per_p, u3to(u3h_root, u3R->cax.per_p)->use_w / 2);
#else
/* brutal and guaranteed effective
*/
Expand Down Expand Up @@ -2168,6 +2169,7 @@ u3a_mark_road(FILE* fil_u)
tot_w += u3a_maid(fil_u, " profile doss", u3a_mark_noun(u3R->pro.day));
tot_w += u3a_maid(fil_u, " new profile trace", u3a_mark_noun(u3R->pro.trace));
tot_w += u3a_maid(fil_u, " transient memoization cache", u3h_mark(u3R->cax.har_p));
fprintf(stderr, "u3a_mark_road: persistent cache\r\n");
tot_w += u3a_maid(fil_u, " persistent memoization cache", u3h_mark(u3R->cax.per_p));
return u3a_maid(fil_u, "total road stuff", tot_w);
}
Expand All @@ -2183,6 +2185,7 @@ u3a_reclaim(void)
u3R->cax.har_p = u3h_new();

// XX clear the persistent cache?
fprintf(stderr, "u3a_reclaim: freeing persistent cache\r\n");
// u3h_free(u3R->cax.per_p);
// u3R->cax.per_p = u3h_new();
}
Expand All @@ -2200,6 +2203,7 @@ u3a_rewrite_compact(void)
u3a_rewrite_noun(u3R->pro.trace);
u3h_rewrite(u3R->cax.har_p);
// XX rewrite persistent cache?
fprintf(stderr, "u3a_rewrite_compact: rewrite persistent cache\r\n");
// u3h_rewrite(u3R->cax.per_p);

u3R->ski.gul = u3a_rewritten_noun(u3R->ski.gul);
Expand All @@ -2210,6 +2214,7 @@ u3a_rewrite_compact(void)
u3R->pro.trace = u3a_rewritten_noun(u3R->pro.trace);
u3R->cax.har_p = u3a_rewritten(u3R->cax.har_p);
// XX persistent cache?
fprintf(stderr, "u3a_rewrite_compact: rewritten persistent cache\r\n");
// u3R->cax.per_p = u3a_rewritten(u3R->cax.per_p);
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/noun/jets.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ _cj_nail(u3_noun loc, u3_noun axe,
u3_noun jax, hap, bal, jit;
u3_weak act;
act = _cj_find_warm(loc);
if ( u3_none == act ) {
fprintf(stderr, "_cj_nail: %p\r\n", u3a_into(u3H->rod_u.jed.war_p));
}
u3_assert(u3_none != act);
u3x_qual(act, &jax, &hap, &bal, &jit);

Expand Down
9 changes: 5 additions & 4 deletions pkg/noun/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ _find_home(void)
{
c3_w ver_w = *(u3_Loom + u3C.wor_i - 1); // XX only *happens* to be u3H->ver_w
u3a_config_loom(ver_w);
fprintf(stderr, "loom: found home road version %u\r\n", ver_w);

// NB: the home road is always north
//
Expand All @@ -613,7 +612,7 @@ _find_home(void)
c3_w siz_w = c3_wiseof(u3v_home);
c3_w *mat_w = c3_align(mem_w + len_w - siz_w, u3C.balign_d, C3_ALGLO);

if ( U3V_VER3 > ver_w ) {
if ( U3V_VER1 > ver_w ) {
u3m_migrate(ver_w, U3V_VER3);
}

Expand Down Expand Up @@ -653,7 +652,8 @@ _find_home(void)
/* As a further guard against any sneaky loom corruption */
u3a_loom_sane();

if (U3V_VERLAT > u3H->ver_w || MIG_NEED_V2 == u3C.migration_state ) {
if ( ( U3V_VERLAT > u3H->ver_w ) ||
( MIG_NEED_V2 == u3C.migration_state ) ) {
u3m_migrate(u3H->ver_w, U3V_VERLAT);
u3a_config_loom(U3V_VERLAT);
}
Expand Down Expand Up @@ -2461,7 +2461,8 @@ _migrate_memoization()
// copy old arvo to new arvo
memcpy(&hum_u->arv_u, &hum_u->arv_u, sizeof(u3v_arvo));

fprintf(stderr, "loom: memoization migration done\r\n");
u3v_home tes_u = *((u3v_home *)mat_w);
fprintf(stderr, "_migrate_memoization: %p\r\n", u3a_into(tes_u.rod_u.jed.war_p));
}

/* u3m_migrate: perform loom migration if necessary.
Expand Down

0 comments on commit 5b68c5f

Please sign in to comment.