Skip to content

Commit

Permalink
serf: reclaim from persistent memoization cache (#549)
Browse files Browse the repository at this point in the history
This PR builds on #546, extending it's more-granular state management to
the persistent memoization cache introduced in #508
  • Loading branch information
pkova authored Nov 10, 2023
2 parents 6f63ab0 + 9ca215d commit c4be31e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/vere/serf.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,20 @@ u3_serf_grab(void)
void
u3_serf_post(u3_serf* sef_u)
{
if ( sef_u->fag_w & (_serf_fag_hit1|_serf_fag_much|_serf_fag_vega) ) {
if ( sef_u->fag_w & _serf_fag_hit1 ) {
if ( u3C.wag_w & u3o_verbose ) {
u3l_log("serf: threshold 1: %u", u3h_wyt(u3R->cax.per_p));
}
u3h_trim_to(u3R->cax.per_p, u3h_wyt(u3R->cax.per_p) / 2);
u3m_reclaim();
}

if ( sef_u->fag_w & _serf_fag_much ) {
u3m_reclaim();
}

if ( sef_u->fag_w & _serf_fag_vega ) {
u3h_trim_to(u3R->cax.per_p, u3h_wyt(u3R->cax.per_p) / 2);
u3m_reclaim();
}

Expand All @@ -205,6 +218,11 @@ u3_serf_post(u3_serf* sef_u)
}

if ( sef_u->fag_w & _serf_fag_hit0 ) {
if ( u3C.wag_w & u3o_verbose ) {
u3l_log("serf: threshold 0: per_p %u", u3h_wyt(u3R->cax.per_p));
}
u3h_free(u3R->cax.per_p);
u3R->cax.per_p = u3h_new_cache(u3C.per_w);
u3a_print_memory(stderr, "serf: pack: gained", u3m_pack());
u3l_log("");
}
Expand Down

0 comments on commit c4be31e

Please sign in to comment.