Merge branch 'radio'

Conflicts:
	urb/urbit.pill
	urb/zod/arvo/hoon.hoon
	urb/zod/main/app/talk/core.hook
This commit is contained in:
C. Guy Yarvin 2015-01-15 12:02:28 -08:00
commit fb2afb4417
12 changed files with 111 additions and 57 deletions

View File

@ -41,7 +41,7 @@
/* u3a_fbox_no: number of free lists per size.
*/
# define u3a_fbox_no 28
# define u3a_fbox_no 27
/** Structures.
@ -125,6 +125,7 @@
struct { // allocation pools
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
} all;
@ -276,6 +277,11 @@
void*
u3a_walloc(c3_w len_w);
/* u3a_celloc(): allocate a cell. Faster, sometimes.
*/
c3_w*
u3a_celloc(void);
/* u3a_wfree(): free storage.
*/
void

View File

@ -16,7 +16,9 @@
c3_o noc_o; // now executing in nock interpreter
c3_o glu_o; // now executing in jet glue
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;
/** Macros.

View File

@ -18,6 +18,10 @@
return u3m_bail(c3__exit);
}
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;
}
}

71
n/a.c
View File

@ -529,28 +529,6 @@ u3a_calloc(size_t num_i, size_t len_i)
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.
*/
void*
@ -576,6 +554,43 @@ u3a_malloc(size_t len_i)
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.
*/
void*
@ -639,7 +654,6 @@ u3a_free2(void* tox_v, size_t siz_i)
{
return u3a_free(tox_v);
}
#endif
#if 1
/* _me_wash_north(): clean up mug slots after copy.
@ -1045,9 +1059,14 @@ u3a_take(u3_noun som)
return som;
}
else {
return _(u3a_is_north(u3R))
u3t_on(coy_o);
som = _(u3a_is_north(u3R))
? _me_take_north(som)
: _me_take_south(som);
u3t_off(coy_o);
return som;
}
}
@ -1138,7 +1157,7 @@ top:
if ( !_(u3a_is_cat(h_dog)) ) {
_me_lose_north(h_dog);
}
u3a_wfree(dog_w);
u3a_cfree(dog_w);
if ( !_(u3a_is_cat(t_dog)) ) {
dog = t_dog;
goto top;
@ -1178,7 +1197,7 @@ top:
if ( !_(u3a_is_cat(h_dog)) ) {
_me_lose_south(h_dog);
}
u3a_wfree(dog_w);
u3a_cfree(dog_w);
if ( !_(u3a_is_cat(t_dog)) ) {
dog = t_dog;
goto top;

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.sou_u.nam_c = "south";
#if 0
if ( u3C.wag_w & u3o_dryrun ) {
return c3y;
}
else {
} else
#endif
{
/* Open and apply any patches.
*/
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_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;
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;
}
/* _cj_hot_mine(): in hoting state, declare a core. RETAINS.
/* _cj_hot_mine(): in hot state, declare a core. RETAINS.
*/
static c3_l
_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)) &&
(u3_none != u3h_git(u3R->jed.har_p, bat)) ) {
fprintf(stderr, "reap: promote collision (bat %x)\r\n", u3r_mug(bat));
u3m_p("collision", u3h(u3t(u3t(u3h(cax)))));
}
else {
u3_noun tab = u3a_take(bat);

19
n/m.c
View File

@ -18,7 +18,7 @@
c3_o
u3m_trap(void);
#else
# define u3m_trap() (u3_noun)(setjmp(u3R->esc.buf))
# define u3m_trap() (u3_noun)(_setjmp(u3R->esc.buf))
#endif
/* u3m_signal(): treat a nock-level exception as a signal interrupt.
@ -725,6 +725,7 @@ u3m_hate(c3_w pad_w)
u3_noun
u3m_love(u3_noun pro)
{
{
u3_noun das = u3R->jed.das;
u3p(u3h_root) har_p = u3R->jed.har_p;
@ -736,7 +737,7 @@ u3m_love(u3_noun pro)
u3R->cap_p = u3R->ear_p;
u3R->ear_p = 0;
}
return pro;
}
@ -822,7 +823,7 @@ u3m_soft_top(c3_w sec_w, // timer seconds
/* 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);
/* Make sure the inner routine did not create garbage.
@ -898,7 +899,7 @@ u3m_soft_run(u3_noun fly,
u3_noun aga,
u3_noun agb)
{
u3_noun why, pro;
u3_noun why = 0, pro;
/* Record the cap, and leap.
*/
@ -911,16 +912,14 @@ u3m_soft_run(u3_noun fly,
u3R->pro.don = u3R->par_u->pro.don;
u3R->bug.tax = 0;
}
u3t_on(coy_o);
/* 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);
if ( u3C.wag_w & u3o_debug_ram ) {
u3m_grab(pro, u3_none);
}
/* Produce success, on the old road.
*/
pro = u3nc(0, u3m_love(pro));
@ -1004,7 +1003,7 @@ u3m_soft_esc(u3_noun sam)
/* 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);
/* 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,
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.

8
n/t.c
View File

@ -196,6 +196,12 @@ u3t_samp(void)
if ( _(u3T.mal_o) ) {
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) ) {
mot_l = c3_s3('f','a','r');
}
@ -285,6 +291,8 @@ u3t_init(void)
u3T.glu_o = c3n;
u3T.mal_o = c3n;
u3T.far_o = c3n;
u3T.coy_o = c3n;
u3T.euq_o = c3n;
}
/* u3t_boot(): turn sampling on.

View File

@ -646,6 +646,7 @@ u3_lo_loop()
u3_raft_init();
#if 1
if ( _(u3_Host.ops_u.dry) ) {
u3t_boff();
u3t_damp();
@ -654,7 +655,9 @@ u3_lo_loop()
fprintf(stderr, "dry run: exit\r\n");
exit(0);
}
else {
else
#endif
{
if ( c3n == u3_Host.ops_u.bat ) {
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)));
#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;
if ( c3y == teh_u->alm ) {