lightning
[Top][All Lists]
Advanced

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

[Lightning] Proof of concept work on inline functions


From: Paulo César Pereira de Andrade
Subject: [Lightning] Proof of concept work on inline functions
Date: Thu, 9 Sep 2010 18:47:14 -0300

  Hi Paolo,

  In the "work" branch at http://github.com/pcpa/lightning/tree/work
I am working on code to convert lightning macros to inline functions,
so, any feedback is welcome :-)

  Some facts:
o Compilation becomes a lot faster, the lightning test tool I am working,
  in http://code.google.com/p/exl/source/browse/trunk/check/lightning
  compiles more than 3 times faster now, but that is just a detail, the
  important thing is speed of jit generation and speed of running jit.
o Debugging is a lot easier, for example, looking at cpp output of
  macros is just a nightmare, but now it is a lot easier.
o It should make it a lot easier to implement logic to generate
  code based on cpu capabilities, and that is the intended result
  of this work.
o It must be carefully checked every step. I think it is triggering
  some problems in gcc, and may trigger in other compilers.
  Most issues were corrected by accessing global data, for
  example, instead of creating a local variable, use a global
  one (usually fields in _jitl jit_local_state), or gcc would apparently
  sometimes think that _jitl is always filled with zeros... Probably
  some issue with constant folding.

  I did not (yet) make any performance measures, but I believe
it should generate faster/smaller code in several paths now,
due to optimized implementation with local variables to know
state, etc, for example, the previous jit_replace() macro,
used logic like:
  push %eax
  mov %esi, %eax
  <<do-something-with-eax>>
  pop %eax
but now it does:
  xchg %esi, %eax
  <<do-something-with-eax>>
  xchg %esi, %eax
but that should at some point also be changed, as there
should be information to know if %eax is "free" at that
point. The example above of course using other register
if %eax is an operand, or falling back to push/pop in
code like "str_c %esi %esi" where it cannot swap
register values.

Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]