| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
|
December 16, 2008 Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
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 | ||||
December 17, 2008 Re: Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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
| |||
December 17, 2008 Re: Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Tim M | 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.
| |||
December 17, 2008 Re: Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
Posted in reply to BCS | 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.
>
>
| |||
December 17, 2008 Re: Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Tim M | 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
| |||
December 17, 2008 Re: Partial array bounds checks removal | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote:
> 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
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,
Brad
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply