Optimize table length computation with hinting.
10x faster on loop with t[#t+1] = x idiom. Also used by table.insert.
This commit is contained in:
@@ -1634,6 +1634,12 @@ static void asm_fuseequal(ASMState *as, IRIns *ir)
|
||||
}
|
||||
}
|
||||
|
||||
static void asm_alen(ASMState *as, IRIns *ir)
|
||||
{
|
||||
asm_callid(as, ir, ir->op2 == REF_NIL ? IRCALL_lj_tab_len :
|
||||
IRCALL_lj_tab_len_hint);
|
||||
}
|
||||
|
||||
/* -- Instruction dispatch ------------------------------------------------ */
|
||||
|
||||
/* Assemble a single instruction. */
|
||||
@@ -1716,6 +1722,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
|
||||
case IR_FLOAD: asm_fload(as, ir); break;
|
||||
case IR_XLOAD: asm_xload(as, ir); break;
|
||||
case IR_SLOAD: asm_sload(as, ir); break;
|
||||
case IR_ALEN: asm_alen(as, ir); break;
|
||||
|
||||
case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break;
|
||||
case IR_FSTORE: asm_fstore(as, ir); break;
|
||||
|
||||
Reference in New Issue
Block a user