mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
added U3_CELLOC_TOGGLE
This commit is contained in:
parent
3155535c80
commit
1edf15843f
6
i/n/a.h
6
i/n/a.h
@ -8,6 +8,12 @@
|
||||
*/
|
||||
# undef U3_MEMORY_DEBUG
|
||||
|
||||
/* U3_CELLOC_TOGGLE: enable toggling of the custum cell allocator
|
||||
* via -g. This slightly slows down the cell allocator even when
|
||||
* it's on. Note that toggling -g breaks the image. If
|
||||
* U3_MEMORY_DEBUG is on, this should generally be on as well.
|
||||
*/
|
||||
# define U3_CELLOC_TOGGLE
|
||||
|
||||
/** Constants.
|
||||
**/
|
||||
|
33
n/a.c
33
n/a.c
@ -561,9 +561,12 @@ u3a_malloc(size_t len_i)
|
||||
c3_w*
|
||||
u3a_celloc(void)
|
||||
{
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
return u3a_walloc(c3_wiseof(u3a_cell));
|
||||
#else
|
||||
#ifdef U3_CELLOC_TOGGLE
|
||||
if ( u3C.wag_w & u3o_debug_ram ) {
|
||||
return u3a_walloc(c3_wiseof(u3a_cell));
|
||||
}
|
||||
#endif
|
||||
|
||||
u3p(u3a_fbox) cel_p;
|
||||
|
||||
if ( (u3R == &(u3H->rod_u)) || !(cel_p = u3R->all.cel_p) ) {
|
||||
@ -577,7 +580,6 @@ u3a_celloc(void)
|
||||
|
||||
return u3a_boxto(box_u);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* u3a_cfree(): free a cell.
|
||||
@ -585,9 +587,12 @@ u3a_celloc(void)
|
||||
void
|
||||
u3a_cfree(c3_w* cel_w)
|
||||
{
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
return u3a_wfree(cel_w);
|
||||
#else
|
||||
#ifdef U3_CELLOC_TOGGLE
|
||||
if ( u3C.wag_w & u3o_debug_ram ) {
|
||||
return u3a_wfree(cel_w);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( u3R == &(u3H->rod_u) ) {
|
||||
return u3a_wfree(cel_w);
|
||||
}
|
||||
@ -598,7 +603,6 @@ u3a_cfree(c3_w* cel_w)
|
||||
u3to(u3a_fbox, fre_p)->nex_p = u3R->all.cel_p;
|
||||
u3R->all.cel_p = fre_p;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* u3a_realloc(): aligned realloc in bytes.
|
||||
@ -1335,10 +1339,10 @@ u3a_mark_ptr(void* ptr_v)
|
||||
use_ws -= 1;
|
||||
siz_w = 0;
|
||||
}
|
||||
// else if ( 0x80000000 == (c3_w)use_ws ) { // see _raft_prof()
|
||||
// use_ws = -1;
|
||||
// siz_w = 0xffffffff;
|
||||
// }
|
||||
else if ( 0x80000000 == (c3_w)use_ws ) { // see _raft_prof()
|
||||
use_ws = -1;
|
||||
siz_w = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
use_ws = -1;
|
||||
siz_w = box_u->siz_w;
|
||||
@ -1479,10 +1483,7 @@ u3a_sweep(void)
|
||||
(u3_noun)u3a_to_pom(u3a_outa(u3a_boxto(box_w))),
|
||||
((u3a_noun *)(u3a_boxto(box_w)))->mug_w,
|
||||
box_u->use_w, box_u->eus_w);
|
||||
//static int xuc_i = 0;
|
||||
//if ( 2 != ++xuc_i && 3 != xuc_i ) {
|
||||
// u3m_p("weak", u3a_to_pom(u3a_outa(u3a_boxto(box_w))));
|
||||
//}
|
||||
// u3m_p("weak", u3a_to_pom(u3a_outa(u3a_boxto(box_w))));
|
||||
}
|
||||
weq_w += box_u->siz_w;
|
||||
}
|
||||
|
7
v/raft.c
7
v/raft.c
@ -1847,6 +1847,10 @@ static void
|
||||
_raft_grab(u3_noun ova)
|
||||
{
|
||||
if ( u3_nul != u3A->sac ) {
|
||||
if ( !(u3C.wag_w & u3o_debug_ram) ) {
|
||||
fprintf(stderr, "massing doesn't work without the -g flag\r\n");
|
||||
goto _raft_grab_end;
|
||||
}
|
||||
c3_w usr_w = 0, ova_w = 0, sac_w = 0, utv_w = 0, utm_w = 0, wep_w = 0;
|
||||
|
||||
usr_w = _raft_prof(u3_nul, 0, u3A->sac);
|
||||
@ -1876,10 +1880,9 @@ _raft_grab(u3_noun ova)
|
||||
fprintf(stderr, "sweep: ");
|
||||
_raft_print_memory(wep_w);
|
||||
|
||||
_raft_grab_end:
|
||||
u3z(u3A->sac);
|
||||
u3A->sac = u3_nul;
|
||||
} else {
|
||||
// u3m_grab(ova, u3_none);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user