[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: edgehash
From:       Otto Moerbeek <otto () drijf ! net>
Date:       2007-11-15 8:48:53
Message-ID: 20071115084853.GB6889 () pepper ! intra ! drijf ! net
[Download RAW message or body]

On Thu, Nov 15, 2007 at 09:45:25AM +0100, Anders Magnusson wrote:

> Otto Moerbeek wrote:
> >Hi,
> >
> >Stefan an I found a testcase that seems to be solved by a diff Gregory
> >mailed out some time ago (see below). At that time, ragge said that
> >the particular case should not happen... Anyway, on on powerpc, the
> >symptoms are either a hanging or crashing ccom, if called with
> >-xdeljumps -xtemps. 
> >
> >If ccom hangs, it hangs in adjSet(), because w == w->next.
> >If it crashes, w is a funny pointer.
> >
> >Attached the test file, which is a preprocessed OpenBSD bin/pax/cache.c
> >  
> Hi,
> 
> I looked at this yeasterday to see what really happens, and found out 
> that I was
> wrong in my "shouldn't happen" :-(   So, clearing edgehash as below is the
> correct solution, please check it in.

Since the diff originated form Gregory, I think he should commit it.

	-Otto
	
> 
> Actually, it has been a "shouldn't happen" situation, but due to the nature
> of instruction generation when special needs are involved it get used.
> In liveness analysis temporary registers needed to keep values between
> instructions are usually not entered into any live table because of their
> short-lived nature (when traversing the tree it's known which instructions
> it will interfere with).  But; if the instruction have special needs or 
> so then
> the variables will be kept live for a longer time and therefore added to the
> hash table.
> 
> On i386 or vax there are almost no such special needs so the problem hasn't
> shown up.
> 
> -- Ragge
> 
> >Index: regs.c
> >===================================================================
> >RCS file: /cvs/src/usr.bin/pcc/mip/regs.c,v
> >retrieving revision 1.10
> >diff -u -p -r1.10 regs.c
> >--- regs.c	20 Oct 2007 18:11:51 -0000	1.10
> >+++ regs.c	12 Nov 2007 20:17:56 -0000
> >@@ -2159,12 +2159,12 @@ ngenregs(struct interpass *ipole)
> > 
> > 
> > recalc:
> >+	memset(edgehash, 0, sizeof(edgehash));
> > onlyperm: /* XXX - should not have to redo all */
> > 
> > 	if (nbits) {
> > 		memset(nblock+tempmin, 0, nbits * sizeof(REGW));
> > 		memset(live, 0, BIT2BYTE(nbits));
> >-		memset(edgehash, 0, sizeof(edgehash));
> > #ifdef PCC_DEBUG
> > 		for (i = tempmin; i < tempmax; i++)
> > 			nblock[i].nodnum = i;
> >  
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic