Pure functions

  • From: Coda Highland <chighland@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 31 Jan 2013 15:18:11 -0800

I know LuaJIT performs a number of optimizations during compilation,
such as strength reduction and CSE. I also remember Mike having
mentioned something at one point about the JIT knowing that sqrt() is
a pure function and can therefore be hoisted out of a loop as an
invariant.

Does the JIT identify any other functions as pure? Can it identify a
Lua function as pure? If so, how?

Also, does the JIT inline any Lua functions? If it does, how does it
choose which ones to inline?

/s/ Adam

Other related posts: