lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hallo,

On Thu, Jun 23, 2011 at 12:41 PM, Francesco Abbate
<francesco.bbt@gmail.com> wrote:
>
> The dualism between static analysis (like with C) and trace analysis
> is strictly tied to the dualism between programming languages with
> static and dynamic typing. This latter kind of languages like Lua or
> Python does not admit a static compilation by design because you don't
> have any information about what type of value a variable can contain,
> the information is only available at run time. Also the mechanism of
> table lookup that is extensively used in Lua and Python does not allow
> any static analysis because the information are available only at run
> time and everything can change during the execution.
>

     This is not true. It is possible, practical and worthy to do
static analysis in dynamic-typed languages implementations. The
literature on this span decades. The "static" here is not about
typing, but instead "analysing without running the code." I myself
have implemented dead-variable elimination, removal of unused
arguments, inlining and removal of known procedures etc. Besides these
simple ones, you can lift computations out of loops (no trace needed
in several cases), do especulative inlining, partial evaluation etc.
Really, you can do *a lot* before running the code.

-- 
-alex
http://www.artisancoder.com/