|
 |
>> It's a lazy calculation. Hopefully the compiler can figure out when it
>> doesn't actually need to do that.
>
> It's provable (no, not a typo of "probable", different thing) that, in
> the general case, the problem "will this line of code ever be executed?"
> is an unsolvable problem. Hence a compiler can make that decision only
> in the most trivial cases.
More tractable is "if X is executed then Y is definitely executed". For
example, the arguments to (+) [over integers] will always be executed.
Therefore, any code that calls (+) can just pass two integers, rather
than bothering to build a graph of heap objects to pass.
It would be one thing if the compiler knew about the special properties
of built-in functions like (+). But in fact it performs a "strictness
analysis" pass which infers this information for all user-written code.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |