diff options
author | Mike Pall <mike> | 2020-05-27 19:20:44 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-05-27 19:20:44 +0200 |
commit | 1a4ff1311740aa6c85f7a9101b6aa9bfaafa3f8e (patch) | |
tree | c0bb622eb6a70b71c58d83d4cceed4e4b3279300 /src/lj_asm.c | |
parent | b2307c8ad817e350d65cc909a579ca2f77439682 (diff) | |
download | luajit-1a4ff1311740aa6c85f7a9101b6aa9bfaafa3f8e.tar.gz luajit-1a4ff1311740aa6c85f7a9101b6aa9bfaafa3f8e.tar.bz2 luajit-1a4ff1311740aa6c85f7a9101b6aa9bfaafa3f8e.zip |
Optimize table length computation with hinting.
10x faster on loop with t[#t+1] = x idiom. Also used by table.insert.
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index dd84a4f2..90373f27 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1634,6 +1634,12 @@ static void asm_fuseequal(ASMState *as, IRIns *ir) | |||
1634 | } | 1634 | } |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | static void asm_alen(ASMState *as, IRIns *ir) | ||
1638 | { | ||
1639 | asm_callid(as, ir, ir->op2 == REF_NIL ? IRCALL_lj_tab_len : | ||
1640 | IRCALL_lj_tab_len_hint); | ||
1641 | } | ||
1642 | |||
1637 | /* -- Instruction dispatch ------------------------------------------------ */ | 1643 | /* -- Instruction dispatch ------------------------------------------------ */ |
1638 | 1644 | ||
1639 | /* Assemble a single instruction. */ | 1645 | /* Assemble a single instruction. */ |
@@ -1716,6 +1722,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
1716 | case IR_FLOAD: asm_fload(as, ir); break; | 1722 | case IR_FLOAD: asm_fload(as, ir); break; |
1717 | case IR_XLOAD: asm_xload(as, ir); break; | 1723 | case IR_XLOAD: asm_xload(as, ir); break; |
1718 | case IR_SLOAD: asm_sload(as, ir); break; | 1724 | case IR_SLOAD: asm_sload(as, ir); break; |
1725 | case IR_ALEN: asm_alen(as, ir); break; | ||
1719 | 1726 | ||
1720 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; | 1727 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; |
1721 | case IR_FSTORE: asm_fstore(as, ir); break; | 1728 | case IR_FSTORE: asm_fstore(as, ir); break; |