Specialize bytecode for pairs()/next() iterator. Speedup: 3.5x.
Parser predict pairs/next and emits specialized bytecode. Bytecode is descpecialized at runtime if the prediction was wrong. Store slot index in hidden control var to avoid key lookups.
This commit is contained in:
@@ -240,6 +240,9 @@ LJLIB_ASM(tostring) LJLIB_REC(.)
|
||||
|
||||
/* -- Base library: iterators --------------------------------------------- */
|
||||
|
||||
/* This solves a circular dependency problem -- change FF_next_N as needed. */
|
||||
LJ_STATIC_ASSERT((int)FF_next == FF_next_N);
|
||||
|
||||
LJLIB_ASM(next)
|
||||
{
|
||||
lj_lib_checktab(L, 1);
|
||||
|
||||
Reference in New Issue
Block a user