mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-17 11:51:32 +03:00
more bugfixes: now boots and restores from checkpoint
This commit is contained in:
parent
b8506c70ea
commit
4fc65663c6
119
noun/jets.c
119
noun/jets.c
@ -710,7 +710,7 @@ _cj_mine_par_old(u3_noun lan, u3_noun axe, u3_noun pel, u3_noun loc)
|
|||||||
if ( u3_nul == lan ) {
|
if ( u3_nul == lan ) {
|
||||||
return u3_none;
|
return u3_none;
|
||||||
}
|
}
|
||||||
else if ( u3r_sing(axe, u3h(par = u3h(lan))) ) {
|
else if ( c3y == u3r_sing(axe, u3h(par = u3h(lan))) ) {
|
||||||
u3_noun lol = u3qdb_put(u3t(par), pel, loc),
|
u3_noun lol = u3qdb_put(u3t(par), pel, loc),
|
||||||
rap = u3nc(u3k(axe), lol);
|
rap = u3nc(u3k(axe), lol);
|
||||||
return u3nc(rap, u3k(u3t(lan)));
|
return u3nc(rap, u3k(u3t(lan)));
|
||||||
@ -762,14 +762,13 @@ _cj_mine_par(u3_noun lan, u3_noun axe, u3_noun pel, u3_noun loc)
|
|||||||
static void
|
static void
|
||||||
_cj_mine(u3_noun cey, u3_noun cor)
|
_cj_mine(u3_noun cey, u3_noun cor)
|
||||||
{
|
{
|
||||||
c3_l jax_l;
|
c3_l par_l, jax_l;
|
||||||
u3_noun bat = u3h(cor),
|
u3_noun bat = u3h(cor),
|
||||||
reg, loc, bal, act, nam, axe, huc, ger;
|
hap, reg, loc, bal, act, nam, axe, huc, ger;
|
||||||
|
|
||||||
u3x_trel(cey, &nam, &axe, &huc);
|
u3x_trel(cey, &nam, &axe, &huc);
|
||||||
if ( 0 == axe ) {
|
if ( 0 == axe ) {
|
||||||
u3_noun pay = u3t(cor);
|
u3_noun pay = u3t(cor);
|
||||||
jax_l = 0;
|
|
||||||
reg = _cj_find_cold(bat);
|
reg = _cj_find_cold(bat);
|
||||||
loc = u3nt(u3nt(c3y, c3y, u3k(pay)), u3k(nam), u3k(huc));
|
loc = u3nt(u3nt(c3y, c3y, u3k(pay)), u3k(nam), u3k(huc));
|
||||||
if ( u3_none == reg ) {
|
if ( u3_none == reg ) {
|
||||||
@ -779,12 +778,11 @@ _cj_mine(u3_noun cey, u3_noun cor)
|
|||||||
u3z(reg);
|
u3z(reg);
|
||||||
reg = ger;
|
reg = ger;
|
||||||
bal = u3nc(u3k(nam), u3_nul);
|
bal = u3nc(u3k(nam), u3_nul);
|
||||||
act = u3nq(jax_l, u3_nul, bal, _cj_jit(jax_l, bat));
|
par_l = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
u3_weak par, pel, pac;
|
u3_weak par, pel, pac;
|
||||||
u3_noun pat;
|
u3_noun pat;
|
||||||
c3_l par_l;
|
|
||||||
|
|
||||||
par = u3r_at(axe, cor);
|
par = u3r_at(axe, cor);
|
||||||
if ( u3_none == par || c3n == u3du(par) ) {
|
if ( u3_none == par || c3n == u3du(par) ) {
|
||||||
@ -802,13 +800,8 @@ _cj_mine(u3_noun cey, u3_noun cor)
|
|||||||
pac = _cj_find_warm(pel);
|
pac = _cj_find_warm(pel);
|
||||||
c3_assert(u3_none != pac);
|
c3_assert(u3_none != pac);
|
||||||
par_l = u3h(pac);
|
par_l = u3h(pac);
|
||||||
jax_l = _cj_hot_mean(par_l, nam);
|
|
||||||
bal = u3nc(u3k(nam), u3k(u3h(u3t(u3t(pac)))));
|
bal = u3nc(u3k(nam), u3k(u3h(u3t(u3t(pac)))));
|
||||||
u3z(pac);
|
u3z(pac);
|
||||||
act = u3nq(jax_l,
|
|
||||||
_cj_warm_hump(jax_l, huc),
|
|
||||||
bal,
|
|
||||||
_cj_jit(jax_l, bat));
|
|
||||||
pat = ( ( 3 == axe ) && (c3y == u3h(u3h(pel))) )
|
pat = ( ( 3 == axe ) && (c3y == u3h(u3h(pel))) )
|
||||||
? u3nt(c3y, c3n, u3k(pel))
|
? u3nt(c3y, c3n, u3k(pel))
|
||||||
: u3nt(c3n, u3k(axe), u3k(pel));
|
: u3nt(c3n, u3k(axe), u3k(pel));
|
||||||
@ -822,10 +815,13 @@ _cj_mine(u3_noun cey, u3_noun cor)
|
|||||||
u3z(pel); u3z(reg);
|
u3z(pel); u3z(reg);
|
||||||
reg = ger;
|
reg = ger;
|
||||||
}
|
}
|
||||||
|
jax_l = _cj_hot_mean(par_l, nam);
|
||||||
#if 0
|
#if 0
|
||||||
u3m_p("new jet", bal);
|
u3m_p("new jet", bal);
|
||||||
fprintf(stderr, " bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
fprintf(stderr, " bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||||
#endif
|
#endif
|
||||||
|
hap = _cj_warm_hump(jax_l, huc);
|
||||||
|
act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat));
|
||||||
u3h_put(u3R->jed.cod_p, bat, reg);
|
u3h_put(u3R->jed.cod_p, bat, reg);
|
||||||
u3h_put(u3R->jed.war_p, loc, act);
|
u3h_put(u3R->jed.war_p, loc, act);
|
||||||
u3z(loc);
|
u3z(loc);
|
||||||
@ -863,6 +859,25 @@ _cj_warm_reap(u3_noun kev)
|
|||||||
u3z(loc);
|
u3z(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* _cj_uni_jun(): merge junior map into senior map.
|
||||||
|
* sem is TRANSFERRED.
|
||||||
|
* jum is RETAINED.
|
||||||
|
*/
|
||||||
|
static u3_noun
|
||||||
|
_cj_uni_jun(u3_noun sem, u3_noun jum)
|
||||||
|
{
|
||||||
|
if ( u3_nul == jum ) {
|
||||||
|
return sem;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u3_noun n, l, r;
|
||||||
|
u3x_trel(jum, &n, &l, &r);
|
||||||
|
sem = _cj_uni_jun(sem, l);
|
||||||
|
sem = _cj_uni_jun(sem, r);
|
||||||
|
return u3kdb_put(sem, u3a_take(u3h(n)), u3a_take(u3t(n)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* _cj_remarry(): merge parent lists.
|
/* _cj_remarry(): merge parent lists.
|
||||||
* sel is TRANSFERRED.
|
* sel is TRANSFERRED.
|
||||||
* jul is RETAINED.
|
* jul is RETAINED.
|
||||||
@ -870,38 +885,35 @@ _cj_warm_reap(u3_noun kev)
|
|||||||
static u3_noun
|
static u3_noun
|
||||||
_cj_remarry(u3_noun sel, u3_noun jul)
|
_cj_remarry(u3_noun sel, u3_noun jul)
|
||||||
{
|
{
|
||||||
u3_noun kel, kev, i, j, par, les, axe, pel, loc;
|
if ( u3_nul == sel ) {
|
||||||
for ( i = jul; u3_nul != i; i = u3t(i) ) {
|
return u3a_take(jul);
|
||||||
par = u3h(i);
|
}
|
||||||
axe = u3a_take(u3h(par));
|
else if ( u3_nul == jul ) {
|
||||||
kel = u3qdb_tap(u3t(par));
|
return sel;
|
||||||
for ( j = kel; u3_nul != j; j = u3t(j) ) {
|
}
|
||||||
kev = u3h(j);
|
else {
|
||||||
pel = u3a_take(u3h(kev));
|
u3_noun sap = u3h(sel),
|
||||||
loc = u3a_take(u3t(kev));
|
jup = u3h(jul),
|
||||||
les = _cj_mine_par(sel, axe, pel, loc);
|
sax = u3h(sap),
|
||||||
u3z(sel); u3z(pel); u3z(loc);
|
jux = u3h(jup);
|
||||||
sel = les;
|
if ( c3y == u3r_sing(sax, jux) ) {
|
||||||
|
u3_noun lol = _cj_uni_jun(u3k(u3t(sap)), u3t(jup)),
|
||||||
|
par = u3nc(u3k(u3h(sap)), lol),
|
||||||
|
nex = _cj_remarry(u3k(u3t(sel)), u3t(jul)),
|
||||||
|
pro = u3nc(par, nex);
|
||||||
|
u3z(sel);
|
||||||
|
return pro;
|
||||||
|
}
|
||||||
|
else if ( c3y == u3qa_lth(sax, jux) ) {
|
||||||
|
u3_noun nex = _cj_remarry(u3k(u3t(sel)), jul),
|
||||||
|
pro = u3nc(u3k(sap), nex);
|
||||||
|
u3z(sel);
|
||||||
|
return pro;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return u3nc(u3a_take(jup), _cj_remarry(sel, u3t(jul)));
|
||||||
}
|
}
|
||||||
u3z(kel); u3z(axe);
|
|
||||||
}
|
}
|
||||||
return sel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* _cj_graft(): merge root maps of registry.
|
|
||||||
* sor is TRANSFERRED.
|
|
||||||
* jor is RETAINED.
|
|
||||||
*/
|
|
||||||
static u3_noun
|
|
||||||
_cj_graft(u3_noun sor, u3_noun jor)
|
|
||||||
{
|
|
||||||
u3_noun i, rut, kel = u3qdb_tap(jor);
|
|
||||||
for ( i = kel; u3_nul != i; i = u3t(i) ) {
|
|
||||||
rut = u3h(i);
|
|
||||||
sor = u3kdb_put(sor, u3a_take(u3h(rut)), u3a_take(u3t(rut)));
|
|
||||||
}
|
|
||||||
u3z(kel);
|
|
||||||
return sor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _cj_cold_reap(): reap cold dashboard entries.
|
/* _cj_cold_reap(): reap cold dashboard entries.
|
||||||
@ -914,7 +926,7 @@ _cj_cold_reap(u3_noun kev)
|
|||||||
u3_weak ser = _cj_find_cold(bat);
|
u3_weak ser = _cj_find_cold(bat);
|
||||||
u3_noun reg = ( u3_none == ser )
|
u3_noun reg = ( u3_none == ser )
|
||||||
? u3a_take(jur)
|
? u3a_take(jur)
|
||||||
: u3nc(_cj_graft(u3k(u3h(ser)), u3h(jur)),
|
: u3nc(_cj_uni_jun(u3k(u3h(ser)), u3h(jur)),
|
||||||
_cj_remarry(u3k(u3t(ser)), u3t(jur)));
|
_cj_remarry(u3k(u3t(ser)), u3t(jur)));
|
||||||
u3h_put(u3R->jed.cod_p, bat, reg);
|
u3h_put(u3R->jed.cod_p, bat, reg);
|
||||||
u3z(ser); u3z(bat);
|
u3z(ser); u3z(bat);
|
||||||
@ -935,7 +947,7 @@ static void
|
|||||||
_cj_ream(u3_noun all)
|
_cj_ream(u3_noun all)
|
||||||
{
|
{
|
||||||
c3_l par_l, jax_l;
|
c3_l par_l, jax_l;
|
||||||
u3_noun i, j, k, rul, loc, bal, act, lop, kev, rut,
|
u3_noun i, j, k, rul, loc, bal, act, lop, kev, rut, hap,
|
||||||
pat, reg, pol, rem, rec, bat, pel, nam, huc;
|
pat, reg, pol, rem, rec, bat, pel, nam, huc;
|
||||||
u3_weak pac;
|
u3_weak pac;
|
||||||
|
|
||||||
@ -947,11 +959,17 @@ _cj_ream(u3_noun all)
|
|||||||
|
|
||||||
// register roots
|
// register roots
|
||||||
rul = u3qdb_tap(rut);
|
rul = u3qdb_tap(rut);
|
||||||
jax_l = 0;
|
|
||||||
for ( j = rul; j != u3_nul; j = u3t(j) ) {
|
for ( j = rul; j != u3_nul; j = u3t(j) ) {
|
||||||
loc = u3t(u3h(j));
|
loc = u3t(u3h(j));
|
||||||
bal = u3nc(u3k(u3h(u3t(loc))), u3_nul);
|
u3x_trel(loc, &pat, &nam, &huc);
|
||||||
act = u3nq(jax_l, u3_nul, bal, _cj_jit(jax_l, bat));
|
bal = u3nc(u3k(nam), u3_nul);
|
||||||
|
jax_l = _cj_hot_mean(0, nam);
|
||||||
|
hap = _cj_warm_hump(jax_l, huc);
|
||||||
|
act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat));
|
||||||
|
#if 0
|
||||||
|
u3m_p("old jet", bal);
|
||||||
|
fprintf(stderr, " bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||||
|
#endif
|
||||||
u3h_put(u3R->jed.war_p, loc, act);
|
u3h_put(u3R->jed.war_p, loc, act);
|
||||||
}
|
}
|
||||||
u3z(rul);
|
u3z(rul);
|
||||||
@ -990,8 +1008,11 @@ _cj_ream(u3_noun all)
|
|||||||
_cj_warm_hump(jax_l, huc),
|
_cj_warm_hump(jax_l, huc),
|
||||||
bal,
|
bal,
|
||||||
_cj_jit(jax_l, bat));
|
_cj_jit(jax_l, bat));
|
||||||
|
#if 0
|
||||||
|
u3m_p("old jet", bal);
|
||||||
|
fprintf(stderr, " bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
|
||||||
|
#endif
|
||||||
u3h_put(u3R->jed.war_p, loc, act);
|
u3h_put(u3R->jed.war_p, loc, act);
|
||||||
u3z(loc);
|
|
||||||
}
|
}
|
||||||
lop = u3t(lop);
|
lop = u3t(lop);
|
||||||
}
|
}
|
||||||
@ -1006,7 +1027,7 @@ static u3_noun rel;
|
|||||||
static void
|
static void
|
||||||
_cj_warm_tap(u3_noun kev)
|
_cj_warm_tap(u3_noun kev)
|
||||||
{
|
{
|
||||||
rel = u3nc(kev, u3k(rel));
|
rel = u3nc(u3k(kev), u3k(rel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* u3j_ream(): rebuild warm state
|
/* u3j_ream(): rebuild warm state
|
||||||
|
@ -509,9 +509,9 @@ void
|
|||||||
u3m_clear(void)
|
u3m_clear(void)
|
||||||
{
|
{
|
||||||
u3h_free(u3R->cax.har_p);
|
u3h_free(u3R->cax.har_p);
|
||||||
u3h_free(u3R->jed.har_p);
|
u3h_free(u3R->jed.war_p);
|
||||||
|
u3h_free(u3R->jed.cod_p);
|
||||||
u3n_bree();
|
u3n_bree();
|
||||||
u3a_lose(u3R->jed.das);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user