fixed problem with temporary DEALLOCATES: sometimes a register was
used for stacking, that was only temporarily deallocated
This commit is contained in:
parent
68d3126f16
commit
b9aa04dbb3
|
@ -287,9 +287,14 @@ if (Debug)
|
||||||
i++; tp--;
|
i++; tp--;
|
||||||
}
|
}
|
||||||
if (tokpatlen>stackheight) {
|
if (tokpatlen>stackheight) {
|
||||||
|
int k;
|
||||||
stackpad = tokpatlen-stackheight;
|
stackpad = tokpatlen-stackheight;
|
||||||
for (j=stackheight-1;j>=0;j--)
|
for (j=stackheight-1, k = j + stackpad;j>=0;j--, k--) {
|
||||||
fakestack[j+stackpad] = fakestack[j];
|
fakestack[k] = fakestack[j];
|
||||||
|
/* fakestack[j+stackpad] = fakestack[j]; does not
|
||||||
|
compile under Xenix
|
||||||
|
*/
|
||||||
|
}
|
||||||
for (j=0;j<stackpad;j++)
|
for (j=0;j<stackpad;j++)
|
||||||
fakestack[j].t_token=0;
|
fakestack[j].t_token=0;
|
||||||
stackheight += stackpad;
|
stackheight += stackpad;
|
||||||
|
@ -457,7 +462,7 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
|
||||||
do {
|
do {
|
||||||
npos=exactmatch=0;
|
npos=exactmatch=0;
|
||||||
for(rpp=reglist[propno];rp= *rpp; rpp++)
|
for(rpp=reglist[propno];rp= *rpp; rpp++)
|
||||||
if (getrefcount(rp-machregs)==0) {
|
if (getrefcount(rp-machregs, FALSE)==0) {
|
||||||
pos[npos++] = rp-machregs;
|
pos[npos++] = rp-machregs;
|
||||||
if (eqtoken(&rp->r_contents,&token))
|
if (eqtoken(&rp->r_contents,&token))
|
||||||
exactmatch++;
|
exactmatch++;
|
||||||
|
@ -539,7 +544,7 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
decision = forced;
|
decision = forced;
|
||||||
if (getrefcount(decision)!=0) {
|
if (getrefcount(decision, FALSE)!=0) {
|
||||||
totalcost = INFINITY;
|
totalcost = INFINITY;
|
||||||
BROKE();
|
BROKE();
|
||||||
}
|
}
|
||||||
|
@ -606,7 +611,11 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
|
||||||
}
|
}
|
||||||
for (i=0;i<repllen;i++) {
|
for (i=0;i<repllen;i++) {
|
||||||
assert(stackheight<MAXFSTACK);
|
assert(stackheight<MAXFSTACK);
|
||||||
fakestack[stackheight++] = reptoken[i];
|
fakestack[stackheight] = reptoken[i];
|
||||||
|
stackheight++;
|
||||||
|
/* do not combine previous two statements; that does not
|
||||||
|
compile under Xenix V3.2
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
for(i=0;i<nallreg;i++)
|
for(i=0;i<nallreg;i++)
|
||||||
chrefcount(allreg[i],-1,FALSE);
|
chrefcount(allreg[i],-1,FALSE);
|
||||||
|
@ -616,9 +625,10 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
|
||||||
emrepllen=(codep[-1]>>5)&07;
|
emrepllen=(codep[-1]>>5)&07;
|
||||||
j=emp-emlines;
|
j=emp-emlines;
|
||||||
if (emrepllen>j) {
|
if (emrepllen>j) {
|
||||||
assert(nemlines+emrepllen-j<MAXEMLINES);
|
int k = nemlines + emrepllen - j;
|
||||||
for (i=nemlines;i>=0;i--)
|
assert(k<MAXEMLINES);
|
||||||
emlines[i+emrepllen-j] = emlines[i];
|
for (i=nemlines;i>=0;i--, k--)
|
||||||
|
emlines[k] = emlines[i];
|
||||||
nemlines += emrepllen-j;
|
nemlines += emrepllen-j;
|
||||||
emp += emrepllen-j;
|
emp += emrepllen-j;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ tuples(regls,nregneeded) rl_p *regls; {
|
||||||
|
|
||||||
for (i=0;i<NREGS;i++) {
|
for (i=0;i<NREGS;i++) {
|
||||||
regclass[i] = class++;
|
regclass[i] = class++;
|
||||||
if (getrefcount(i) == 0) {
|
if (getrefcount(i, FALSE) == 0) {
|
||||||
for (j=0;j<i;j++) {
|
for (j=0;j<i;j++) {
|
||||||
if (eqregclass(i,j) &&
|
if (eqregclass(i,j) &&
|
||||||
eqtoken(&machregs[i].r_contents,
|
eqtoken(&machregs[i].r_contents,
|
||||||
|
|
|
@ -38,7 +38,7 @@ chrefcount(regno,amount,tflag) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
getrefcount(regno) {
|
getrefcount(regno, tflag) {
|
||||||
register struct reginfo *rp;
|
register struct reginfo *rp;
|
||||||
register i,maxcount;
|
register i,maxcount;
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ getrefcount(regno) {
|
||||||
#if MAXMEMBERS!=0
|
#if MAXMEMBERS!=0
|
||||||
if (rp->r_members[0]==0)
|
if (rp->r_members[0]==0)
|
||||||
#endif
|
#endif
|
||||||
return(rp->r_refcount);
|
return(rp->r_refcount - (tflag ? rp->r_tcount : 0));
|
||||||
#if MAXMEMBERS!=0
|
#if MAXMEMBERS!=0
|
||||||
else {
|
else {
|
||||||
maxcount=0;
|
maxcount=0;
|
||||||
for (i=0;i<MAXMEMBERS;i++)
|
for (i=0;i<MAXMEMBERS;i++)
|
||||||
if (rp->r_members[i]!=0)
|
if (rp->r_members[i]!=0)
|
||||||
maxcount=max(maxcount,getrefcount(rp->r_members[i]));
|
maxcount=max(maxcount,getrefcount(rp->r_members[i], tflag));
|
||||||
return(maxcount);
|
return(maxcount);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ match(tp,tep,optexp) register token_p tp; register set_p tep; {
|
||||||
if (tp->t_token == -1) { /* register frame */
|
if (tp->t_token == -1) { /* register frame */
|
||||||
bitno = tp->t_att[0].ar+1;
|
bitno = tp->t_att[0].ar+1;
|
||||||
if (tep->set_val[bitno>>4]&(1<<(bitno&017)))
|
if (tep->set_val[bitno>>4]&(1<<(bitno&017)))
|
||||||
if (tep->set_val[0]&1 || getrefcount(tp->t_att[0].ar)<=1)
|
if (tep->set_val[0]&1 || getrefcount(tp->t_att[0].ar, FALSE)<=1)
|
||||||
goto oklabel;
|
goto oklabel;
|
||||||
return(0);
|
return(0);
|
||||||
} else { /* token frame */
|
} else { /* token frame */
|
||||||
|
@ -432,7 +432,7 @@ unsigned stackupto(limit,ply,toplevel) token_p limit; {
|
||||||
if (cp->c1_prop>=0) {
|
if (cp->c1_prop>=0) {
|
||||||
for (rpp=reglist[cp->c1_prop];
|
for (rpp=reglist[cp->c1_prop];
|
||||||
(rp = *rpp)!=0 &&
|
(rp = *rpp)!=0 &&
|
||||||
getrefcount(rp-machregs)!=0;
|
getrefcount(rp-machregs, TRUE)!=0;
|
||||||
rpp++)
|
rpp++)
|
||||||
;
|
;
|
||||||
if (rp==0)
|
if (rp==0)
|
||||||
|
|
Loading…
Reference in a new issue