death

Stephen Weeks MLton@sourcelight.com
Mon, 26 Nov 2001 22:10:43 -0800


> I won't deny the redundant aspect of passing around the sizes instead of
> just re-evaluating Word8Array.length.  The whole original program was a
> quick hack to see if I could do something for Rico that would be more space
> efficient.

Actually, that reminds me, when I looked at the code originally, I
wondered why you didn't just get the file size and allocate the
appropriately sized array.

> Is it always safe to call invariant()?  I would think that some times the
> result would be an assertion failure even though all was legit because the
> heap was partly changed or some live list was bogus.

To be honest, I'm not sure.  One problem is that the top frame on the
stack isn't known to the GC.  But I think that just means it won't be
checked.  The one thing that you do need to do before calling
invariant is a FlushGC to flush the C locals into the gc state.

Another option is to use gdb and look at the heap yourself before and
after the Posix_IO_read.  If you are familiar enough with failure
condition, it shouldn't be too hard to spot.

Another option would be to tweak the compiler slightly so that it puts
a limit check in every block whether it is needed or not.  Then, when
compiling -gc every we would find out immediately after the first
block that violated the invariant.