[m-dev.] profiling grades broken

Fergus Henderson fjh at cs.mu.oz.au
Mon Feb 17 14:45:17 AEDT 1997


Zoltan Somogyi, you wrote:
> 
> Tyson wrote:
> > compiler/llds_out.m:
> > 	- Put 
> > 	  	static bool done = FALSE; 
> > 		if (!done) { 
> > 			done = TRUE 
> > 			[...  call functions ...] 
> > 			} 
> > 	  wrappers around calls to initialization functions.
> 
> The way I see it, if you have two or more such blocks of code, your proposal
> will prevent more than one call to the init functions FROM THE SAME SITE,
> but won't prevent more than one call from different sites.
> 
> Even if there were some reason why one can be sure that there will be
> at most one such site, it would be more robust to put the static bool
> variables in the init functions themselves.

Tyson's solution is more efficient, because it uses one static variable
per module rather than one per C function.

The individual initialization functions should only be called from their
respective per-module initialization functions.  If they're called from
anywhere else, that's a bug anyway, since their meaning (and even existence)
depends on how the Mercury module is split up into C functions, which
is dependent on the the setting of --procs-per-c-function.

So I'd rather go for the more efficient solution.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list