Merge branch 'master' into typedclay

Conflicts:
	urb/urbit.pill
	urb/zod/arvo/ford.hoon
	urb/zod/main/app/cat/core.hook
	urb/zod/main/app/ls/core.hook
	urb/zod/main/app/reload/core.hook
	urb/zod/main/app/shell/core.hook
	urb/zod/main/app/solid/core.hook
This commit is contained in:
Philip C Monk 2015-01-15 16:21:11 -05:00
commit 0f2db4bd57
14 changed files with 131 additions and 69 deletions

View File

@ -41,7 +41,7 @@
/* u3a_fbox_no: number of free lists per size. /* u3a_fbox_no: number of free lists per size.
*/ */
# define u3a_fbox_no 28 # define u3a_fbox_no 27
/** Structures. /** Structures.
@ -125,6 +125,7 @@
struct { // allocation pools struct { // allocation pools
u3p(u3a_fbox) fre_p[u3a_fbox_no]; // heap by node size log u3p(u3a_fbox) fre_p[u3a_fbox_no]; // heap by node size log
u3p(u3a_fbox) cel_p; // custom cell allocator
c3_w fre_w; // number of free words c3_w fre_w; // number of free words
} all; } all;
@ -276,6 +277,11 @@
void* void*
u3a_walloc(c3_w len_w); u3a_walloc(c3_w len_w);
/* u3a_celloc(): allocate a cell. Faster, sometimes.
*/
c3_w*
u3a_celloc(void);
/* u3a_wfree(): free storage. /* u3a_wfree(): free storage.
*/ */
void void

View File

@ -16,7 +16,9 @@
c3_o noc_o; // now executing in nock interpreter c3_o noc_o; // now executing in nock interpreter
c3_o glu_o; // now executing in jet glue c3_o glu_o; // now executing in jet glue
c3_o mal_o; // now executing in allocator c3_o mal_o; // now executing in allocator
c3_o far_o; // now executing in fragmentor. c3_o far_o; // now executing in fragmentor
c3_o coy_o; // now executing in copy
c3_o euq_o; // now executing in equal
} u3t_trace; } u3t_trace;
/** Macros. /** Macros.

View File

@ -18,6 +18,10 @@
return u3m_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3n_nock_in(u3k(fly), u3k(bus), u3k(fol)); u3_noun som;
som = u3n_nock_in(u3k(fly), u3k(bus), u3k(fol));
return som;
} }
} }

View File

@ -560,7 +560,7 @@
{ {
return u3nt return u3nt
(c3__sggr, (c3__sggr,
u3nc(c3__yelp, u3k(p_gen)), u3nc(c3__mean, u3k(p_gen)),
u3k(q_gen)); u3k(q_gen));
} }
_open_do_pq(sggl) // ~> _open_do_pq(sggl) // ~>
@ -652,15 +652,23 @@
} }
_open_do_pqrs(sgwt) // ~? _open_do_pqrs(sgwt) // ~?
{ {
return u3nq(c3__tsgl, return u3nt
u3k(s_gen), (c3__tsls,
c3__wtdt, u3nq(c3__wtdt,
u3nq(u3k(q_gen), u3k(q_gen),
u3nc(u3_nul, 1), u3nc(c3__bczp, c3__null),
c3__sgpm, u3nc(u3nc(c3__bczp, c3__null), u3k(r_gen))),
u3nt(u3k(p_gen), u3nq(c3__wtsg,
u3k(r_gen), u3nc(u3nc(u3_nul, 2),u3_nul),
u3nc(u3_nul, 1)))); u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(s_gen)),
u3nq(c3__sgpm,
u3k(p_gen),
u3nc(u3_nul, 5),
u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(s_gen)))));
} }
/*** /***
**** ****
@ -713,7 +721,7 @@
u3nt(c3__tsls, u3nt(c3__tsls,
u3nt(c3__ktts, c3__a, u3nt(c3__ktts, c3__a,
u3nt(c3__tsgr, u3nc(c3__cnzy, c3__v), u3nt(c3__tsgr, u3nc(c3__cnzy, c3__v),
u3k(p_gen))), u3nc(c3__bccm, u3k(p_gen)))),
u3nt(c3__tsls, u3nt(c3__tsls,
u3nt(c3__ktts, c3__b, u3nt(c3__ktts, c3__b,
u3nt(c3__tsgr, u3nt(c3__tsgr,

View File

@ -117,7 +117,7 @@ static u3j_harm _mood__hoon_rexp_a[] = {{".2", u3we_rexp}, {}};
static u3j_harm _mood__hoon_trip_a[] = {{".2", u3we_trip}, {}}; static u3j_harm _mood__hoon_trip_a[] = {{".2", u3we_trip}, {}};
static u3j_harm _mood__hoon__aesc_en_a[] = {{".2", u3wea_en}, {}}; static u3j_harm _mood__hoon__aesc_en_a[] = {{".2", u3wea_en}, {}};
static u3j_harm _mood__hoon__aesc_de_a[] = {{".2", u3wea_en}, {}}; static u3j_harm _mood__hoon__aesc_de_a[] = {{".2", u3wea_de}, {}};
static u3j_core _mood__hoon__aesc_d[] = static u3j_core _mood__hoon__aesc_d[] =
{ { "en", _mood__hoon__aesc_en_a }, { { "en", _mood__hoon__aesc_en_a },
{ "de", _mood__hoon__aesc_de_a }, { "de", _mood__hoon__aesc_de_a },

73
n/a.c
View File

@ -529,28 +529,6 @@ u3a_calloc(size_t num_i, size_t len_i)
return out_w; return out_w;
} }
#if 0
/* u3a_malloc(): allocate storage measured in bytes.
*/
void*
u3a_malloc(size_t len_i)
{
c3_w len_w = (c3_w)len_i;
return u3a_walloc((len_w + 3) >> 2);
}
/* u3a_realloc(): realloc in bytes.
*/
void*
u3a_realloc(void* lag_v, size_t len_i)
{
c3_w len_w = (c3_w)len_i;
return u3a_wealloc(lag_v, (len_w + 3) >> 2);
}
#else
/* u3a_malloc(): aligned storage measured in bytes. /* u3a_malloc(): aligned storage measured in bytes.
*/ */
void* void*
@ -576,6 +554,43 @@ u3a_malloc(size_t len_i)
return out_w; return out_w;
} }
/* u3a_celloc(): allocate a cell.
*/
c3_w*
u3a_celloc(void)
{
u3p(u3a_fbox) cel_p;
if ( (u3R == &(u3H->rod_u)) || !(cel_p = u3R->all.cel_p) ) {
return u3a_walloc(c3_wiseof(u3a_cell));
}
else {
u3a_box* box_u = &(u3to(u3a_fbox, cel_p)->box_u);
box_u->use_w = 1;
u3R->all.cel_p = u3to(u3a_fbox, cel_p)->nex_p;
return u3a_boxto(box_u);
}
}
/* u3a_cfree(): free a cell.
*/
void
u3a_cfree(c3_w* cel_w)
{
if ( u3R == &(u3H->rod_u) ) {
return u3a_wfree(cel_w);
}
else {
u3a_box* box_u = u3a_botox(cel_w);
u3p(u3a_fbox) fre_p = u3of(u3a_fbox, box_u);
u3to(u3a_fbox, fre_p)->nex_p = u3R->all.cel_p;
u3R->all.cel_p = fre_p;
}
}
/* u3a_realloc(): aligned realloc in bytes. /* u3a_realloc(): aligned realloc in bytes.
*/ */
void* void*
@ -639,7 +654,6 @@ u3a_free2(void* tox_v, size_t siz_i)
{ {
return u3a_free(tox_v); return u3a_free(tox_v);
} }
#endif
#if 1 #if 1
/* _me_wash_north(): clean up mug slots after copy. /* _me_wash_north(): clean up mug slots after copy.
@ -1045,9 +1059,14 @@ u3a_take(u3_noun som)
return som; return som;
} }
else { else {
return _(u3a_is_north(u3R)) u3t_on(coy_o);
som = _(u3a_is_north(u3R))
? _me_take_north(som) ? _me_take_north(som)
: _me_take_south(som); : _me_take_south(som);
u3t_off(coy_o);
return som;
} }
} }
@ -1138,7 +1157,7 @@ top:
if ( !_(u3a_is_cat(h_dog)) ) { if ( !_(u3a_is_cat(h_dog)) ) {
_me_lose_north(h_dog); _me_lose_north(h_dog);
} }
u3a_wfree(dog_w); u3a_cfree(dog_w);
if ( !_(u3a_is_cat(t_dog)) ) { if ( !_(u3a_is_cat(t_dog)) ) {
dog = t_dog; dog = t_dog;
goto top; goto top;
@ -1178,7 +1197,7 @@ top:
if ( !_(u3a_is_cat(h_dog)) ) { if ( !_(u3a_is_cat(h_dog)) ) {
_me_lose_south(h_dog); _me_lose_south(h_dog);
} }
u3a_wfree(dog_w); u3a_cfree(dog_w);
if ( !_(u3a_is_cat(t_dog)) ) { if ( !_(u3a_is_cat(t_dog)) ) {
dog = t_dog; dog = t_dog;
goto top; goto top;
@ -1512,7 +1531,7 @@ u3a_sweep(void)
c3_w* c3_w*
u3a_slab(c3_w len_w) u3a_slab(c3_w len_w)
{ {
c3_w* nov_w = u3a_walloc(len_w + c3_wiseof(u3a_atom)); c3_w* nov_w = u3a_walloc(len_w + c3_wiseof(u3a_atom));
u3a_atom* pug_u = (void *)nov_w; u3a_atom* pug_u = (void *)nov_w;
pug_u->mug_w = 0; pug_u->mug_w = 0;

6
n/e.c
View File

@ -820,10 +820,12 @@ u3e_live(c3_o nuu_o, c3_c* dir_c)
u3P.nor_u.nam_c = "north"; u3P.nor_u.nam_c = "north";
u3P.sou_u.nam_c = "south"; u3P.sou_u.nam_c = "south";
#if 0
if ( u3C.wag_w & u3o_dryrun ) { if ( u3C.wag_w & u3o_dryrun ) {
return c3y; return c3y;
} } else
else { #endif
{
/* Open and apply any patches. /* Open and apply any patches.
*/ */
if ( _(nuu_o) ) { if ( _(nuu_o) ) {

3
n/i.c
View File

@ -208,7 +208,8 @@ u3i_cell(u3_noun a, u3_noun b)
c3_assert(!_(u3a_is_junior(u3R, b))); c3_assert(!_(u3a_is_junior(u3R, b)));
{ {
c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell)); // c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell));
c3_w* nov_w = u3a_celloc();
u3a_cell* nov_u = (void *)nov_w; u3a_cell* nov_u = (void *)nov_w;
u3_noun pro; u3_noun pro;

4
n/j.c
View File

@ -305,8 +305,7 @@ _cj_hot_mean(c3_l par_l, u3_noun mop, u3_noun bat)
return 0; return 0;
} }
/* _cj_hot_mine(): in hot state, declare a core. RETAINS.
/* _cj_hot_mine(): in hoting state, declare a core. RETAINS.
*/ */
static c3_l static c3_l
_cj_hot_mine(u3_noun mop, u3_noun cor) _cj_hot_mine(u3_noun mop, u3_noun cor)
@ -909,6 +908,7 @@ _cj_warm_reap(u3_noun kev)
if ( !_(u3a_is_junior(u3R, bat)) && if ( !_(u3a_is_junior(u3R, bat)) &&
(u3_none != u3h_git(u3R->jed.har_p, bat)) ) { (u3_none != u3h_git(u3R->jed.har_p, bat)) ) {
fprintf(stderr, "reap: promote collision (bat %x)\r\n", u3r_mug(bat)); fprintf(stderr, "reap: promote collision (bat %x)\r\n", u3r_mug(bat));
u3m_p("collision", u3h(u3t(u3t(u3h(cax)))));
} }
else { else {
u3_noun tab = u3a_take(bat); u3_noun tab = u3a_take(bat);

39
n/m.c
View File

@ -18,7 +18,7 @@
c3_o c3_o
u3m_trap(void); u3m_trap(void);
#else #else
# define u3m_trap() (u3_noun)(setjmp(u3R->esc.buf)) # define u3m_trap() (u3_noun)(_setjmp(u3R->esc.buf))
#endif #endif
/* u3m_signal(): treat a nock-level exception as a signal interrupt. /* u3m_signal(): treat a nock-level exception as a signal interrupt.
@ -725,18 +725,19 @@ u3m_hate(c3_w pad_w)
u3_noun u3_noun
u3m_love(u3_noun pro) u3m_love(u3_noun pro)
{ {
u3_noun das = u3R->jed.das; {
u3p(u3h_root) har_p = u3R->jed.har_p; u3_noun das = u3R->jed.das;
u3p(u3h_root) har_p = u3R->jed.har_p;
u3m_fall(); u3m_fall();
pro = u3a_take(pro); pro = u3a_take(pro);
u3j_reap(das, har_p); u3j_reap(das, har_p);
u3R->cap_p = u3R->ear_p;
u3R->ear_p = 0;
u3R->cap_p = u3R->ear_p;
u3R->ear_p = 0;
}
return pro; return pro;
} }
@ -822,7 +823,7 @@ u3m_soft_top(c3_w sec_w, // timer seconds
/* Trap for ordinary nock exceptions. /* Trap for ordinary nock exceptions.
*/ */
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) { if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) {
pro = fun_f(arg); pro = fun_f(arg);
/* Make sure the inner routine did not create garbage. /* Make sure the inner routine did not create garbage.
@ -894,11 +895,11 @@ u3m_soft_nock(u3_noun bus, u3_noun fol)
*/ */
u3_noun u3_noun
u3m_soft_run(u3_noun fly, u3m_soft_run(u3_noun fly,
u3_funq fun_f, u3_funq fun_f,
u3_noun aga, u3_noun aga,
u3_noun agb) u3_noun agb)
{ {
u3_noun why, pro; u3_noun why = 0, pro;
/* Record the cap, and leap. /* Record the cap, and leap.
*/ */
@ -911,16 +912,14 @@ u3m_soft_run(u3_noun fly,
u3R->pro.don = u3R->par_u->pro.don; u3R->pro.don = u3R->par_u->pro.don;
u3R->bug.tax = 0; u3R->bug.tax = 0;
} }
u3t_on(coy_o);
/* Trap for exceptions. /* Trap for exceptions.
*/ */
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) { if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) {
u3t_off(coy_o);
pro = fun_f(aga, agb); pro = fun_f(aga, agb);
if ( u3C.wag_w & u3o_debug_ram ) {
u3m_grab(pro, u3_none);
}
/* Produce success, on the old road. /* Produce success, on the old road.
*/ */
pro = u3nc(0, u3m_love(pro)); pro = u3nc(0, u3m_love(pro));
@ -1004,7 +1003,7 @@ u3m_soft_esc(u3_noun sam)
/* Trap for exceptions. /* Trap for exceptions.
*/ */
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) { if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) {
pro = u3n_slam_on(fly, sam); pro = u3n_slam_on(fly, sam);
/* Fall back to the old road, leaving temporary memory intact. /* Fall back to the old road, leaving temporary memory intact.

8
n/r.c
View File

@ -711,7 +711,13 @@ c3_o
u3r_sing(u3_noun a, u3r_sing(u3_noun a,
u3_noun b) u3_noun b)
{ {
return _sing_x(a, b); c3_o ret_o;
u3t_on(euq_o);
ret_o = _sing_x(a, b);
u3t_off(euq_o);
return ret_o;
} }
/* u3r_sung(): yes iff (a) and (b) are the same noun, unifying equals. /* u3r_sung(): yes iff (a) and (b) are the same noun, unifying equals.

8
n/t.c
View File

@ -196,6 +196,12 @@ u3t_samp(void)
if ( _(u3T.mal_o) ) { if ( _(u3T.mal_o) ) {
mot_l = c3_s3('m','a','l'); mot_l = c3_s3('m','a','l');
} }
else if ( _(u3T.coy_o) ) {
mot_l = c3_s3('c','o','y');
}
else if ( _(u3T.euq_o) ) {
mot_l = c3_s3('e','u','q');
}
else if ( _(u3T.far_o) ) { else if ( _(u3T.far_o) ) {
mot_l = c3_s3('f','a','r'); mot_l = c3_s3('f','a','r');
} }
@ -285,6 +291,8 @@ u3t_init(void)
u3T.glu_o = c3n; u3T.glu_o = c3n;
u3T.mal_o = c3n; u3T.mal_o = c3n;
u3T.far_o = c3n; u3T.far_o = c3n;
u3T.coy_o = c3n;
u3T.euq_o = c3n;
} }
/* u3t_boot(): turn sampling on. /* u3t_boot(): turn sampling on.

View File

@ -646,6 +646,7 @@ u3_lo_loop()
u3_raft_init(); u3_raft_init();
#if 1
if ( _(u3_Host.ops_u.dry) ) { if ( _(u3_Host.ops_u.dry) ) {
u3t_boff(); u3t_boff();
u3t_damp(); u3t_damp();
@ -654,7 +655,9 @@ u3_lo_loop()
fprintf(stderr, "dry run: exit\r\n"); fprintf(stderr, "dry run: exit\r\n");
exit(0); exit(0);
} }
else { else
#endif
{
if ( c3n == u3_Host.ops_u.bat ) { if ( c3n == u3_Host.ops_u.bat ) {
uv_run(u3L, UV_RUN_DEFAULT); uv_run(u3L, UV_RUN_DEFAULT);
} }

View File

@ -72,6 +72,10 @@ u3_temp_io_poll(void)
{ {
c3_d gap_d = u3_time_gap_ms(u3k(u3A->now), u3k(u3t(wen))); c3_d gap_d = u3_time_gap_ms(u3k(u3A->now), u3k(u3t(wen)));
#if 0
fprintf(stderr, "gap_d %llu, plus %llu\r\n",
gap_d, gap_d + (c3_d)teh_u->run_w);
#endif
gap_d += teh_u->run_w; gap_d += teh_u->run_w;
if ( c3y == teh_u->alm ) { if ( c3y == teh_u->alm ) {