serf: updates grab to fallback to old output on error

This commit is contained in:
Joe Bryan 2021-10-02 21:39:48 -04:00
parent 87d9398a31
commit 46dd61d547
2 changed files with 31 additions and 14 deletions

View File

@ -1236,6 +1236,7 @@
# define c3__werp c3_s4('w','e','r','p')
# define c3__west c3_s4('w','e','s','t')
# define c3__what c3_s4('w','h','a','t')
# define c3__whey c3_s4('w','h','e','y')
# define c3__whom c3_s4('w','h','o','m')
# define c3__wing c3_s4('w','i','n','g')
# define c3__wild c3_s4('w','i','l','d')

View File

@ -273,28 +273,44 @@ u3_serf_grab(void)
c3_assert( u3R == &(u3H->rod_u) );
{
u3_noun pax = u3nc(u3i_string("whey"), u3_nul);
u3_noun sam, gon;
{
u3_noun pax = u3nc(c3__whey, u3_nul);
u3_noun lyc = u3nc(u3_nul, u3_nul);
u3_noun sam = u3nt(lyc, c3n, u3nq(c3__once, u3_blip, u3_blip, pax));
u3_noun gon = u3m_soft(0, u3v_peek, sam);
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_pq(u3t(dat), c3__omen, 0, &val))
&& (c3y == u3r_p(val, c3__mass, &sac)) )
{
u3r_p(val, c3__mass, &sac);
u3k(sac);
}
}
u3z(gon);
}
fprintf(stderr, "serf: measuring memory:\r\n");
// XX refactor to fallback if sac is ~
//
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");
}
fflush(stderr);
}