[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: bug report
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Fri, 9 Feb 2007 11:44:27 -0500
Roberto Ierusalimschy write:
> > Thierry Grellier reported a bug in Lua 5.1.1. The bug only
> happens in
> > functions with more than 255 names/constants. Then, the
> interaction
> > between contants and table accesses (e.g., "2*a.x") may
> produce weird
> > results. Bellow is an example (all results should be 2).
> > [...]
>
> We could write a quick patch for this bug. However, we are
> considering a more drastic measure: maybe it would be simpler
> to remove constant folding optimization from Lua 5.1.
>
> Currently, I am not sure constant folding is worth the
> trouble. We had all kinds of problems with it: division and
> module by zero, NaN results, problems with exotic lua_Number
> types (which may need a state to create new values), etc. And
> it adds very little to the language: it is very easy for the
> programmer to define suitable local "constants" to avoid
> recomputing constant expressions, when needed.
Consider the following hypothesis: "I'm not sure exactly when constant
folding happens, and if removing it would have a big impact on my
project". Could you present briefly general cases/conditions when
constant folding is extensively used by the compiler, when it works
gracefully, when compiler can't use it, and a simple patch that
desactivate it for worried people to test and benchmark in real world
situation ? That would give you valuable feedback on whether or not
applying your 'drastic' measure would have a negative impact.