Re: Coroutines, Stacks and LuaJIT
- From: Egor Skriptunoff <egor.skriptunoff@xxxxxxxxx>
- To: luajit@xxxxxxxxxxxxx
- Date: Sat, 11 Jul 2015 03:58:50 +0300
On Fri, Jul 10, 2015 at 5:54 PM, Soni L. <fakedme+lj@xxxxxxxxx> wrote:
I was reading this[1] blog post, and it shows a very efficient stack
design... with one small caveat: it doesn't quite work on LuaJIT.
I'd love to see it work on LuaJIT. What makes it hard for it to work on
LuaJIT?
That "mutually-tail-recursive, data-yielding continuations" style means
passing "address for next jump" as function parameter.
Actually, execution path of such code consists of small runs of normal code
interspersed with "jmp EAX" instructions.
I think, main problem is branch prediction of "jmp EAX".
Frequent indirect jumps are not very trace-compiler-friendly :-)
Should "jmp EAX" be replaced with the following fragment to make long path?
cmp EAX,Some_Const_Address
jne Exiting_Hot_Path
Other related posts: