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

Zoltan Somogyi zs at csse.unimelb.edu.au
Sat Nov 21 07:49:10 AEDT 2009

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

mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au

More information about the developers mailing list