[mercury-users] Self-referential data structures
Tyson Dowd
trd at cs.mu.oz.au
Wed Nov 26 14:59:58 AEDT 1997
On 26-Nov-1997, Richard A. O'Keefe <ok at cs.rmit.edu.au> wrote:
>
> If an operation doesn't make sense, then Mercury should produce an
> _intelligible_ error message when it happens.
> "foo/5;2: Attempt to get value stored in a null mutvar"
> is a good response.
> "Segmentation fault, core dumped."
> is not.
I agree. Doing the checks required to give such a message might cause
performance problems for this code. I haven't looked at this case very
carefully, but it might be possible to implement good error messages
along with good efficiency using a virtual memory hack. If, instead of
null, a reasonable pointer value is stored that happens to point into a
protected page (no read, no write), then the signal handler can catch
this message and will be able to tell by the faulting address that it
was a "uninitialized mutvar" error. But this might cause problems with
the GC.
The foo/5;2: part of your error message isn't so easy, but it just
so happens I've been working on stack frame layout data structures
that should allow us to give a stack trace after any runtime error
(stack overflow, out of memory, etc).
--
Tyson Dowd #
# Linux versus Windows is a
trd at cs.mu.oz.au # Win lose situation.
http://www.cs.mu.oz.au/~trd #
More information about the users
mailing list