Partial array bounds checks removal
bearophileHUGS at lycos.com
Tue Dec 16 11:34:17 PST 2008
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:
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).
More information about the Digitalmars-d