[m-dev.] Undesirable behaviour in semidet C?

Fergus Henderson fjh at cs.mu.oz.au
Wed Apr 23 11:51:22 AEST 1997


Tyson Richard DOWD, you wrote:
> 
> Here's a problem I just spend several hours tracking down.
> 
> 	save_transient_registers();
> 	SUCCESS_INDICATOR = ML_get_functors_check_range(FunctorNumber,
> 		TypeInfo, &info);
> 	restore_transient_registers();
> 
> On the SPARC, SUCCESS_INDICATOR is stored in %i5, which is a transient
> register that is restored with its old value. This isn't so good...
> 
> Would it be much harder to create a declaration for SUCCESS_INDICATOR as
> a bool, then put code after the C code that assigned SUCCESS_INDICATOR
> to r1, rather than #defining SUCCESS_INDICATOR as r1?

Nope, it wouldn't be harder, but it might be slightly less efficient.

Another alternative is to compile with `gcc -mflat' on SPARCs, so that we
don't have the problems with register windows, and then get rid of the
save_transient_registers() and restore_transient_registers() macros.
That would simplify things a fair bit and might avoid future bugs.

I spent a bit of time investigating this for other reasons.
Unfortunately the compiler doesn't bootstrap with `-mflat' :-(
The generated code crashes after returning from main/2.
I'll see if I can fix this when I get a chance...

-- 
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