From b9aa04dbb32dee4dc7a37038fd47b9aa67bcf939 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 15 Jul 1988 11:23:44 +0000 Subject: [PATCH] fixed problem with temporary DEALLOCATES: sometimes a register was used for stacking, that was only temporarily deallocated --- mach/proto/cg/codegen.c | 26 ++++++++++++++++++-------- mach/proto/cg/equiv.c | 2 +- mach/proto/cg/reg.c | 6 +++--- mach/proto/cg/subr.c | 4 ++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/mach/proto/cg/codegen.c b/mach/proto/cg/codegen.c index 93f6a5fed..4da1fe085 100644 --- a/mach/proto/cg/codegen.c +++ b/mach/proto/cg/codegen.c @@ -287,9 +287,14 @@ if (Debug) i++; tp--; } if (tokpatlen>stackheight) { + int k; stackpad = tokpatlen-stackheight; - for (j=stackheight-1;j>=0;j--) - fakestack[j+stackpad] = fakestack[j]; + for (j=stackheight-1, k = j + stackpad;j>=0;j--, k--) { + fakestack[k] = fakestack[j]; + /* fakestack[j+stackpad] = fakestack[j]; does not + compile under Xenix + */ + } for (j=0;j 1) fprintf(stderr, "cost after coercions: %u\n", t); do { npos=exactmatch=0; for(rpp=reglist[propno];rp= *rpp; rpp++) - if (getrefcount(rp-machregs)==0) { + if (getrefcount(rp-machregs, FALSE)==0) { pos[npos++] = rp-machregs; if (eqtoken(&rp->r_contents,&token)) exactmatch++; @@ -539,7 +544,7 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t); } } else { decision = forced; - if (getrefcount(decision)!=0) { + if (getrefcount(decision, FALSE)!=0) { totalcost = INFINITY; BROKE(); } @@ -606,7 +611,11 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t); } for (i=0;i 1) fprintf(stderr, "cost after coercions: %u\n", t); emrepllen=(codep[-1]>>5)&07; j=emp-emlines; if (emrepllen>j) { - assert(nemlines+emrepllen-j=0;i--) - emlines[i+emrepllen-j] = emlines[i]; + int k = nemlines + emrepllen - j; + assert(k=0;i--, k--) + emlines[k] = emlines[i]; nemlines += emrepllen-j; emp += emrepllen-j; } diff --git a/mach/proto/cg/equiv.c b/mach/proto/cg/equiv.c index 73d8b6a03..3ed200546 100644 --- a/mach/proto/cg/equiv.c +++ b/mach/proto/cg/equiv.c @@ -38,7 +38,7 @@ tuples(regls,nregneeded) rl_p *regls; { for (i=0;ir_members[0]==0) #endif - return(rp->r_refcount); + return(rp->r_refcount - (tflag ? rp->r_tcount : 0)); #if MAXMEMBERS!=0 else { maxcount=0; for (i=0;ir_members[i]!=0) - maxcount=max(maxcount,getrefcount(rp->r_members[i])); + maxcount=max(maxcount,getrefcount(rp->r_members[i], tflag)); return(maxcount); } #endif diff --git a/mach/proto/cg/subr.c b/mach/proto/cg/subr.c index 82c98ef45..27b10dc20 100644 --- a/mach/proto/cg/subr.c +++ b/mach/proto/cg/subr.c @@ -30,7 +30,7 @@ match(tp,tep,optexp) register token_p tp; register set_p tep; { if (tp->t_token == -1) { /* register frame */ bitno = tp->t_att[0].ar+1; 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; return(0); } else { /* token frame */ @@ -432,7 +432,7 @@ unsigned stackupto(limit,ply,toplevel) token_p limit; { if (cp->c1_prop>=0) { for (rpp=reglist[cp->c1_prop]; (rp = *rpp)!=0 && - getrefcount(rp-machregs)!=0; + getrefcount(rp-machregs, TRUE)!=0; rpp++) ; if (rp==0) -- 2.34.1