[m-dev.] for review: Stack dumps -- the main course (round 2)

Tyson Dowd trd at stimpy.cs.mu.oz.au
Sat Mar 7 15:44:13 AEDT 1998


On 07-Mar-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 06-Mar-1998, Tyson Dowd <trd at stimpy.cs.mu.oz.au> wrote:
> > > Otherwise that looks OK, although I want to double-check that you
> > > got all the #ifdefs right.
> > 
> > I'm farily confident, but I wouldn't be shocked if there are some small
> > problems.
> 
> Speaking of spelling errors... I'm farily confident that I'll find at
> least one small problem ;-)
> 

Doh.  Fumble figners strikes again!

> > +#if defined(MR_STACK_TRACE) || defined(NATIVE_GC)
> > +  #define MR_USE_STACK_LAYOUTS
> > +  #define MR_INSERT_LABELS
> > +#endif
> > +
> > +#if defined(SPEED) && !defined(DEBUG_GOTOS) 
> > +  #define MR_INSERT_LABELS
> > +#endif
> 
> Shouldn't that be
> 
> 	#if !defined(SPEED) || defined(DEBUG_GOTOS) 
> 	  #define MR_INSERT_LABELS
> 	#endif
> 
> Also, if you have say both MR_STACK_TRACE and SPEED defined,
> then you will #define MR_INSERT_LABELS twice.
> That seems a bit dodgy to me, although the various compilers
> we have around don't seem to mind it.
> 

New version:

#if (!defined(SPEED) || defined(DEBUG_GOTOS)) && !defined(MR_INSERT_LABELS)
  #define MR_INSERT_LABELS
#endif

Or would

#if !defined(SPEED) || defined(DEBUG_GOTOS)
  #undef MR_INSERT_LABELS
  #define MR_INSERT_LABELS
#endif

be better?

> mercury_goto.h:
> > +#if !defined(MR_INSERT_LABELS)
> > +  #define	make_label(n, a, l)	/* nothing */
> >  #else
> > +  #define	make_label(n, a, l)	make_entry(n, a, l)
> >  #endif
> 
> It would probably be slightly clearer to invert the condition and to swap the
> order of the `then' and the `else' code.
> 
> > +#if !defined(MR_INSERT_LABELS) && !defined(PROFILE_CALLS)
> > +  #define make_local(n, a, l)	/* nothing */
> >  #else 
> > +  #define make_local(n, a, l)	make_entry(n, a, l)
> >  #endif
> 
> Ditto.
> 
> > +#if !defined(MR_INSERT_LABELS) && !defined(PROFILE_CALLS) \
> > +		&& !defined(DEBUG_LABELS)
> > +  #define make_entry(n, a, l)	/* nothing */
> >  #else
> > +  #define make_entry(n, a, l)	insert_entry(n, a, MR_STACK_LAYOUT(l))
> >  #endif
> 
> Ditto.
> 

#if defined(MR_INSERT_LABELS)
  #define       make_label(n, a, l)     make_entry(n, a, l)
#else
  #define       make_label(n, a, l)     /* nothing */
#endif

#if defined(MR_INSERT_LABELS) || defined(PROFILE_CALLS)
  #define make_local(n, a, l)   make_entry(n, a, l)
#else 
  #define make_local(n, a, l)   /* nothing */
#endif

#if defined(MR_INSERT_LABELS) || defined(PROFILE_CALLS) \
                || defined(DEBUG_LABELS)
  #define make_entry(n, a, l)   insert_entry(n, a, MR_STACK_LAYOUT(l))
#else
  #define make_entry(n, a, l)   /* nothing */
#endif


If this is ok, I think I'll commit this.




More information about the developers mailing list