summaryrefslogtreecommitdiff
path: root/src/lib_base.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-09-30 21:55:32 +0200
committerMike Pall <mike>2010-09-30 21:55:32 +0200
commitac76493df113e6e648b03e61c0fa56c5754e832d (patch)
treee79e60ea60be028b1ae10587b80eb5f2aa33857d /src/lib_base.c
parentfce05fd6e18a9b1f032f5c7409e1516214220f3c (diff)
downloadluajit-ac76493df113e6e648b03e61c0fa56c5754e832d.tar.gz
luajit-ac76493df113e6e648b03e61c0fa56c5754e832d.tar.bz2
luajit-ac76493df113e6e648b03e61c0fa56c5754e832d.zip
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.
Diffstat (limited to 'src/lib_base.c')
-rw-r--r--src/lib_base.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib_base.c b/src/lib_base.c
index 5f7b059b..8f63effc 100644
--- a/src/lib_base.c
+++ b/src/lib_base.c
@@ -240,6 +240,9 @@ LJLIB_ASM(tostring) LJLIB_REC(.)
240 240
241/* -- Base library: iterators --------------------------------------------- */ 241/* -- Base library: iterators --------------------------------------------- */
242 242
243/* This solves a circular dependency problem -- change FF_next_N as needed. */
244LJ_STATIC_ASSERT((int)FF_next == FF_next_N);
245
243LJLIB_ASM(next) 246LJLIB_ASM(next)
244{ 247{
245 lj_lib_checktab(L, 1); 248 lj_lib_checktab(L, 1);