aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ffrecord.c
diff options
context:
space:
mode:
authorMike Pall <mike>2013-02-24 17:59:04 +0100
committerMike Pall <mike>2013-02-24 17:59:04 +0100
commit5e601891fc9faf8cde836e6515bfdd273dd113e9 (patch)
tree2fbf828cd0fc714fe902f8ba81b20b09769247f9 /src/lj_ffrecord.c
parentb8abb4b91d006f884c81b9e95484373bd6eed2d9 (diff)
downloadluajit-5e601891fc9faf8cde836e6515bfdd273dd113e9.tar.gz
luajit-5e601891fc9faf8cde836e6515bfdd273dd113e9.tar.bz2
luajit-5e601891fc9faf8cde836e6515bfdd273dd113e9.zip
Replace table.remove with bytecode builtin.
Diffstat (limited to '')
-rw-r--r--src/lj_ffrecord.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index 51981477..730d5c39 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -729,38 +729,6 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd)
729 729
730/* -- Table library fast functions ---------------------------------------- */ 730/* -- Table library fast functions ---------------------------------------- */
731 731
732static void LJ_FASTCALL recff_table_remove(jit_State *J, RecordFFData *rd)
733{
734 TRef tab = J->base[0];
735 rd->nres = 0;
736 if (tref_istab(tab)) {
737 if (!J->base[1] || tref_isnil(J->base[1])) { /* Simple pop: t[#t] = nil */
738 TRef trlen = lj_ir_call(J, IRCALL_lj_tab_len, tab);
739 GCtab *t = tabV(&rd->argv[0]);
740 MSize len = lj_tab_len(t);
741 emitir(IRTGI(len ? IR_NE : IR_EQ), trlen, lj_ir_kint(J, 0));
742 if (len) {
743 RecordIndex ix;
744 ix.tab = tab;
745 ix.key = trlen;
746 settabV(J->L, &ix.tabv, t);
747 setintV(&ix.keyv, len);
748 ix.idxchain = 0;
749 if (results_wanted(J) != 0) { /* Specialize load only if needed. */
750 ix.val = 0;
751 J->base[0] = lj_record_idx(J, &ix); /* Load previous value. */
752 rd->nres = 1;
753 /* Assumes ix.key/ix.tab is not modified for raw lj_record_idx(). */
754 }
755 ix.val = TREF_NIL;
756 lj_record_idx(J, &ix); /* Remove value. */
757 }
758 } else { /* Complex case: remove in the middle. */
759 recff_nyiu(J);
760 }
761 } /* else: Interpreter will throw. */
762}
763
764static void LJ_FASTCALL recff_table_insert(jit_State *J, RecordFFData *rd) 732static void LJ_FASTCALL recff_table_insert(jit_State *J, RecordFFData *rd)
765{ 733{
766 RecordIndex ix; 734 RecordIndex ix;