mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-24 18:44:07 +03:00
u3: ports new arvo invocations for boot and +poke
This commit is contained in:
parent
535c49d2db
commit
fdafdf1f12
@ -87,6 +87,11 @@
|
||||
u3_noun
|
||||
u3v_poke(u3_noun ovo);
|
||||
|
||||
/* u3v_poke_sure(): inject an event, saving new state if successful.
|
||||
*/
|
||||
c3_o
|
||||
u3v_poke_sure(c3_w mil_w, u3_noun eve, u3_noun* pro);
|
||||
|
||||
/* u3v_tank(): dump single tank.
|
||||
*/
|
||||
void
|
||||
|
@ -27,9 +27,18 @@ u3v_life(u3_noun eve)
|
||||
c3_o
|
||||
u3v_boot(u3_noun eve)
|
||||
{
|
||||
c3_d len_d;
|
||||
|
||||
{
|
||||
u3_noun len = u3qb_lent(eve);
|
||||
c3_assert( c3y == u3r_safe_chub(len, &len_d) );
|
||||
u3z(len);
|
||||
}
|
||||
|
||||
// ensure zero-initialized kernel
|
||||
//
|
||||
u3A->roc = 0;
|
||||
u3A->roc = 0;
|
||||
u3A->eve_d = 0;
|
||||
|
||||
{
|
||||
u3_noun pro = u3m_soft(0, u3v_life, eve);
|
||||
@ -39,7 +48,8 @@ u3v_boot(u3_noun eve)
|
||||
return c3n;
|
||||
}
|
||||
|
||||
u3A->roc = u3k(u3t(pro));
|
||||
u3A->roc = u3k(u3t(pro));
|
||||
u3A->eve_d = len_d;
|
||||
u3z(pro);
|
||||
}
|
||||
|
||||
@ -260,6 +270,61 @@ u3v_poke(u3_noun ovo)
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* _cv_poke_eve(): u3v_poke w/out u3A->now XX replace
|
||||
*/
|
||||
static u3_noun
|
||||
_cv_poke_eve(u3_noun sam)
|
||||
{
|
||||
u3_noun fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(_CVX_POKE, u3A->roc)));
|
||||
u3_noun pro;
|
||||
|
||||
{
|
||||
# ifdef U3_MEMORY_DEBUG
|
||||
c3_w cod_w = u3a_lush(u3h(u3t(u3t(sam))));
|
||||
# endif
|
||||
|
||||
pro = u3n_slam_on(fun, sam);
|
||||
|
||||
# ifdef U3_MEMORY_DEBUG
|
||||
u3a_lop(cod_w);
|
||||
# endif
|
||||
}
|
||||
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* u3v_poke_sure(): inject an event, saving new state if successful.
|
||||
*/
|
||||
c3_o
|
||||
u3v_poke_sure(c3_w mil_w, u3_noun eve, u3_noun* pro)
|
||||
{
|
||||
u3_noun gon = u3m_soft(mil_w, _cv_poke_eve, eve);
|
||||
u3_noun tag, dat;
|
||||
u3x_cell(gon, &tag, &dat);
|
||||
|
||||
// event failed, produce trace
|
||||
//
|
||||
if ( u3_blip != tag ) {
|
||||
*pro = gon;
|
||||
return c3n;
|
||||
}
|
||||
|
||||
// event succeeded, persist state and produce effects
|
||||
//
|
||||
{
|
||||
u3_noun vir, cor;
|
||||
u3x_cell(dat, &vir, &cor);
|
||||
|
||||
u3z(u3A->roc);
|
||||
u3A->roc = u3k(cor);
|
||||
u3A->eve_d++;
|
||||
|
||||
*pro = u3k(vir);
|
||||
u3z(gon);
|
||||
return c3y;
|
||||
}
|
||||
}
|
||||
|
||||
/* u3v_tank(): dump single tank.
|
||||
*/
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user