summaryrefslogtreecommitdiff
path: root/src/lj_bc.h
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/lj_bc.h
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/lj_bc.h')
-rw-r--r--src/lj_bc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lj_bc.h b/src/lj_bc.h
index ba868283..837316d5 100644
--- a/src/lj_bc.h
+++ b/src/lj_bc.h
@@ -154,6 +154,8 @@
154 _(CALLMT, base, ___, lit, call) \ 154 _(CALLMT, base, ___, lit, call) \
155 _(CALLT, base, ___, lit, call) \ 155 _(CALLT, base, ___, lit, call) \
156 _(ITERC, base, lit, lit, call) \ 156 _(ITERC, base, lit, lit, call) \
157 _(ITERN, base, lit, lit, call) \
158 _(ISNEXT, base, ___, jump, ___) \
157 _(VARG, base, lit, lit, ___) \ 159 _(VARG, base, lit, lit, ___) \
158 \ 160 \
159 /* Returns. */ \ 161 /* Returns. */ \
@@ -221,6 +223,9 @@ LJ_STATIC_ASSERT((int)BC_FUNCF + 2 == (int)BC_JFUNCF);
221LJ_STATIC_ASSERT((int)BC_FUNCV + 1 == (int)BC_IFUNCV); 223LJ_STATIC_ASSERT((int)BC_FUNCV + 1 == (int)BC_IFUNCV);
222LJ_STATIC_ASSERT((int)BC_FUNCV + 2 == (int)BC_JFUNCV); 224LJ_STATIC_ASSERT((int)BC_FUNCV + 2 == (int)BC_JFUNCV);
223 225
226/* This solves a circular dependency problem, change as needed. */
227#define FF_next_N 15
228
224/* Stack slots used by FORI/FORL, relative to operand A. */ 229/* Stack slots used by FORI/FORL, relative to operand A. */
225enum { 230enum {
226 FORL_IDX, FORL_STOP, FORL_STEP, FORL_EXT 231 FORL_IDX, FORL_STOP, FORL_STEP, FORL_EXT