lua-users home
lua-l archive

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


> 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.

That is easy. In lcode.c, just add one line:

@@ -629,6 +629,7 @@

 static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
   lua_Number v1, v2, r;
+  return 0;
   if (!isnumeral(e1) || !isnumeral(e2)) return 0;
   v1 = e1->u.nval;
   v2 = e2->u.nval;

-- Roberto