[m-dev.] diff: Runtime support for stack layouts, round 2

Fergus Henderson fjh at cs.mu.oz.au
Wed Nov 26 17:40:58 AEDT 1997


On Wed, Nov 26, 1997 at 05:06:05PM +1100, Tyson Dowd wrote:
> runtime/mercury_calls.h:
> 	Instead of doing ASM_FIXUP_REGS as part of the call macro, do
> 	it as part of the proceed macro.

I don't think this change is correct.
For example, consider the code for ASM_FIXUP_REGS on the Alpha:

  /*
  ** on entry to a procedure, we need to load the $gp register
  ** with the correct value relative to the current address in $27
  */
  #define INLINE_ASM_FIXUP_REGS				\
  	"	ldgp $gp, 0($27)\n" : : : "memory"

Here the Alpha ASM_FIXUP_REGS sets the gp register based on the contents of
the procedure call ($27) register.  If you make ASM_FIXUP_REGS precede
the call, then it will set the gp register based on the _previous_
value in register $27, which may be the address of the wrong procedure. 
Furthermore, I think the `ldgp' assembler pseudo-instruction assumes that
$27 holds the address of the current instruction, and your change violates
that assumption.

Note that tools/bootcheck does not test linking with shared libraries.
To test that, you need to do `make install' into some temporary install
directory, and then do `tests/runtests'.

--
Fergus Henderson <fjh at cs.mu.oz.au>   WWW: <http://www.cs.mu.oz.au/~fjh>  
Note: due to some buggy software and a (probably accidental)
denial-of-service attack, any mail sent to me between
	Tue Nov 25 20:00:00 UTC (6am Wed, local time)
and	Wed Nov 26 06:00:00 UTC (4pm, local time)
may have gone into the bit-bucket.  Please re-send it.



More information about the developers mailing list