This article shows a way to remove lot of array bounds checks, it's not the 
first of this kind, but this method seems simple enough.
"Array Bounds Check Elimination for the Java HotSpot Client Compiler"
By Thomas Würthinger, Christian Wimmer and Hanspeter Mössenböck:

http://www.ssw.uni-linz.ac.at/Research/Papers/Wuerthinger07/Wuerthinger07.pdf

With some heuristics it's often able to move the array bounds checks before the 
loop. It also uses some complex tricks to produce the array bound exception 
where it belongs, and not before the loop.

I think a similar strategy may be used by safeD to remove most of its array 
bounds checks, to produce code that is almost as fast as normal D code compiled 
with -release.
(Probably the tricks shown in the article can't be used by a static compiler, 
array bounds checks will be probably thrown before the loops in such safeD.).
(Other heuristics can be used to avoid lot of the checks done to catch integer 
overflow errors).

Bye,
bearophile

Reply via email to