[m-rev.] for review: fix taking label addresses in standard library

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Feb 6 21:32:40 AEDT 2007




On Tue, 6 Feb 2007, Peter Wang wrote:

> Branches: main
> library/thread.m:
> library/thread.semaphore.m:
> 	Don't take the addresses of labels in spawn/3, semaphore.signal/3 and
> 	semaphore.wait/3 as that is a gcc extension.  This also fixes a crash
> 	in spawn/3 on x86 when the Mercury standard library is dynamically
> 	linked.
>
> library/par_builtin.m:
> 	Rename symbols for module initialisation to be more similar to other
> 	modules.

I spoke too soon - there is a problem with this diff.

Note that the #ifndef protecting this piece of code, specifically
#ifndef MR_HIGHLEVEL_CODE, doesn't match that below for the entry
and definition of mercury__thread__semaphore__nop (which require
MR_THREAD_SAFE to be defined).


>         MR_save_context(MR_ENGINE(MR_eng_this_context));
>         MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume =
> -            &&wait_skip_to_the_end;
> +            MR_ENTRY(mercury__thread__semaphore__nop);
>         MR_ENGINE(MR_eng_this_context)->MR_ctxt_next = sem->suspended;
>         sem->suspended = MR_ENGINE(MR_eng_this_context);
>         MR_UNLOCK(&(sem->lock), ""semaphore__wait"");
>         MR_ENGINE(MR_eng_this_context) = NULL;
>         MR_runnext();

...


> +#if (!defined MR_HIGHLEVEL_CODE) && (defined MR_THREAD_SAFE)
> +    MR_define_extern_entry(mercury__thread__semaphore__nop);
> +#endif
> +").

...

> +
> +:- pragma foreign_code("C",
> +"
> +#if (!defined MR_HIGHLEVEL_CODE) && (defined MR_THREAD_SAFE)
> +
> +    MR_BEGIN_MODULE(semaphores_module)
> +        MR_init_entry_ai(mercury__thread__semaphore__nop);
> +    MR_BEGIN_CODE
> +
> +    MR_define_entry(mercury__thread__semaphore__nop);
> +    {
> +        MR_proceed();
> +    }
> +    MR_END_MODULE
> +
> +#endif

Could you please fix this as it has broken compilation of the standard
library in asm_fast.gc.

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