lua-users home
lua-l archive

Re: LuaJIT roadmap 2008 question

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


tankxx wrote:
> The calling convention is so well designed that using the function
> slot inplace. May you post the code snippets about frame handling that
> corresponding ldo.c?
> I want to dig into the details about all kinds of frame links. :)
Well, it's heavily-macroized assembler ... but here you go:
 |->gate_lf: // Call gate for fixarg Lua functions.
 | // RA = new base, RB = LFUNC, RC = nargs+1, (BASE = old base), PC = return
 | // DISPATCH initialized
 | mov BASE, RA
 | mov PROTO:RB, LFUNC:RB->pt
 | mov [BASE-4], PC // Store caller PC. <=== !!
 | movzx RA, byte PROTO:RB->framesize
 | mov PC, PROTO:RB->bc
 | mov KBASE, PROTO:RB->k
 | mov L:RB, SAVE_L
 | lea RA, [BASE+RA*8] // Top of frame.
 | lea RC, [BASE+NARGS:RC*8-4] // Points to tag of 1st free slot.
 | cmp RA, L:RB->maxstack
 | ja ->gate_lf_growstack
 | mov RB, LJ_TNIL
 |1: // Clear free slots until top of frame.
 | mov [RC], RB
 | mov [RC+8], RB
 | add RC, 16
 | cmp RC, RA
 | jb <1
 | ins_next
--Mike

AltStyle によって変換されたページ (->オリジナル) /