[m-rev.] for review: work around thread procedures crashing in debug grade

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Oct 23 18:22:34 AEST 2007


On Thu, 18 Oct 2007, Peter Wang wrote:

> I think a proper fix would be to write these troublesome procedures as
> :- external procedures so they never get transformed, right?

I think so.

> Estimated hours taken: 1
> Branches: main
>
> The `thread.yield', `semaphore.wait', `semaphore.signal' procedures were
> crashing in debug and deep profiling grades.  The problem is that they caused
> the calling context to suspend but resume in an auxiliary function instead of
> back into the foreign_proc, so code inserted at the end of the foreign_proc by
> those transforms wouldn't be executed.
>
> Work around this by reverting to the original method of taking the address of
> labels so that suspended contexts will resume back within the foreign_proc.
>
> library/thread.m:
> library/thread.semaphore.m:
> 	#define ML_THREAD_AVOID_LABEL_ADDRS if execution tracing or deep
> 	profiling are enabled in low-level C grades.
>
> 	In the problematic problematic foreign_procs, test for
> 	ML_THREAD_AVOID_LABEL_ADDRS and use the workaround if necessary.
>
> 	Unrelated: add missing `tabled_for_io' attributes on foreign_procs in
> 	these modules.
>
> tests/hard_coded/Mmakefile:
> tests/hard_coded/test_semaphore.exp:
> tests/hard_coded/test_semaphore.m:
> tests/hard_coded/test_yield.exp:
> tests/hard_coded/test_yield.m:
> 	Add test cases.

That looks fine.

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