[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua is faster than Java?
- From: Mike Pall <mikelu-0507@...>
- Date: Tue, 26 Jul 2005 16:48:46 +0200
Hi,
Antero Vipunen wrote:
> For example: if the step, limit and start of for are integers why then
> we use floating point arithmetic? If register where i-variable is stored
> is not used in for-body at all, then why we waste time boxing value it
> in the stackobject? Etc...
Sure, I want to do that, too. But not for the first version,
since these are high-level optimizations.
Right now I'm doing only simple control flow analysis with
dead-code elimination and some isolated optimizations (like
the 'x and const or const' idom -- hi Rici).
Anything more convoluted requires proper data flow analysis
and/or cross-function analysis. Yes, some (simpler) ad-hoc
optimizations are imaginable, but that quickly results in a mess.
For later releases I have the following plan:
- Allow for a number of optional high-level optimization
passes to be run before the low-level encoding pass.
- The HL passes analyze the code and add hints to the bytecode.
E.g. 'this loop variable is an integer' or 'this loop
variable is never used' or 'the step value is constant'
or 'these MOVEs/LOADKs can be combined with the RETURN' ...
- The LL pass checks the hints and acts upon them.
E.g. by emitting integer code instead of FP code or
by omitting/combining/replacing instructions etc...
- The LL pass should be (needs to be) written in C and this
is what I'm doing for the first release.
- The HL passes are optional and can (should) be written
in Lua. This needs some glue to pass bytecodes and hints
back and forth.
- You can load expensive optimizations on demand and use
them only when you have enough time and space for them.
Something like: require "jit.opt.unroll-loops"
- Embedded systems could leave out all of the HL stuff
and can enjoy a very low memory footprint. Desktops would
turn some of it on and servers may want to run the full chore.
- Obviously, once the infrastructure for this is in place
(no, not for the first release), everyone can have a
stab at it and implement his/her favourite optimizations.
I can't wait to type: lua -l jit.opt.tree-ssa foo.lua :-)
Ok, so much for my plans. Back to coding (having some fun
with inlined GC barriers).
Bye,
Mike