[mercury-users] Heap and Stack exception handling in Mercury?

Sander van den Berg xkb at hypernation.net
Fri Nov 29 05:11:45 AEDT 2002


Thanks for the explanation. It really helps the research. I still have some 
more questions:

-Where can I find the implementation files for, for example, the array system?
 I downloaded the "nightly build", untarred the files within but can't find     
the .m files

-Is there a a2ps or Latex mode for Mercury?

Regards,

Sander van den Berg


On Wednesday 27 November 2002 08:05, Fergus Henderson wrote:
> On 26-Nov-2002, Sander van den Berg <xkb at hypernation.net> wrote:
> > I have some more questions about exception handling. How does Mercury
> > handle "system exceptions" like Heap- and stack errors
>
> In the current implementation, heap and stack overflow errors do not result
> in Mercury exceptions, they just result in a run-time error (i.e. the
> program issues an error message and then terminates).
>
> If recovering from heap overflow is important, I think it should
> be possible to do so by using the hlc.gc grade, and installing a C
> out-of-heap handler (see GC_oom_func in boehm_gc/include/gc.h) that calls
> Mercury code which throws an exception.  Probably the Mercury runtime
> system ought to do this automatically in the hlc.gc grade, but until now
> there has been little demand for this, so we haven't gotten around to it.
>
> Likewise it would be possible to add code to check for stack overflow
> at each procedure call, and throw a Mercury exception if the stack
> overflows, rather than the current approach of using the system's virtual
> memory protection to detect stack overflow, which only allows overflows to
> be reported as run-time errors rather than as Mercury exceptions.
> But this would have a performance impact.  There has not been much
> demand for this either.
>
> Many (but not all) of the other kinds of errors which might result in
> processor exceptions, such as division by zero or array indexing errors,
> are checked for in the Mercury standard library code and do result in
> Mercury exceptions rather than run-time errors.
>
> > and kill signals for example.
> > Does it handle a-synchronous exceptions at all?
>
> The Mercury standard library does not have any direct support for
> asynchronous exception handling.  However, it is possible to use
> the foreign language interface for this.  For an example, see the
> file `timeout.m' in the `deep_profiler' directory in a recent
> release-of-the-day version of the mercury-compiler source distribution.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list