G
glen herrmannsfeldt
This has been done in hardware as well.
http://en.wikipedia.org/wiki/Bounds_checking mentions VAX, B6500 and
Burroughs. By some reason this approach has not really catched on.
As I remember VAX allows pages to be marked read-only.
I remember Fortran compilers that would put constants in
read-only pages, such that they couldn't accidentally be
modified. With call-by-reference, modification of constants
has a long history in Fortran.
(snip)This is exactly what Electric Fence does. It is also slow as hell,
I guess the most slowdown comes from where the array ends in
a middle of a virtual memory page and efence
In the 16 bit OS/2 days, when most people were still using 16-bit
DOS, I would allocate arrays by directly calling the OS/2
segment allocation routine, for a segment exactly the size
required. That length then goes into the hardware segment
descriptor register, such that hardware tests the bounds,
even on fetch. That was before paging, though.
(Eventually you run into the 8K segment descriptor per
process limit, but usually it works pretty well.)
If Intel had added a segment descriptor cache to any of
the processors, it would have greatly speeded up some of the
things that were done in the 16 bit, and early 32 bit, OS/2 days.
If done right, it would have delayed the need for 64 bit
processors by some years.
-- glen