2010-03-31

mem'mgt's array range checking

3.26: adda/mem'mgt/array range checking:
Java requires range checking on
every array access
. that must be a misunderstanding,
one reason you would set limits on
for-loop var manipulation
is so you could check the array access just once
during the first entry instead of every re-loop ?
. I was worried about how to
efficiently do range checking
but my segmented memory idea is not efficient anyway!
. it's an array of 256 ptrs to
data arrays of some small size like 4k,
the bits are divided so that the high 8bits
will address the ptr,
then the lower bits will address into the data array .
. perhaps this is a bit too low level to commit to;
instead,
you program to a higher interface,
and then let a mem module of the translator
try out various strategies for mixing ideas about
segmented mem with other ideas like
copy to allow array growth .
. either way, the lang' I'm mapping to is c,
and that requires me to explain
just how I avoid alloc'block bounds errors .
. modular arithmetic does seem the way to go;
eg, if the platform allows
unsigned rollovers of only certain ranges,
then that range is the size my
alloc'd blocks need to be .
023:
. another cool way is to give every process a 16bit range
from which all its blocks come from,
and then that process can
completely scramble its own space
but at least there will be interprocess modularity .