[m-rev.] for review: Re-factor the MR_join_and_continue macro.

Zoltan Somogyi zs at csse.unimelb.edu.au
Tue Nov 24 19:57:59 AEDT 2009


On 24-Nov-2009, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> I'm beginning to wonder if it would be best to write MR_join_and_continue as a
> C function and use a macro that wraps it to avoid the stack leak as follows:
> 
> extern MR_Code *MR_do_join_and_continue(MR_SyncTerm *sync_term); 
> 
> #define MR_join_and_continue(sync_term, join_label) \
>     do { \
>         MR_Code *jump_target; \
>         jump_target = MR_do_join_and_continue(sync_term); \
>         if (jump_target) { \
>             MR_GOTO(jump_target); \
>         } else { \
>             MR_GOTO(join_label); \
>         } \
>     }

That is exactly the technique we use for calling the debugger; it works well.
I think that is the approach you should use.

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



More information about the reviews mailing list