link statically with libc?
Simon Marlow
simonmar@microsoft.com
Fri, 8 Aug 2003 09:53:04 +0100
=20
> in traditional Sun javac, you get something that basically looks like:
>=20
> for (int i=3D0; i<1000; i++) {
> if i outside of arr bounds, throw exception
> acc +=3D arr[i];
> }
>=20
> but the IBM compiler will lift this out (under certain=20
> circumstances -- for instance, if 'acc' is not in scope of=20
> the catch) to:
>=20
> if 0 outside of arr bounds || 999 outside of arr bounds,=20
> throw exception
> for (int i=3D0; i<1000; i++) {
> // look ma, no checks
> acc +=3D arr[i];
> }
>=20
> does GHC do anything similar to this, or are we getting hit=20
> with array checks at each and every read/write (modulo, of=20
> course, full laziness)?
No, we don't do anything that clever. Some of the bulk array operations
are written in such a way to eliminate obviously-true bound checks (eg.
listArray doesn't do a bound check for every element), but that's about
it.
Cheers,
Simon