Skip to content

Commit

Permalink
fix sip_l assignment in _n_melt
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Aug 10, 2023
1 parent 03db536 commit 4391f8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 5 additions & 6 deletions pkg/noun/nock.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w,

case SKIB: case SLIB: {
c3_l tot_l = 0,
sip_l = u3h(u3t(op));
sip_l = u3h(u3t(u3t(op)));
c3_w j_w, k_w = i_w;
for ( j_w = 0; j_w < sip_l; ++j_w ) {
tot_l += siz_y[++k_w];
Expand Down Expand Up @@ -832,7 +832,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
mem_u->sip_l = sip_l;
// [op_y, sav_o, mem_w, nef]
mem_u->key = u3k(u3t(u3t(u3t(op))));
mem_u->sav_t = _(u3h(u3t(op))); // XX _()
mem_u->sav_t = _(u3h(u3t(op)));
break;
}

Expand Down Expand Up @@ -1128,8 +1128,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o)
// XX we currently search the memoization cache even on the home road
// even though we don't need to since it's always empty
op_y = (c3y == los_o) ? SLIB : SKIB; // overflows to SLIS / SKIS
// c3_o sav_o = ( (1 == u3h(hod)) && (0 == u3t(hod)) ) ? c3n : c3y;
c3_o sav_o = c3n;
c3_o sav_o = ( (1 == u3h(hod)) && (0 == u3t(hod)) ) ? c3n : c3y;
++tot_w; _n_emit(ops, u3nq(op_y, sav_o, mem_w, u3k(nef)));
tot_w += mem_w; _n_apen(ops, mem);
break;
Expand Down Expand Up @@ -2628,13 +2627,13 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
BURN();

do_save:
x = _n_pep(mov, off);
x = _n_pep(mov, off); // product
top = _n_peek(off);
o = *top;
if ( u3R->ski.gul == 0 ) { // scry handler is empty
u3z_cid kid = ( c3y == u3h(o) ? CID_PERSISTENT : CID_TRANSIENT );
if ( ( CID_TRANSIENT != kid ) || ( &(u3H->rod_u) != u3R) ) {
u3z_save_m(kid, 144 + c3__nock, o, x);
u3z_save_m(kid, 144 + c3__nock, u3t(o), x);
}
}
*top = x;
Expand Down
9 changes: 6 additions & 3 deletions pkg/noun/zave.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ u3z_find(u3z_cid cid, u3_noun key)
if ( CID_TRANSIENT == cid ) {
return u3h_get(_har(u3R, cid), key);
}
else if ( CID_PERSISTENT == cid ) {
else {
u3a_road* rod_u = u3R;
while ( 1 ) {
u3_weak got = u3h_get(_har(rod_u, cid), key);
Expand All @@ -69,13 +69,16 @@ u3z_find(u3z_cid cid, u3_noun key)
rod_u = u3to(u3a_road, rod_u->par_p);
};
}
return u3_none;
}
u3_weak
u3z_find_m(u3z_cid cid, c3_m fun, u3_noun one)
{
u3_noun key = u3nc(fun, u3k(one));
return u3z_find(cid, key);
u3_weak val;

val = u3h_get(_har(u3R, cid), key);
u3z(key);
return val;
}

/* u3z_save(): save in memo cache. TRANSFER key; RETAIN val
Expand Down

0 comments on commit 4391f8e

Please sign in to comment.