digitalmars.D - Partial array bounds checks removal
- bearophile (10/10) Dec 16 2008 This article shows a way to remove lot of array bounds checks, it's not ...
- Tim M (4/22) Dec 16 2008 I haven't tried safeD and i'm guessing that is extra secure version of D...
- BCS (3/6) Dec 16 2008 I think it implication is that some checks can be removed if you can sho...
- Tim M (3/9) Dec 16 2008 But that's the main problem. Oh now this will never fail but you can nev...
- bearophile (4/5) Dec 16 2008 In the last thousand years humans have invented a thing named "mathemati...
- Brad Roberts (8/19) Dec 16 2008 And in the last 30 years, compiler writers have invented optimizers.
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
Dec 16 2008
I haven't tried safeD and i'm guessing that is extra secure version of D but what would be the point in removing those secuirty checks? On Wed, 17 Dec 2008 08:34:17 +1300, bearophile <bearophileHUGS lycos.com> wrote: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
Dec 16 2008
Reply to tim,I haven't tried safeD and i'm guessing that is extra secure version of D but what would be the point in removing those secuirty checks?I think it implication is that some checks can be removed if you can show that they will never fail.
Dec 16 2008
But that's the main problem. Oh now this will never fail but you can never be too sure. Also 640K should be enough for anyone. :) On Wed, 17 Dec 2008 14:26:37 +1300, BCS <ao pathlink.com> wrote:Reply to tim,I haven't tried safeD and i'm guessing that is extra secure version of D but what would be the point in removing those secuirty checks?I think it implication is that some checks can be removed if you can show that they will never fail.
Dec 16 2008
Tim M:Oh now this will never fail but you can never be too sure.<In the last thousand years humans have invented a thing named "mathematics". In certain circumstances it allows you to be certain of some things. In some part of the programs you can use this (simple) mathematics and be actually certain a certain bound will not be exceeded. Trust me, mathematics can be marvelous :-) Bye, bearophile
Dec 16 2008
bearophile wrote:Tim M:And in the last 30 years, compiler writers have invented optimizers. Nearly every bit of that is in the realm of exactly what the optimization phases of a compiler do. So, yes, dmd, llvm, gcc.. they all do this by design. No need to be condescending, bearophile. Later, BradOh now this will never fail but you can never be too sure.<In the last thousand years humans have invented a thing named "mathematics". In certain circumstances it allows you to be certain of some things. In some part of the programs you can use this (simple) mathematics and be actually certain a certain bound will not be exceeded. Trust me, mathematics can be marvelous :-) Bye, bearophile
Dec 16 2008