[m-dev.] for review: MLDS back-end: library fixes

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Tue Dec 7 16:10:58 AEDT 1999


Fergus Henderson writes:
> 
> library/exception.m:
> 	Implement exception handling for the MLDS back-end,
> 	using setjmp() and longjmp().
> 


> Index: library/exception.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/exception.m,v
> retrieving revision 1.6
> diff -u -d -r1.6 exception.m
> --- library/exception.m	1999/10/04 09:04:38	1.6
> +++ library/exception.m	1999/12/06 19:07:52


> +
> +#ifdef MR_USE_GCC_NESTED_FUNCTIONS
> +
> +void
> +mercury__exception__builtin_catch_model_non(MR_Word type_info,
> +	MR_Word pred, MR_Word handler_pred, MR_Box *output,
> +	MR_NestedCont cont)
> +{
> +	ML_ExceptionHandler this_handler;
> +
> +	auto void success_cont(void);
> +	void success_cont(void) {
> +		/*
> +		** If we reach here, it means that
> +		** the nondet goal has succeeded, so we
> +		** need to restore the previous exception
> +		** handler before calling its continuation
> +		*/
> +		ML_exception_handler = this_handler.prev;
> +		(*cont)();
> +
> +		/* 
> +		** If we get here, it means that the continuation
> +		** has failed, and so we are about to redo the
> +		** nondet goal.  Thus we need to re-establish
> +		** its exception handler.
> +		*/
> +		ML_exception_handler = &this_handler;
> +	}
> +
> +	this_handler.prev = ML_exception_handler;
> +	ML_exception_handler = &handler;

Shouldn't that be `&this_handler' rather than `&handler'?

The rest of the diff looks fine to me.

Cheers,
Mark
-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list