[m-dev.] Large MR_join_and_continue() macros in runtime.

Paul Bone pbone at csse.unimelb.edu.au
Mon Nov 23 13:48:16 AEDT 2009


On Sat, Nov 21, 2009 at 07:49:10AM +1100, Zoltan Somogyi wrote:
> On 18-Nov-2009, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> > I've found myself modifying and maintaining the large MR_join_and_continue()
> > macros in the runtime.  The C preprocessor language is very clumsy, and I'd
> > rather write these as native C procedures.
> 
> As you and Peter both said, C procedures won't work, since they will lead to
> stack leaks.
> 
> Feel free to try to make the code a Mercury procedure hand-written in C,
> but that has its own problems, since you need to arrange parameter passing
> without clobbering the values of any abstract machine registers you need.
> However, if I were you, I would keep it a macro, but give it a major cleanup,
> e.g. fix indentation, get rid of "== MR_TRUE", and use submacros defined with
> "#if ... #else ... #endif" to avoid using macros with code arguments like
> MR_IF_PROFILE_PARALLEL_EXECUTION_SUPPORT.

I had finished making this a Mercury procedure written in C before I received
this e-mail.  I think that I probably woud have made this decision anyway.
I've added more descriptive comments and will make your suggested cleanups.  My
changes bootcheck and run the test suite without problems, however I'm not 100%
confident that I'm generating the LLDS code correctly.  I'd like to know how to
tell the code generator that I plan to use MR_r1 and MR_succip, so that I can
be _sure_ that I'm not clobbering some other code's use of these registers.

I'll post my diff shortly.

Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20091123/2a5c143a/attachment.sig>


More information about the developers mailing list