Merge pull request #1102 from urbit/nick-no-more

removes unnecessary effect traversals
This commit is contained in:
Joe Bryan 2018-12-12 01:37:50 -05:00 committed by GitHub
commit 22e6a18e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 129 deletions

View File

@ -84,11 +84,6 @@
u3_noun
u3v_pike(u3_noun ovo, u3_noun cor);
/* u3v_nick(): transform enveloped packets, [vir cor].
*/
u3_noun
u3v_nick(u3_noun vir, u3_noun cor);
/* u3v_do(): use a kernel function.
*/
u3_noun
@ -119,11 +114,6 @@
u3_noun
u3v_poke(u3_noun ovo);
/* u3v_http_request(): hear http request on channel (unprotected).
*/
void
u3v_http_request(c3_o sec, u3_noun pox, u3_noun req);
/* u3v_tank(): dump single tank.
*/
void

View File

@ -139,64 +139,6 @@ u3v_pike(u3_noun ovo, u3_noun cor)
return _cv_mung(0, fun, sam);
}
/* u3v_nick(): transform enveloped packets, [vir cor].
*/
u3_noun
u3v_nick(u3_noun vir, u3_noun cor)
{
if ( u3_nul == vir ) {
return u3nt(u3_blip, vir, cor);
}
else {
u3_noun i_vir = u3h(vir);
u3_noun pi_vir, qi_vir;
u3_noun vix;
if ( (c3y == u3r_cell(i_vir, &pi_vir, &qi_vir)) &&
(c3y == u3du(qi_vir)) &&
(c3__hear == u3h(qi_vir)) )
{
u3_noun gon;
gon = u3v_pike(u3k(i_vir), cor);
if ( u3_blip != u3h(gon) ) {
u3z(vir);
return gon;
}
else {
u3_noun viz;
vix = u3k(u3h(u3t(gon)));
cor = u3k(u3t(u3t(gon)));
u3z(gon);
viz = u3kb_weld(vix, u3k(u3t(vir)));
u3z(vir);
return u3v_nick(viz, cor);
}
}
else {
u3_noun nez = u3v_nick(u3k(u3t(vir)), cor);
if ( u3_blip != u3h(nez) ) {
u3z(vir);
return nez;
} else {
u3_noun viz;
viz = u3nc(u3k(i_vir), u3k(u3h(u3t(nez))));
cor = u3k(u3t(u3t(nez)));
u3z(vir);
u3z(nez);
return u3nt(u3_blip, viz, cor);
}
}
}
}
/* _cv_nock_poke(): call poke through hardcoded interface.
*/
static u3_noun
@ -374,15 +316,6 @@ u3v_poke(u3_noun ovo)
return _cv_nock_poke(ovo);
}
/* u3v_http_request(): hear http request on channel (unprotected).
*/
void
u3v_http_request(c3_o sec, u3_noun pox, u3_noun req)
{
// uL(fprintf(uH, "http: request\n"));
u3v_plan(pox, u3nq(c3__this, sec, 0, req));
}
/* u3v_tank(): dump single tank.
*/
void

View File

@ -1601,38 +1601,26 @@ _raft_punk(u3_noun ovo)
free(txt_c);
#endif
if ( u3_blip != u3h(gon) ) {
u3_noun why = u3k(u3h(gon));
u3_noun tan = u3k(u3t(gon));
{
u3_noun hed, tal;
u3x_cell(gon, &hed, &tal);
u3k(hed); u3k(tal);
u3z(gon);
return _raft_lame(ovo, why, tan);
}
else {
u3_noun vir = u3k(u3h(u3t(gon)));
u3_noun cor = u3k(u3t(u3t(gon)));
u3_noun nug;
u3z(gon);
nug = u3v_nick(vir, cor);
if ( u3_blip != u3h(nug) ) {
u3_noun why = u3k(u3h(nug));
u3_noun tan = u3k(u3t(nug));
u3z(nug);
return _raft_lame(ovo, why, tan);
if ( u3_blip != hed ) {
return _raft_lame(ovo, hed, tal);
}
else {
vir = u3k(u3h(u3t(nug)));
cor = u3k(u3t(u3t(nug)));
u3_noun vir, cor;
u3x_cell(tal, &vir, &cor);
u3k(vir); u3k(cor);
u3z(tal);
u3z(nug);
return _raft_sure(ovo, vir, cor);
}
}
// uL(fprintf(uH, "punk oot %s\n", txt_c));
// free(txt_c);
}
/* _raft_push(): save an event

View File

@ -237,42 +237,42 @@ _sist_sing(u3_noun ovo)
{
u3_noun gon = u3m_soft(0, u3v_poke, u3k(ovo));
if ( u3_blip != u3h(gon) ) {
_sist_suck(ovo, gon);
}
else {
u3_noun vir = u3k(u3h(u3t(gon)));
u3_noun cor = u3k(u3t(u3t(gon)));
u3_noun nug;
{
u3_noun hed, tal;
u3x_cell(gon, &hed, &tal);
u3z(gon);
nug = u3v_nick(vir, cor);
if ( u3_blip != u3h(nug) ) {
_sist_suck(ovo, nug);
if ( u3_blip != hed ) {
_sist_suck(ovo, gon);
}
else {
vir = u3h(u3t(nug));
cor = u3k(u3t(u3t(nug)));
u3_noun vir, cor;
u3x_cell(tal, &vir, &cor);
while ( u3_nul != vir ) {
u3_noun fex = u3h(vir);
u3_noun fav = u3t(fex);
if ( c3__init == u3h(fav) ) {
u3A->own = u3k(u3t(fav));
// note: c3__boot == u3h(u3t(ovo))
u3A->fak = ( c3__fake == u3h(u3t(u3t(ovo))) ) ? c3y : c3n;
}
vir = u3t(vir);
}
u3z(nug);
u3z(u3A->roc);
u3A->roc = cor;
u3A->roc = u3k(cor);
{
u3_noun tag, dat;
u3x_trel(ovo, 0, &tag, &dat);
if ( c3__boot == tag ) {
while ( u3_nul != vir ) {
u3_noun fav = u3t(u3h(vir));
if ( c3__init == u3h(fav) ) {
u3A->own = u3k(u3t(fav));
u3A->fak = ( c3__fake == u3h(tag) ) ? c3y : c3n;
}
vir = u3t(vir);
}
}
}
}
u3z(ovo);
}
u3z(gon);
u3z(ovo);
}
/* _sist_cask(): ask for a passcode.