1 - At RREMOVE also check the stack set aside for coercions.

2 - When coercions unexpectedly need stack of part of the
stakpattern, discontinue this option.
This commit is contained in:
keie 1985-03-01 16:25:21 +00:00
parent c2a990768d
commit cb0b2e08cf

View file

@ -392,14 +392,14 @@ if(Debug>1) fprintf(stderr,"Next tuple %d,%d,%d,%d\n",
ntup = tup->p_next;
for (i=0,t=0;i<nregneeded && t<mincost; i++)
t += docoerc(regtp[i],regcp[i],ply,FALSE,tup->p_rar[i]);
if (t<mincost) {
if ( t<mincost && tokpatlen<=stackheight ) {
#ifndef NDEBUG
if (Debug>2)
fprintf(stderr,"Continuing match after coercions\n");
#endif
t += codegen(codep,ply,FALSE,mincost-t,0);
}
if (t<mincost) {
if ( t<mincost && tokpatlen<=stackheight ) {
mincost = t;
besttup = tup;
} else
@ -480,6 +480,7 @@ normalfailed: if (stackpad!=tokpatlen) {
result=compute(&enodes[nodeno]);
if (result.e_typ!=EV_REG)
break;
if ( in_stack(result.e_v.e_reg) ) BROKE() ; /* Check aside-stack */
for (tp= &fakestack[stackheight-tokpatlen-1];tp>=&fakestack[0];tp--)
if (tp->t_token==-1) {
if(tp->t_att[0].ar==result.e_v.e_reg)